Enlightenment CVS committal Author : kwo Project : e16 Module : e
Dir : e16/e/src Modified Files: buttons.c Log Message: Fix some memleaks. =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/buttons.c,v retrieving revision 1.48 retrieving revision 1.49 diff -u -3 -r1.48 -r1.49 --- buttons.c 27 Feb 2005 01:11:50 -0000 1.48 +++ buttons.c 27 Feb 2005 01:53:22 -0000 1.49 @@ -1110,82 +1110,75 @@ const char *ss; int num, i; - if (params) + if (!params) { - sscanf(params, "%1000s", s); - if (!strcmp(s, "button")) - { - sscanf(params, "%*s %1000s", s); - b = (Button *) FindItem(s, 0, LIST_FINDBY_NAME, LIST_TYPE_BUTTON); - if (b) - ButtonToggle(b); - } - else if (!strcmp(s, "buttons")) - { - ss = atword(params, 2); - if (ss) - { - lst = (Button **) ListItemType(&num, LIST_TYPE_BUTTON); - if (lst) - { - for (i = 0; i < num; i++) - { - if (matchregexp(ss, ButtonGetName(lst[i]))) - { - if (strcmp(ButtonGetName(lst[i]), - "_DESKTOP_DESKRAY_DRAG_CONTROL")) - ButtonToggle(lst[i]); - } - } - } - } - } - else if (!strcmp(s, "all_buttons_except")) + lst = (Button **) ListItemTypeID(&num, LIST_TYPE_BUTTON, 0); + for (i = 0; i < num; i++) + ButtonToggle(lst[i]); + if (lst) + Efree(lst); + goto done; + } + + sscanf(params, "%1000s", s); + if (!strcmp(s, "button")) + { + sscanf(params, "%*s %1000s", s); + b = FindItem(s, 0, LIST_FINDBY_NAME, LIST_TYPE_BUTTON); + if (b) + ButtonToggle(b); + } + else if (!strcmp(s, "buttons")) + { + ss = atword(params, 2); + if (!ss) + return; + + lst = (Button **) ListItemType(&num, LIST_TYPE_BUTTON); + for (i = 0; i < num; i++) { - ss = atword(params, 2); - if (ss) + if (matchregexp(ss, ButtonGetName(lst[i]))) { - lst = (Button **) ListItemTypeID(&num, LIST_TYPE_BUTTON, 0); - if (lst) - { - for (i = 0; i < num; i++) - { - if (!matchregexp(ss, ButtonGetName(lst[i]))) - { - if (strcmp(ButtonGetName(lst[i]), - "_DESKTOP_DESKRAY_DRAG_CONTROL")) - ButtonToggle(lst[i]); - } - } - } + if (strcmp(ButtonGetName(lst[i]), + "_DESKTOP_DESKRAY_DRAG_CONTROL")) + ButtonToggle(lst[i]); } } - else if (!strcmp(s, "all")) + if (lst) + Efree(lst); + } + else if (!strcmp(s, "all_buttons_except")) + { + ss = atword(params, 2); + if (!ss) + return; + + lst = (Button **) ListItemTypeID(&num, LIST_TYPE_BUTTON, 0); + for (i = 0; i < num; i++) { - lst = (Button **) ListItemType(&num, LIST_TYPE_BUTTON); - if (lst) + if (!matchregexp(ss, ButtonGetName(lst[i]))) { - for (i = 0; i < num; i++) - { - if (strcmp - (ButtonGetName(lst[i]), - "_DESKTOP_DESKRAY_DRAG_CONTROL")) - ButtonToggle(lst[i]); - } + if (strcmp(ButtonGetName(lst[i]), + "_DESKTOP_DESKRAY_DRAG_CONTROL")) + ButtonToggle(lst[i]); } } + if (lst) + Efree(lst); } - else + else if (!strcmp(s, "all")) { - lst = (Button **) ListItemTypeID(&num, LIST_TYPE_BUTTON, 0); - if (lst) + lst = (Button **) ListItemType(&num, LIST_TYPE_BUTTON); + for (i = 0; i < num; i++) { - for (i = 0; i < num; i++) - { - ButtonToggle(lst[i]); - } + if (strcmp(ButtonGetName(lst[i]), "_DESKTOP_DESKRAY_DRAG_CONTROL")) + ButtonToggle(lst[i]); } + if (lst) + Efree(lst); } + + done: StackDesktops(); autosave(); } ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs