Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-03-14 23:40:42 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-03-14 23:40:42 +0400
commita2a594fb3686921e3225a470bc96f61bc12287a8 (patch)
tree881cb18084b3c3528e6cef158c439ce218576e2c /source/blender/blenlib/intern
parent7626101dc9749a3c6066a0f51720d9953b8b3c69 (diff)
BLI_linklist_free() was incorrectly taking MEM_freeN() as an argument, evidentially this works on x86 - but could cause issues later on.
add BLI_linklist_freeN() which MEM_freeN's each item.
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r--source/blender/blenlib/intern/BLI_linklist.c12
-rw-r--r--source/blender/blenlib/intern/BLI_memarena.c2
-rw-r--r--source/blender/blenlib/intern/storage.c2
3 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/blenlib/intern/BLI_linklist.c b/source/blender/blenlib/intern/BLI_linklist.c
index 0e630efc349..b08fbe17a43 100644
--- a/source/blender/blenlib/intern/BLI_linklist.c
+++ b/source/blender/blenlib/intern/BLI_linklist.c
@@ -155,6 +155,18 @@ void BLI_linklist_free(LinkNode *list, LinkNodeFreeFP freefunc)
}
}
+void BLI_linklist_freeN(LinkNode *list)
+{
+ while (list) {
+ LinkNode *next = list->next;
+
+ MEM_freeN(list->link);
+ MEM_freeN(list);
+
+ list = next;
+ }
+}
+
void BLI_linklist_apply(LinkNode *list, LinkNodeApplyFP applyfunc, void *userdata)
{
for (; list; list = list->next)
diff --git a/source/blender/blenlib/intern/BLI_memarena.c b/source/blender/blenlib/intern/BLI_memarena.c
index 0ac6209fc95..b6b5b600ab1 100644
--- a/source/blender/blenlib/intern/BLI_memarena.c
+++ b/source/blender/blenlib/intern/BLI_memarena.c
@@ -74,7 +74,7 @@ void BLI_memarena_use_align(struct MemArena *ma, const int align)
void BLI_memarena_free(MemArena *ma)
{
- BLI_linklist_free(ma->bufs, (void (*)(void *))MEM_freeN);
+ BLI_linklist_freeN(ma->bufs);
MEM_freeN(ma);
}
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c
index d09d5744ac6..71cd5e529a2 100644
--- a/source/blender/blenlib/intern/storage.c
+++ b/source/blender/blenlib/intern/storage.c
@@ -616,7 +616,7 @@ LinkNode *BLI_file_read_as_lines(const char *name)
*/
void BLI_file_free_lines(LinkNode *lines)
{
- BLI_linklist_free(lines, (void (*)(void *))MEM_freeN);
+ BLI_linklist_freeN(lines);
}
/** is file1 older then file2 */