|
|
| version 1.152.2.19.2.22, 2003/07/24 07:21:03 | version 1.159, 2003/09/22 09:19:18 |
|---|---|
| Line 240 static char *pa_GC_strdup(const char *s) | Line 240 static char *pa_GC_strdup(const char *s) |
| size_t size=strlen(s)+1; | size_t size=strlen(s)+1; |
| char *result=(char *)GC_malloc_atomic(size); | char *result=(char *)GC_malloc_atomic(size); |
| if(!result) | |
| SAPI::abort("out of memory (while duplicating XML string [size=%d])", size); | |
| memcpy(result, s, size); | memcpy(result, s, size); |
| return result; | return result; |
| } | } |
| Line 282 static void pa_gc_free_log(void *p){ | Line 285 static void pa_gc_free_log(void *p){ |
| // fprintf(stderr,"catched debug free(0x%p)\n", p); | // fprintf(stderr,"catched debug free(0x%p)\n", p); |
| pa_gc_free(p); | pa_gc_free(p); |
| } | } |
| #else | |
| inline void *check(void *result, const char *where, size_t size) { | |
| if(!result) | |
| SAPI::abort("out of memory (while %s [size=%d])", where, size); | |
| return result; | |
| } | |
| static void* pa_gc_malloc_nonull(size_t size) { | |
| return check(pa_gc_malloc(size), "allocating XML compsite memory", size); | |
| } | |
| static void* pa_gc_malloc_atomic_nonull(size_t size) { | |
| return check(pa_gc_malloc_atomic(size), "allocating XML atomic memory", size); | |
| } | |
| static void* pa_gc_realloc_nonull(void* ptr, size_t size) { | |
| return check(pa_gc_realloc(ptr, size), "reallocating XML memory", size); | |
| } | |
| #endif | #endif |
| #endif | #endif |
| Line 290 void pa_CORD_oom_fn(void) { | Line 311 void pa_CORD_oom_fn(void) { |
| } | } |
| /** | /** |
| @todo LIBXML_VERSION with xmlGcMemSetup will be 2.5.7 | |
| @todo gc: libltdl: substitute lt_dlmalloc & co | @todo gc: libltdl: substitute lt_dlmalloc & co |
| */ | */ |
| static void gc_substitute_memory_management_functions() { | static void gc_substitute_memory_management_functions() { |
| Line 308 static void gc_substitute_memory_managem | Line 328 static void gc_substitute_memory_managem |
| #else | #else |
| xmlGcMemSetup( | xmlGcMemSetup( |
| /*xmlFreeFunc */pa_gc_free, | /*xmlFreeFunc */pa_gc_free, |
| /*xmlMallocFunc */pa_gc_malloc, | /*xmlMallocFunc */pa_gc_malloc_nonull, |
| /*xmlMallocFunc */pa_gc_malloc_atomic, | /*xmlMallocFunc */pa_gc_malloc_atomic_nonull, |
| /*xmlReallocFunc */pa_gc_realloc, | /*xmlReallocFunc */pa_gc_realloc_nonull, |
| /*xmlStrdupFunc */pa_GC_strdup); | /*xmlStrdupFunc */pa_GC_strdup); |
| #endif | #endif |
| Line 412 void pa_globals_init() { | Line 432 void pa_globals_init() { |
| #endif | #endif |
| #ifdef XML | #ifdef XML |
| # define GNOME_LIBS "../../../../win32xml/win32/gnome" | # define GNOME_LIBS "../../../../win32/gnome" |
| # pragma comment(lib, GNOME_LIBS "/glib/lib/libglib-1.3-11.lib") | # pragma comment(lib, GNOME_LIBS "/glib/lib/libglib-1.3-11.lib") |
| # ifdef _DEBUG | # ifdef _DEBUG |