diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-11-13 01:35:58 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-11-13 01:35:58 +0300 |
commit | a35345f8bab9502ba10920bf93a2547ef9d35f4c (patch) | |
tree | 6c725ccfc33767c007c998c65017d8b7952be80b /source/blender | |
parent | 8449f0d77640c466acbda7d6ceeb71bc48317b44 (diff) |
2 utility functions added for projection painting.
* BLI_linklist_index() - to get an items index in a LinkList
* BLI_memarena_use_malloc() - BLI_memarena_use_calloc alredy existed but there was no way to switch back to malloc.
also added texnodes to cmake
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenlib/BLI_linklist.h | 1 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_memarena.h | 1 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_linklist.c | 12 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_memarena.c | 4 | ||||
-rw-r--r-- | source/blender/nodes/CMakeLists.txt | 2 |
5 files changed, 19 insertions, 1 deletions
diff --git a/source/blender/blenlib/BLI_linklist.h b/source/blender/blenlib/BLI_linklist.h index e840ffd167a..ed202c11429 100644 --- a/source/blender/blenlib/BLI_linklist.h +++ b/source/blender/blenlib/BLI_linklist.h @@ -45,6 +45,7 @@ typedef struct LinkNode { } LinkNode; int BLI_linklist_length (struct LinkNode *list); +int BLI_linklist_index (struct LinkNode *list, void *ptr); void BLI_linklist_reverse (struct LinkNode **listp); diff --git a/source/blender/blenlib/BLI_memarena.h b/source/blender/blenlib/BLI_memarena.h index 34d732e1862..a2954f8fa0d 100644 --- a/source/blender/blenlib/BLI_memarena.h +++ b/source/blender/blenlib/BLI_memarena.h @@ -50,6 +50,7 @@ typedef struct MemArena MemArena; struct MemArena* BLI_memarena_new (int bufsize); void BLI_memarena_free (struct MemArena *ma); +void BLI_memarena_use_malloc (struct MemArena *ma); void BLI_memarena_use_calloc (struct MemArena *ma); void* BLI_memarena_alloc (struct MemArena *ma, int size); diff --git a/source/blender/blenlib/intern/BLI_linklist.c b/source/blender/blenlib/intern/BLI_linklist.c index 506a1036ed6..962bbeea373 100644 --- a/source/blender/blenlib/intern/BLI_linklist.c +++ b/source/blender/blenlib/intern/BLI_linklist.c @@ -50,6 +50,18 @@ int BLI_linklist_length(LinkNode *list) { } } +int BLI_linklist_index(struct LinkNode *list, void *ptr) +{ + int index; + + for (index = 0; list; list= list->next, index++) { + if (list->link == ptr) + return index; + } + + return -1; +} + void BLI_linklist_reverse(LinkNode **listp) { LinkNode *rhead= NULL, *cur= *listp; diff --git a/source/blender/blenlib/intern/BLI_memarena.c b/source/blender/blenlib/intern/BLI_memarena.c index 69dd13cd335..87d2f0426b2 100644 --- a/source/blender/blenlib/intern/BLI_memarena.c +++ b/source/blender/blenlib/intern/BLI_memarena.c @@ -60,6 +60,10 @@ void BLI_memarena_use_calloc(MemArena *ma) { ma->use_calloc= 1; } +void BLI_memarena_use_malloc(MemArena *ma) { + ma->use_calloc= 0; +} + void BLI_memarena_free(MemArena *ma) { BLI_linklist_free(ma->bufs, (void(*)(void*)) MEM_freeN); MEM_freeN(ma); diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt index cf83804b999..22e732d046b 100644 --- a/source/blender/nodes/CMakeLists.txt +++ b/source/blender/nodes/CMakeLists.txt @@ -23,7 +23,7 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC intern/*.c intern/CMP_nodes/*.c intern/SHD_nodes/*.c) +FILE(GLOB SRC intern/*.c intern/CMP_nodes/*.c intern/SHD_nodes/*.c intern/TEX_nodes/*.c) SET(INC . ../../../intern/guardedalloc ../include ../blenlib ../makesdna |