Update of /cvsroot/gqclient/gq/src
In directory sc8-pr-cvs1:/tmp/cvs-serv30790
Modified Files:
state.c state.h
Log Message:
* Added convenience functions for the freeing and copying of GLists of
g_malloc'd strings
Index: state.c
===================================================================
RCS file: /cvsroot/gqclient/gq/src/state.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** state.c 17 Oct 2003 10:20:38 -0000 1.8
--- state.c 19 Oct 2003 11:53:17 -0000 1.9
***************
*** 323,326 ****
--- 323,346 ----
}
+ GList *copy_list_of_strings(const GList *src)
+ {
+ GList *l = NULL;
+ const GList *I;
+ for (I = src ; I ; I = g_list_next(I) ) {
+ l = g_list_append(l, g_strdup(I->data));
+ }
+ return l;
+ }
+
+ GList *free_list_of_strings(GList *l)
+ {
+ if (l) {
+ g_list_foreach(l, (GFunc) g_free, NULL);
+ g_list_free(l);
+ }
+ return NULL;
+ }
+
+
void state_value_set_list(const char *state_name,
const char *value_name,
Index: state.h
===================================================================
RCS file: /cvsroot/gqclient/gq/src/state.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** state.h 19 Oct 2003 11:48:02 -0000 1.6
--- state.h 19 Oct 2003 11:53:17 -0000 1.7
***************
*** 60,63 ****
--- 60,67 ----
const char *value_name);
+ /* convenience functions for common list manipulations */
+ GList *copy_list_of_strings(const GList *src);
+ GList *free_list_of_strings(GList *l);
+
/* The list set her MUST be a list of strings - nothing else will work */
void state_value_set_list(const char *state_name,
|