if naming clashes you can use variations as I did in eina_value, there I have:
  - eina_value_flush() x eina_value_free()
  - eina_value_char_init() x eina_value_char_new()

etc.

On Wed, Aug 30, 2017 at 10:06 PM, Jean-Philippe André <j...@videolan.org> wrote:
> 2017-08-30 22:38 GMT+09:00 Gustavo Sverzut Barbieri <barbi...@gmail.com>:
>
>> 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);
>> <https://lists.sourceforge.net/lists/listinfo/enlightenment-devel>
>
>
> So... eina_rectangle is a very unsafe API right now. I kept the same
> approach for consistency. Honestly I also dislike the "un-safety" of that
> API.
>
> I know that the lack of checks is for some obscure hotpath optimization in
> some remote corner of Evas, but to me it sounds like the rare places that
> need the unsafe & optimal code should do so by using some kind of #define
> before including Eina.h. What do you think? Cedric?
>
> --
> Jean-Philippe André
> ------------------------------------------------------------------------------
> 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



-- 
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