svn commit: samba r17888 - in branches/SAMBA_4_0/source: librpc/ndr scripting/ejs

metze at samba.org metze at samba.org
Mon Aug 28 17:17:39 GMT 2006


Author: metze
Date: 2006-08-28 17:17:39 +0000 (Mon, 28 Aug 2006)
New Revision: 17888

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17888

Log:
use talloc_*_ptrtype() macros as wrappers arround the talloc_*_size()
functions to get rid of c++ warnings

metze 
Modified:
   branches/SAMBA_4_0/source/librpc/ndr/libndr.h
   branches/SAMBA_4_0/source/scripting/ejs/ejsrpc.h


Changeset:
Modified: branches/SAMBA_4_0/source/librpc/ndr/libndr.h
===================================================================
--- branches/SAMBA_4_0/source/librpc/ndr/libndr.h	2006-08-28 17:12:12 UTC (rev 17887)
+++ branches/SAMBA_4_0/source/librpc/ndr/libndr.h	2006-08-28 17:17:39 UTC (rev 17888)
@@ -255,29 +255,28 @@
 	}\
 } 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 *);

Modified: branches/SAMBA_4_0/source/scripting/ejs/ejsrpc.h
===================================================================
--- branches/SAMBA_4_0/source/scripting/ejs/ejsrpc.h	2006-08-28 17:12:12 UTC (rev 17887)
+++ branches/SAMBA_4_0/source/scripting/ejs/ejsrpc.h	2006-08-28 17:17:39 UTC (rev 17888)
@@ -139,20 +139,16 @@
 NTSTATUS ejs_push_winreg_String(struct ejs_rpc *ejs, 
 			     struct MprVar *v, const char *name, const struct winreg_String *r);
 
-#define EJS_ALLOC_SIZE(ejs, s, size) do { \
-  (s) = talloc_size(ejs, size); \
+#define EJS_ALLOC(ejs, s) do { \
+  (s) = talloc_ptrtype(ejs, (s)); \
   if (!(s)) return ejs_panic(ejs, "out of memory"); \
 } while (0)
 
-#define EJS_ALLOC(ejs, s) EJS_ALLOC_SIZE(ejs, s, sizeof(*(s)))
-
-#define EJS_ALLOC_N_SIZE(ejs, s, n, elsize) do { \
-	(s) = talloc_array_size(ejs, elsize, n); \
+#define EJS_ALLOC_N(ejs, s, n) do { \
+	(s) = talloc_array_ptrtype(ejs, (s), n); \
 	if (!(s)) return ejs_panic(ejs, "out of memory"); \
 } while (0)
 
-#define EJS_ALLOC_N(ejs, s, n) EJS_ALLOC_N_SIZE(ejs, s, n, sizeof(*(s)))
-
 /* some types are equivalent for ejs */
 #define ejs_pull_dom_sid2 ejs_pull_dom_sid
 #define ejs_push_dom_sid2 ejs_push_dom_sid



More information about the samba-cvs mailing list