From b137f06d7ecc7beae3b9fbeba0a71b324198c7e2 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sat, 3 Jan 2015 12:27:40 +0100 Subject: Cleanup: rename 'filelist' BLI funcs to consistent naming. Also, add an optional callback to `BLI_filelist_free()` to allow freein void poin if needed (consistency with `BLI_filelist_duplicate()`...). --- source/blender/blenlib/intern/storage.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'source/blender/blenlib/intern/storage.c') diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 78057b1655f..3e680cc8c5a 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -385,9 +385,11 @@ static void bli_adddirstrings(struct BuildDirCtx *dir_ctx) /** * Scans the contents of the directory named *dirname, and allocates and fills in an - * array of entries describing them in *filelist. The length of the array is the function result. + * array of entries describing them in *filelist. + * + * \return The length of filelist array. */ -unsigned int BLI_dir_contents(const char *dirname, struct direntry **filelist) +unsigned int BLI_filelist_dir_contents(const char *dirname, struct direntry **filelist) { struct BuildDirCtx dir_ctx; @@ -443,7 +445,7 @@ void BLI_filelist_duplicate( /** * frees storage for an array of direntries, including the array itself. */ -void BLI_free_filelist(struct direntry *filelist, unsigned int nrentries) +void BLI_filelist_free(struct direntry *filelist, unsigned int nrentries, void (*free_poin)(void *)) { unsigned int i; for (i = 0; i < nrentries; ++i) { @@ -455,7 +457,8 @@ void BLI_free_filelist(struct direntry *filelist, unsigned int nrentries) MEM_freeN(entry->relname); if (entry->path) MEM_freeN(entry->path); - /* entry->poin assumed not to point to anything needing freeing here */ + if (entry->poin && free_poin) + free_poin(entry->poin); } free(filelist); -- cgit v1.2.3