Enlightenment CVS committal Author : raster Project : e17 Module : libs/eet
Dir : e17/libs/eet/src/lib Modified Files: eet_data.c Log Message: handle NULL strings and "" as the same - and only produce null strings to avoid tonnes of 1 byte allocs =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/eet/src/lib/eet_data.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -3 -r1.27 -r1.28 --- eet_data.c 4 Nov 2005 07:16:50 -0000 1.27 +++ eet_data.c 23 Nov 2005 12:55:43 -0000 1.28 @@ -307,6 +307,11 @@ p = s; len = 0; while ((p < (char *)src_end) && (*p != 0)) {len++; p++;} + if (len == 0) + { + *d = NULL; + return 0; + } *d = malloc(len + 1); if (!(*d)) return -1; memcpy(*d, s, len); @@ -322,7 +327,8 @@ const char *empty_s = ""; s = (char *)(*((char **)src)); - if (!s) s = (char *)empty_s; + if (!s) return NULL; +// if (!s) s = (char *)empty_s; len = strlen(s); d = malloc(len + 1); if (!d) return NULL; ------------------------------------------------------- This SF.Net email is sponsored by the JBoss Inc. Get Certified Today Register for a JBoss Training Course. Free Certification Exam for All Training Attendees Through End of 2005. For more info visit: http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs