diff options
author | Andrew Bartlett <abartlet@samba.org> | 2010-10-27 15:19:05 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2010-10-27 04:42:06 +0000 |
commit | d9b7123cb7dd4ed04f266aa48c35e70569ae258e (patch) | |
tree | c5760918470e434e9b27ec60442566205697727a /librpc/ndr | |
parent | cf310a4306b3a4b6b9201d01c5d6dbbe5ff8f09e (diff) | |
download | samba-d9b7123cb7dd4ed04f266aa48c35e70569ae258e.tar.gz samba-d9b7123cb7dd4ed04f266aa48c35e70569ae258e.tar.bz2 samba-d9b7123cb7dd4ed04f266aa48c35e70569ae258e.zip |
librpc Make ndrdump use printf() rather than having to mess with DEBUG()
This means it no longer needs to force the debug level etc.
(this builds on the fine work by Volker to create dump_data_cb())
Andrew Bartlett
Diffstat (limited to 'librpc/ndr')
-rw-r--r-- | librpc/ndr/libndr.h | 1 | ||||
-rw-r--r-- | librpc/ndr/ndr.c | 19 |
2 files changed, 20 insertions, 0 deletions
diff --git a/librpc/ndr/libndr.h b/librpc/ndr/libndr.h index 6bc96cada6..06cc93a891 100644 --- a/librpc/ndr/libndr.h +++ b/librpc/ndr/libndr.h @@ -406,6 +406,7 @@ struct ndr_push *ndr_push_init_ctx(TALLOC_CTX *mem_ctx); DATA_BLOB ndr_push_blob(struct ndr_push *ndr); enum ndr_err_code ndr_push_expand(struct ndr_push *ndr, uint32_t extra_size); void ndr_print_debug_helper(struct ndr_print *ndr, const char *format, ...) PRINTF_ATTRIBUTE(2,3); +void ndr_print_printf_helper(struct ndr_print *ndr, const char *format, ...) PRINTF_ATTRIBUTE(2,3); void ndr_print_string_helper(struct ndr_print *ndr, const char *format, ...) PRINTF_ATTRIBUTE(2,3); void ndr_print_debug(ndr_print_fn_t fn, const char *name, void *ptr); void ndr_print_union_debug(ndr_print_fn_t fn, const char *name, uint32_t level, void *ptr); diff --git a/librpc/ndr/ndr.c b/librpc/ndr/ndr.c index 3f553a7cbc..0e16a43525 100644 --- a/librpc/ndr/ndr.c +++ b/librpc/ndr/ndr.c @@ -190,6 +190,25 @@ _PUBLIC_ void ndr_print_debug_helper(struct ndr_print *ndr, const char *format, free(s); } +_PUBLIC_ void ndr_print_printf_helper(struct ndr_print *ndr, const char *format, ...) +{ + va_list ap; + int i; + + if (!ndr->no_newline) { + for (i=0;i<ndr->depth;i++) { + printf(" "); + } + } + + va_start(ap, format); + vprintf(format, ap); + va_end(ap); + if (!ndr->no_newline) { + printf("\n"); + } +} + _PUBLIC_ void ndr_print_string_helper(struct ndr_print *ndr, const char *format, ...) { va_list ap; |