On Wed, Aug 30, 2017 at 5:29 AM, Jean-Philippe ANDRÉ <j...@videolan.org> wrote:
> jpeg pushed a commit to branch master.
>
> http://git.enlightenment.org/core/efl.git/commit/?id=4a6b52465df25a671f6298650182900e2f1407da
>
> commit 4a6b52465df25a671f6298650182900e2f1407da
> Author: Jean-Philippe Andre <jp.an...@samsung.com>
> Date:   Wed Aug 30 13:55:47 2017 +0900
>
>     eina: Add convenience eina_rectangle_equal
>
>     @feature
> ---
>  src/lib/eina/eina_inline_rectangle.x |  7 +++++++
>  src/lib/eina/eina_rectangle.h        | 14 ++++++++++++++
>  2 files changed, 21 insertions(+)
>
> diff --git a/src/lib/eina/eina_inline_rectangle.x 
> b/src/lib/eina/eina_inline_rectangle.x
> index af257495eb..a6a07a43ed 100644
> --- a/src/lib/eina/eina_inline_rectangle.x
> +++ b/src/lib/eina/eina_inline_rectangle.x
> @@ -48,6 +48,13 @@ eina_rectangle_coords_from(Eina_Rectangle *r, int x, int 
> y, int w, int h)
>  }
>
>  static inline Eina_Bool
> +eina_rectangle_equal(const Eina_Rectangle *rect1, const Eina_Rectangle 
> *rect2)
> +{
> +   return ((rect1->x == rect2->x) && (rect1->y == rect2->y) &&
> +           (rect1->w == rect2->w) && (rect1->h == rect2->h));
> +}

do these on stack values, not pointers... because you can avoid any
change of segfault in this code.

Users can easily do "*r" if they have a pointer, however they will
likely not, just a value.

Same for modifying operations, get on stack, return on stack, so this
is possible:

r = eina_rectangle_move(r, 10, 10);



-- 
Gustavo Sverzut Barbieri
--------------------------------------
Mobile: +55 (16) 99354-9890

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to