added function list_append_list_strdup

ulab-original
jsorg71 18 years ago
parent 58dc2e0df7
commit 9a5e4d594f

@ -179,3 +179,21 @@ list_insert_item(struct list* self, int index, long item)
self->items[index] = item;
}
}
/*****************************************************************************/
/* append one list to another using strdup for each item in the list */
/* begins copy at start_index, a zero based index on the soure list */
void APP_CC
list_append_list_strdup(struct list* self, struct list* dest, int start_index)
{
int index;
long item;
char* dup;
for (index = start_index; index < self->count; index++)
{
item = list_get_item(self, index);
dup = g_strdup((char*)item);
list_add_item(dest, (long)dup);
}
}

@ -47,5 +47,7 @@ void APP_CC
list_remove_item(struct list* self, int index);
void APP_CC
list_insert_item(struct list* self, int index, long item);
void APP_CC
list_append_list_strdup(struct list* self, struct list* dest, int start_index);
#endif

Loading…
Cancel
Save