[Extractor-gtk-cvslog] SF.net SVN: extractor-gtk:[108] trunk/extractor
Extract files from unusual archive formats
Brought to you by:
someone-guy
From: <som...@us...> - 2008-08-23 11:21:12
|
Revision: 108 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=108&view=rev Author: someone-guy Date: 2008-08-23 11:21:10 +0000 (Sat, 23 Aug 2008) Log Message: ----------- add_entry_empty helper function Modified Paths: -------------- trunk/extractor/helpers.c trunk/extractor/helpers.h Modified: trunk/extractor/helpers.c =================================================================== --- trunk/extractor/helpers.c 2008-08-22 16:12:15 UTC (rev 107) +++ trunk/extractor/helpers.c 2008-08-23 11:21:10 UTC (rev 108) @@ -33,6 +33,13 @@ return name; } +void add_entry_empty(struct file_s **list, int cnt) { + file_t *l = *list; + l = realloc(l, (cnt + 2) * sizeof(file_t)); + memset(&l[cnt + 1], 0, sizeof(file_t)); + *list = l; +} + /** * \brief append a new entry to a file list * \param list file list to append to @@ -41,12 +48,11 @@ * \param ext extension of entry to add */ void add_entry_nr(struct file_s **list, int cnt, int namenr, const char *ext) { - file_t *l = *list; - l = realloc(l, (cnt + 2) * sizeof(file_t)); - memset(&l[cnt + 1], 0, sizeof(file_t)); + file_t *l; + add_entry_empty(list, cnt); + l = *list; l[cnt].name = malloc(50); snprintf(l[cnt].name, 50, "%i.%s", namenr, ext); - *list = l; } /** Modified: trunk/extractor/helpers.h =================================================================== --- trunk/extractor/helpers.h 2008-08-22 16:12:15 UTC (rev 107) +++ trunk/extractor/helpers.h 2008-08-23 11:21:10 UTC (rev 108) @@ -42,6 +42,7 @@ #define HUGETAG(a, b, c, d, e, f, g, h) (((uint64_t)(TAG(a, b, c, d)) << 32) | TAG(e, f, g, h)) struct file_s; +void add_entry_empty(struct file_s **list, int cnt); void add_entry_nr(struct file_s **list, int cnt, int namenr, const char *ext); void add_entry(struct file_s **list, int cnt, const char *ext); void default_free_list(struct file_s *list); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |