diff options
Diffstat (limited to 'lib/isc/mem.c')
-rw-r--r-- | lib/isc/mem.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/lib/isc/mem.c b/lib/isc/mem.c index 20fec46c7cbf..f45a077e1e94 100644 --- a/lib/isc/mem.c +++ b/lib/isc/mem.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2010, 2012 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2010, 2012-2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1997-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -68,7 +68,7 @@ typedef struct debuglink debuglink_t; struct debuglink { ISC_LINK(debuglink_t) link; const void *ptr[DEBUGLIST_COUNT]; - unsigned int size[DEBUGLIST_COUNT]; + size_t size[DEBUGLIST_COUNT]; const char *file[DEBUGLIST_COUNT]; unsigned int line[DEBUGLIST_COUNT]; unsigned int count; @@ -396,12 +396,10 @@ static struct isc__mempoolmethods { * mctx must be locked. */ static inline void -add_trace_entry(isc__mem_t *mctx, const void *ptr, unsigned int size - FLARG) -{ +add_trace_entry(isc__mem_t *mctx, const void *ptr, size_t size FLARG) { debuglink_t *dl; unsigned int i; - unsigned int mysize = size; + size_t mysize = size; if ((isc_mem_debugging & ISC_MEM_DEBUGTRACE) != 0) fprintf(stderr, isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM, @@ -456,7 +454,7 @@ add_trace_entry(isc__mem_t *mctx, const void *ptr, unsigned int size } static inline void -delete_trace_entry(isc__mem_t *mctx, const void *ptr, unsigned int size, +delete_trace_entry(isc__mem_t *mctx, const void *ptr, size_t size, const char *file, unsigned int line) { debuglink_t *dl; @@ -555,9 +553,9 @@ more_basic_blocks(isc__mem_t *ctx) { return (ISC_FALSE); } if (ctx->basic_table_size != 0) { - memcpy(table, ctx->basic_table, - ctx->basic_table_size * - sizeof(unsigned char *)); + memmove(table, ctx->basic_table, + ctx->basic_table_size * + sizeof(unsigned char *)); (ctx->memfree)(ctx->arg, ctx->basic_table); } ctx->basic_table = table; @@ -623,7 +621,7 @@ more_frags(isc__mem_t *ctx, size_t new_size) { total_size = ctx->mem_target; new = ctx->basic_blocks; ctx->basic_blocks = ctx->basic_blocks->next; - frags = total_size / new_size; + frags = (int)(total_size / new_size); ctx->stats[new_size].blocks++; ctx->stats[new_size].freefrags += frags; /* @@ -1605,7 +1603,7 @@ isc___mem_reallocate(isc_mem_t *ctx0, void *ptr, size_t size FLARG) { oldsize -= ALIGNMENT_SIZE; } copysize = (oldsize > size) ? size : oldsize; - memcpy(new_ptr, ptr, copysize); + memmove(new_ptr, ptr, copysize); isc__mem_free(ctx0, ptr FLARG_PASS); } } else if (ptr != NULL) |