diff options
author | Martin Poirier <theeth@yahoo.com> | 2008-11-14 19:09:23 +0300 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2008-11-14 19:09:23 +0300 |
commit | 6eda50f8d978cfd565c6abf9645e88268a61e89b (patch) | |
tree | ecb300db605ebba58d238bfae9c1a7ce2ff55f20 /source/blender/blenlib | |
parent | 59ac45dd12ca5a177318815f9396cd6b97cea766 (diff) | |
parent | 7cce946de708d697e3131676cc94507f4421e07b (diff) |
Merging trunk 17342:17457
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_blenlib.h | 2 | ||||
-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/SConscript | 6 | ||||
-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/blenlib/intern/threads.c | 2 |
7 files changed, 24 insertions, 4 deletions
diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h index 4bbda9709d7..13d5b5fe829 100644 --- a/source/blender/blenlib/BLI_blenlib.h +++ b/source/blender/blenlib/BLI_blenlib.h @@ -416,7 +416,7 @@ void *BLI_pointer_from_int(int val); * @param member The name of a member field of @a strct * @retval The offset in bytes of @a member within @a strct */ -#define BLI_STRUCT_OFFSET(strct, member) ((int) &((strct*) 0)->member) +#define BLI_STRUCT_OFFSET(strct, member) ((int)(intptr_t) &((strct*) 0)->member) #ifdef __cplusplus } 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/SConscript b/source/blender/blenlib/SConscript index e7a4f2eaf13..829b39f4a61 100644 --- a/source/blender/blenlib/SConscript +++ b/source/blender/blenlib/SConscript @@ -7,9 +7,11 @@ cflags='' incs = '. ../makesdna ../blenkernel #/intern/guardedalloc ../include' incs += ' ' + env['BF_FREETYPE_INC'] incs += ' ' + env['BF_ZLIB_INC'] -incs += ' ' + env['BF_SDL_INC'] defs = '' +if env['WITH_BF_SDL']: + incs += ' ' + env['BF_SDL_INC'] + if env['WITH_BF_INTERNATIONAL']: defs = 'WITH_FREETYPE2' @@ -21,7 +23,7 @@ if env['OURPLATFORM'] == 'linux2': cflags='-pthread' incs += ' ../../../extern/binreloc/include' -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw'): +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross'): incs += ' ' + env['BF_PTHREADS_INC'] env.BlenderLib ( 'bf_blenlib', sources, Split(incs), Split(defs), libtype=['core', 'intern', 'player'], priority = [85,150,195], compileflags =cflags ) 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/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c index 9df8bbc81e3..07c02b8024f 100644 --- a/source/blender/blenlib/intern/threads.c +++ b/source/blender/blenlib/intern/threads.c @@ -42,7 +42,7 @@ /* for checking system threads - BLI_system_thread_count */ #ifdef WIN32 -#include "Windows.h" +#include "windows.h" #elif defined(__APPLE__) #include <sys/types.h> #include <sys/sysctl.h> |