Indeed, if you want to free + zero, it can save you a line, but it's not as clear (from the unexperienced PoV, it will just free(), not zero the pointer). I prefer explicitly doing it, as most cases you do not want to NULL it, or should NULL it (valgrind case).
E_FREE_LIST() is useless because of EINA_LIST_FREE(). E_INSIDE() and E_CLAMP() could have a chance. On Sat, Nov 10, 2012 at 7:42 PM, Michael Blumenkrantz < michael.blumenkra...@gmail.com> wrote: > the macros aren't bad programming practice, the potential USE of them is. > in > the case where you want to free+null a pointer, having a macro like this is > useful. blindly using this macro as a replacement for free() is not useful. > > but I was thinking of macros like E_FREE_LIST, E_INSIDE, and E_CLAMP > rather than > E_FREE > > On Sat, 10 Nov 2012 22:20:02 +0100 > Gustavo Sverzut Barbieri <barbi...@profusion.mobi> wrote: > > > These macros are bad programming practice. I hate them, particularly > E_FREE > > that sets to NULL and valgrind will loose track where the memory was > freed > > (because the address is gone) > > > > On Saturday, November 10, 2012, Michael Blumenkrantz wrote: > > > > > On Sun, 11 Nov 2012 00:40:35 +0900 > > > Daniel Juyung Seo <seojuyu...@gmail.com> wrote: > > > > > > > Oh.. E_FREE looks very useful. > > > > How about introducing something like this to eina(or all other efl > > > > libraries)? > > > > At least I want to adopt this to elementary. > > > > > > > > Daniel Juyung seo (SeoZ) > > > > > > > > > > > > On Sat, Nov 10, 2012 at 7:10 PM, Tom Hacohen <t...@stosb.com> wrote: > > > > > > > > > Done, thanks. > > > > > > > > > > On 09/11/12 21:50, Sebastian Dransfeld wrote: > > > > > > E_FREE > > > > > > > > > > > > S. > > > > > > > > > > > > Den 9. nov. 2012 kl. 20:41 skrev "Enlightenment SVN" < > > > > > no-re...@enlightenment.org>: > > > > > > > > > > > >> Log: > > > > > >> E entry: Fixed issue with marup and text set/get. > > > > > >> > > > > > >> This fixes #1715 or at least should. > > > > > >> > > > > > >> Author: tasn > > > > > >> Date: 2012-11-09 11:41:06 -0800 (Fri, 09 Nov 2012) > > > > > >> New Revision: 79061 > > > > > >> Trac: http://trac.enlightenment.org/e/changeset/79061 > > > > > >> > > > > > >> Modified: > > > > > >> trunk/e/src/bin/e_entry.c > > > > > >> > > > > > >> Modified: trunk/e/src/bin/e_entry.c > > > > > >> > =================================================================== > > > > > >> --- trunk/e/src/bin/e_entry.c 2012-11-09 19:33:38 UTC (rev > 79060) > > > > > >> +++ trunk/e/src/bin/e_entry.c 2012-11-09 19:41:06 UTC (rev > 79061) > > > > > >> @@ -101,16 +101,22 @@ > > > > > >> * @param text the text to set > > > > > >> */ > > > > > >> EAPI void > > > > > >> -e_entry_text_set(Evas_Object *entry, const char *text) > > > > > >> +e_entry_text_set(Evas_Object *entry, const char *_text) > > > > > >> { > > > > > >> E_Entry_Smart_Data *sd; > > > > > >> + char *text = NULL; > > > > > >> > > > > > >> if (evas_object_smart_smart_get(entry) != _e_entry_smart) > > > > > SMARTERRNR(); > > > > > >> if ((!entry) || (!(sd = evas_object_smart_data_get(entry)))) > > > > > >> return; > > > > > >> > > > > > >> + text = evas_textblock_text_utf8_to_markup( > > > > > >> + edje_object_part_object_get(sd->entry_object, > > > > > ENTRY_PART_NAME), > > > > > >> + _text); > > > > > >> edje_object_part_text_set(sd->entry_object, ENTRY_PART_NAME, > > > text); > > > > > >> evas_object_smart_callback_call(entry, "changed", NULL); > > > > > >> + if (text) > > > > > >> + free(text); > > > > > >> } > > > > > >> > > > > > >> /** > > > > > >> @@ -123,11 +129,21 @@ > > > > > >> e_entry_text_get(Evas_Object *entry) > > > > > >> { > > > > > >> E_Entry_Smart_Data *sd; > > > > > >> + static char *text = NULL; > > > > > >> > > > > > >> if (evas_object_smart_smart_get(entry) != _e_entry_smart) > > > > > SMARTERR(NULL); > > > > > >> if ((!entry) || (!(sd = evas_object_smart_data_get(entry)))) > > > > > >> return NULL; > > > > > >> - return edje_object_part_text_get(sd->entry_object, > > > ENTRY_PART_NAME); > > > > > >> + > > > > > >> + if (text) > > > > > >> + { > > > > > >> + free(text); > > > > > >> + text = NULL; > > > > > >> + } > > > > > >> + text = evas_textblock_text_markup_to_utf8( > > > > > >> + edje_object_part_object_get(sd->entry_object, > > > > > ENTRY_PART_NAME), > > > > > >> + edje_object_part_text_get(sd->entry_object, > > > ENTRY_PART_NAME)); > > > > > >> + return text;<probably all of the macros in e.h would be > useful > > > to have in eina > -- Gustavo Sverzut Barbieri http://profusion.mobi embedded systems -------------------------------------- MSN: barbi...@gmail.com Skype: gsbarbieri Mobile: +55 (19) 9225-2202 ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_nov _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel