summaryrefslogtreecommitdiff
path: root/source4/librpc
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-08-28 17:17:39 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:16:51 -0500
commit787a4d6f45007b8f04b7d14e347a7122676faff6 (patch)
tree0ce131530ef3e9589731c46b72a57410217c995a /source4/librpc
parent66314777f6667995154b9418aba7dfb26a2b3c88 (diff)
downloadsamba-787a4d6f45007b8f04b7d14e347a7122676faff6.tar.gz
samba-787a4d6f45007b8f04b7d14e347a7122676faff6.tar.bz2
samba-787a4d6f45007b8f04b7d14e347a7122676faff6.zip
r17888: use talloc_*_ptrtype() macros as wrappers arround the talloc_*_size()
functions to get rid of c++ warnings metze (This used to be commit 7579503bb886e9c4cc08756013f5311ce550c9fd)
Diffstat (limited to 'source4/librpc')
-rw-r--r--source4/librpc/ndr/libndr.h21
1 files changed, 10 insertions, 11 deletions
diff --git a/source4/librpc/ndr/libndr.h b/source4/librpc/ndr/libndr.h
index 59bfc6ab00..1076936c1d 100644
--- a/source4/librpc/ndr/libndr.h
+++ b/source4/librpc/ndr/libndr.h
@@ -255,29 +255,28 @@ enum ndr_compression_alg {
}\
} while(0)
-#define NDR_PULL_ALLOC_SIZE(ndr, s, size) do { \
+#define NDR_PULL_ALLOC(ndr, s) do { \
_NDR_PULL_FIX_CURRENT_MEM_CTX(ndr);\
- (s) = talloc_size(ndr->current_mem_ctx, size); \
- if (!(s)) return ndr_pull_error(ndr, NDR_ERR_ALLOC, "Alloc %u failed: %s\n",(unsigned)size, __location__); \
+ (s) = talloc_ptrtype(ndr->current_mem_ctx, (s)); \
+ if (!(s)) return ndr_pull_error(ndr, NDR_ERR_ALLOC, "Alloc %s failed: %s\n", # s, __location__); \
} while (0)
-#define NDR_PULL_ALLOC(ndr, s) NDR_PULL_ALLOC_SIZE(ndr, s, sizeof(*(s)))
-
-#define NDR_PULL_ALLOC_N_SIZE(ndr, s, n, elsize) do { \
+#define NDR_PULL_ALLOC_N(ndr, s, n) do { \
_NDR_PULL_FIX_CURRENT_MEM_CTX(ndr);\
- (s) = talloc_array_size(ndr->current_mem_ctx, elsize, n); \
- if (!(s)) return ndr_pull_error(ndr, NDR_ERR_ALLOC, "Alloc %u * %u failed: %s\n", (unsigned)n, (unsigned)elsize, __location__); \
+ (s) = talloc_array_ptrtype(ndr->current_mem_ctx, (s), n); \
+ if (!(s)) return ndr_pull_error(ndr, NDR_ERR_ALLOC, "Alloc %u * %s failed: %s\n", (unsigned)n, # s, __location__); \
} while (0)
-#define NDR_PULL_ALLOC_N(ndr, s, n) NDR_PULL_ALLOC_N_SIZE(ndr, s, n, sizeof(*(s)))
-
#define NDR_PUSH_ALLOC_SIZE(ndr, s, size) do { \
(s) = talloc_size(ndr, size); \
if (!(s)) return ndr_push_error(ndr, NDR_ERR_ALLOC, "push alloc %u failed: %s\n", (unsigned)size, __location__); \
} while (0)
-#define NDR_PUSH_ALLOC(ndr, s) NDR_PUSH_ALLOC_SIZE(ndr, s, sizeof(*(s)))
+#define NDR_PUSH_ALLOC(ndr, s) do { \
+ (s) = talloc_ptrtype(ndr, (s)); \
+ if (!(s)) return ndr_push_error(ndr, NDR_ERR_ALLOC, "push alloc %s failed: %s\n", # s, __location__); \
+} while (0)
/* these are used when generic fn pointers are needed for ndr push/pull fns */
typedef NTSTATUS (*ndr_push_flags_fn_t)(struct ndr_push *, int ndr_flags, const void *);