Changeset 998 in svn for trunk/xcache/xc_mem.c


Ignore:
Timestamp:
2012-07-19T05:57:56+02:00 (3 years ago)
Author:
Xuefer
Message:

refactor: fix build, easier devel

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        11acinclude.m4
        22aclocal.m4
         3autom4te.cache
        34build
        45config.cache
         
        1516conftest.c
        1617.deps
         18devel.ini
         19devel.php
         20.gdb_history
        1721include
        1822includes.i
         
        2731mkinstalldirs
        2832modules
        29 processor.h
        30 processor.out
        31 processor_real.c
         33prepare.devel.inc
        3234run-tests.php
        3335structinfo.m4
        34 autom4te.cache
         36.svnignore
        3537tags
        36 prepare.devel.inc
         38xc_processor.c
         39xc_processor.h
         40xc_processor.out.c
  • trunk/xcache/xc_mem.c

    r989 r998  
    11#ifdef TEST
    2 #include <limits.h>
    3 #include <stdio.h>
     2#   include <limits.h>
     3#   include <stdio.h>
    44#   define XCACHE_DEBUG
     5typedef int zend_bool;
     6#   define ZEND_ATTRIBUTE_PTR_FORMAT(a, b, c)
     7#   define zend_error(type, error) fprintf(stderr, "%s", error)
    58#else
    6 #include <php.h>
     9#   include <php.h>
    710#endif
    811
     
    1821#define XC_MEM_IMPL _xc_mem_mem_t
    1922#include "xc_shm.h"
    20 #include "xc_utils.h"
     23// #include "xc_utils.h"
    2124#include "util/xc_align.h"
    2225#include "util/xc_trace.h"
     
    323326/* {{{ testing */
    324327#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
    326334#include <time.h>
    327335
     
    331339    void *p;
    332340    void *memory;
    333     xc_mem_t *mem;
    334341    void **ptrs;
     342    xc_mem_t mem_holder, *mem = &mem_holder;
    335343    int size, i;
    336344
     
    342350#endif
    343351    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");
    346354
    347355    while ((p = xc_mem_malloc(mem, 1))) {
     356        fprintf(stderr, "%d %p\n", count, ptrs);
    348357        ptrs[count ++] = p;
    349358    }
Note: See TracChangeset for help on using the changeset viewer.