diff options
author | Stefan Metzmacher <metze@samba.org> | 2006-08-28 17:38:49 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:16:52 -0500 |
commit | 45b8c41038c587b5993c6219bf6698323cf93494 (patch) | |
tree | ecaafce4564a2e56b28afbee4e901c6b011eb995 | |
parent | 6e4043cb05665f144d53ec0043b717889232d6e7 (diff) | |
download | samba-45b8c41038c587b5993c6219bf6698323cf93494.tar.gz samba-45b8c41038c587b5993c6219bf6698323cf93494.tar.bz2 samba-45b8c41038c587b5993c6219bf6698323cf93494.zip |
r17891: remove c++ warnings from talloc
metze
(This used to be commit fb73ce8d4364a1da3c320034d90c0556529c61c4)
-rw-r--r-- | source4/lib/talloc/talloc.c | 23 | ||||
-rw-r--r-- | source4/lib/talloc/talloc.h | 4 |
2 files changed, 14 insertions, 13 deletions
diff --git a/source4/lib/talloc/talloc.c b/source4/lib/talloc/talloc.c index fc0462929c..293775b1ca 100644 --- a/source4/lib/talloc/talloc.c +++ b/source4/lib/talloc/talloc.c @@ -107,7 +107,7 @@ struct talloc_chunk { /* panic if we get a bad magic value */ static struct talloc_chunk *talloc_chunk_from_ptr(const void *ptr) { - const char *pp = ptr; + const char *pp = (const char *)ptr; struct talloc_chunk *tc = discard_const_p(struct talloc_chunk, pp - TC_HDR_SIZE); if ((tc->flags & ~0xF) != TALLOC_MAGIC) { TALLOC_ABORT("Bad talloc magic value - unknown value"); @@ -177,7 +177,7 @@ void *_talloc(const void *context, size_t size) return NULL; } - tc = malloc(TC_HDR_SIZE+size); + tc = (struct talloc_chunk *)malloc(TC_HDR_SIZE+size); if (tc == NULL) return NULL; tc->size = size; @@ -251,8 +251,9 @@ void *talloc_reference(const void *context, const void *ptr) if (ptr == NULL) return NULL; tc = talloc_chunk_from_ptr(ptr); - handle = talloc_named_const(context, sizeof(*handle), TALLOC_MAGIC_REFERENCE); - + handle = (struct talloc_reference_handle *)talloc_named_const(context, + sizeof(struct talloc_reference_handle), + TALLOC_MAGIC_REFERENCE); if (handle == NULL) return NULL; /* note that we hang the destructor off the handle, not the @@ -646,13 +647,13 @@ void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *n return NULL; } - tc = new_ptr; + tc = (struct talloc_chunk *)new_ptr; tc->flags &= ~TALLOC_FLAG_FREE; if (tc->parent) { - tc->parent->child = new_ptr; + tc->parent->child = tc; } if (tc->child) { - tc->child->parent = new_ptr; + tc->child->parent = tc; } if (tc->prev) { @@ -962,7 +963,7 @@ char *talloc_strdup(const void *t, const char *p) if (!p) { return NULL; } - ret = talloc_memdup(t, p, strlen(p) + 1); + ret = (char *)talloc_memdup(t, p, strlen(p) + 1); if (ret) { talloc_set_name_const(ret, ret); } @@ -1003,7 +1004,7 @@ char *talloc_strndup(const void *t, const char *p, size_t n) for (len=0; len<n && p[len]; len++) ; - ret = _talloc(t, len + 1); + ret = (char *)_talloc(t, len + 1); if (!ret) { return NULL; } memcpy(ret, p, len); ret[len] = 0; @@ -1033,7 +1034,7 @@ char *talloc_vasprintf(const void *t, const char *fmt, va_list ap) return NULL; } - ret = _talloc(t, len+1); + ret = (char *)_talloc(t, len+1); if (ret) { va_copy(ap2, ap); vsnprintf(ret, len+1, fmt, ap2); @@ -1243,7 +1244,7 @@ void talloc_show_parents(const void *context, FILE *file) /* return 1 if ptr is a parent of context */ -int talloc_is_parent(const void *context, const char *ptr) +int talloc_is_parent(const void *context, const void *ptr) { struct talloc_chunk *tc; diff --git a/source4/lib/talloc/talloc.h b/source4/lib/talloc/talloc.h index 40351693fa..b904029bda 100644 --- a/source4/lib/talloc/talloc.h +++ b/source4/lib/talloc/talloc.h @@ -59,7 +59,7 @@ typedef void TALLOC_CTX; #define talloc_set_destructor(ptr, function) \ do { \ int (*_talloc_destructor_fn)(_TALLOC_TYPEOF(ptr)) = (function); \ - _talloc_set_destructor((ptr), (void *)_talloc_destructor_fn); \ + _talloc_set_destructor((ptr), (int (*)(void *))_talloc_destructor_fn); \ } while(0) /* this extremely strange macro is to avoid some braindamaged warning stupidity in gcc 4.1.x */ @@ -149,7 +149,7 @@ void *talloc_autofree_context(void); size_t talloc_get_size(const void *ctx); void *talloc_find_parent_byname(const void *ctx, const char *name); void talloc_show_parents(const void *context, FILE *file); -int talloc_is_parent(const void *context, const char *ptr); +int talloc_is_parent(const void *context, const void *ptr); #endif |