Changeset 998 for trunk/xcache/xc_mem.c
- Timestamp:
- 07/19/2012 05:57:56 AM (10 months ago)
- Location:
- trunk
- Files:
-
- 2 modified
-
. (modified) (1 prop)
-
xcache/xc_mem.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 1 1 acinclude.m4 2 2 aclocal.m4 3 autom4te.cache 3 4 build 4 5 config.cache … … 15 16 conftest.c 16 17 .deps 18 devel.ini 19 devel.php 20 .gdb_history 17 21 include 18 22 includes.i … … 27 31 mkinstalldirs 28 32 modules 29 processor.h 30 processor.out 31 processor_real.c 33 prepare.devel.inc 32 34 run-tests.php 33 35 structinfo.m4 34 autom4te.cache36 .svnignore 35 37 tags 36 prepare.devel.inc 38 xc_processor.c 39 xc_processor.h 40 xc_processor.out.c
-
- Property svn:ignore
-
trunk/xcache/xc_mem.c
r989 r998 1 1 #ifdef TEST 2 # include <limits.h>3 # include <stdio.h>2 # include <limits.h> 3 # include <stdio.h> 4 4 # define XCACHE_DEBUG 5 typedef int zend_bool; 6 # define ZEND_ATTRIBUTE_PTR_FORMAT(a, b, c) 7 # define zend_error(type, error) fprintf(stderr, "%s", error) 5 8 #else 6 # include <php.h>9 # include <php.h> 7 10 #endif 8 11 … … 18 21 #define XC_MEM_IMPL _xc_mem_mem_t 19 22 #include "xc_shm.h" 20 #include "xc_utils.h"23 // #include "xc_utils.h" 21 24 #include "util/xc_align.h" 22 25 #include "util/xc_trace.h" … … 323 326 /* {{{ testing */ 324 327 #undef CHECK 325 #define CHECK(a, msg) do { if ((a) == NULL) { puts(msg); return -1; } } while (0) 328 #define CHECK(a, msg) do { \ 329 if (!(a)) { \ 330 fprintf(stderr, "%s\n", msg); return -1; \ 331 } \ 332 } while (0) 333 326 334 #include <time.h> 327 335 … … 331 339 void *p; 332 340 void *memory; 333 xc_mem_t *mem;334 341 void **ptrs; 342 xc_mem_t mem_holder, *mem = &mem_holder; 335 343 int size, i; 336 344 … … 342 350 #endif 343 351 CHECK(memory = malloc(size), "OOM"); 344 CHECK(ptrs = malloc(size * sizeof(void *)), "OOM");345 CHECK(mem = xc_mem_init(memory, size), "Failed init memory allocator");352 CHECK(ptrs = malloc(size * sizeof(void *)), "OOM"); 353 CHECK(mem = xc_mem_init(memory, mem, size), "Failed init memory allocator"); 346 354 347 355 while ((p = xc_mem_malloc(mem, 1))) { 356 fprintf(stderr, "%d %p\n", count, ptrs); 348 357 ptrs[count ++] = p; 349 358 }

