# HG changeset patch # User ib # Date 1310312718 0 # Node ID 04b4fa214c2aa5e584280743479c974a45ef1229 # Parent 55d46640a679d417011d8731cbcd9fb429cd23fa Remove duplicated list code from the Win32 GUI. Use common code. Patch by Stephen Sheldon, sfsheldo gmail com. diff -r 55d46640a679 -r 04b4fa214c2a Makefile --- a/Makefile Sun Jul 10 15:42:09 2011 +0000 +++ b/Makefile Sun Jul 10 15:45:18 2011 +0000 @@ -518,6 +518,7 @@ SRCS_MPLAYER-$(GL_X11) += libvo/x11_common.c SRCS_MPLAYER-$(MATRIXVIEW) += libvo/vo_matrixview.c libvo/matrixview.c SRCS_MPLAYER-$(GUI) += gui/util/bitmap.c \ + gui/util/list.c \ gui/util/string.c SRCS_MPLAYER-$(GUI_GTK) += gui/app.c \ gui/cfg.c \ @@ -542,7 +543,6 @@ gui/ui/sub.c \ gui/ui/widgets.c \ gui/util/cut.c \ - gui/util/list.c \ gui/wm/ws.c \ gui/wm/wsxdnd.c \ diff -r 55d46640a679 -r 04b4fa214c2a gui/win32/interface.c --- a/gui/win32/interface.c Sun Jul 10 15:42:09 2011 +0000 +++ b/gui/win32/interface.c Sun Jul 10 15:45:18 2011 +0000 @@ -94,53 +94,6 @@ return 0; } -/** - * \brief this actually creates a new list containing only one element... - */ -void gaddlist( char ***list, const char *entry) -{ - int i; - - if (*list) - { - for (i=0; (*list)[i]; i++) free((*list)[i]); - free(*list); - } - - *list = malloc(2 * sizeof(char **)); - (*list)[0] = gstrdup(entry); - (*list)[1] = NULL; -} - -/** - * \brief this replaces a string starting with search by replace. - * If not found, replace is appended. - */ -void greplace(char ***list, const char *search, const char *replace) -{ - int i = 0; - int len = (search) ? strlen(search) : 0; - - if (*list) - { - for (i = 0; (*list)[i]; i++) - { - if (search && (!strncmp((*list)[i], search, len))) - { - free((*list)[i]); - (*list)[i] = gstrdup(replace); - return; - } - } - *list = realloc(*list, (i + 2) * sizeof(char *)); - } - else - *list = malloc(2 * sizeof(char *)); - - (*list)[i] = gstrdup(replace); - (*list)[i + 1] = NULL; -} - /* this function gets called by the gui to update mplayer */ static void guiSetEvent(int event) {