ucx/mempool.c

changeset 95
ecfdc1c4a552
parent 75
990734f548ef
child 103
08018864fb91
     1.1 --- a/ucx/mempool.c	Wed Feb 27 11:48:29 2013 +0100
     1.2 +++ b/ucx/mempool.c	Wed Feb 27 13:30:21 2013 +0100
     1.3 @@ -5,6 +5,9 @@
     1.4  #include <stdlib.h>
     1.5  #include <string.h>
     1.6  #include <stdio.h>
     1.7 +#ifdef __cplusplus
     1.8 +#define __STDC_FORMAT_MACROS
     1.9 +#endif
    1.10  #include <inttypes.h>
    1.11  
    1.12  #include "mempool.h"
    1.13 @@ -79,13 +82,13 @@
    1.14      char *newm = (char*) realloc(mem, n + sizeof(ucx_destructor));
    1.15      if (newm == NULL) return NULL;
    1.16      if (mem != newm) {
    1.17 -        for(int i=0;i<pool->ndata;i++) {
    1.18 +        for(size_t i=0 ; i < pool->ndata ; i++) {
    1.19              if(pool->data[i] == mem) {
    1.20                  pool->data[i] = newm;
    1.21                  return newm + sizeof(ucx_destructor);
    1.22              }
    1.23          }
    1.24 -        fprintf(stderr, "FATAL: 0x%08"PRIxPTR" not in mpool 0x%08"PRIxPTR"\n",
    1.25 +        fprintf(stderr, "FATAL: 0x%08" PRIxPTR" not in mpool 0x%08" PRIxPTR"\n",
    1.26            (intptr_t)ptr, (intptr_t)pool);
    1.27          exit(1);
    1.28      } else {
    1.29 @@ -95,7 +98,7 @@
    1.30  
    1.31  void ucx_mempool_free(UcxMempool *pool) {
    1.32      ucx_memchunk *chunk;
    1.33 -    for(int i=0;i<pool->ndata;i++) {
    1.34 +    for(size_t i=0 ; i<pool->ndata ; i++) {
    1.35          chunk = (ucx_memchunk*) pool->data[i];
    1.36          if(chunk->destructor != NULL) {
    1.37              chunk->destructor(&chunk->c);

mercurial