From 46badf19089668e470e9bb5b2300017f8948b49e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 16 Nov 2004 21:07:08 +0000 Subject: r3790: use a registration function that is called from dcerpc_*_init functions rather then a large table in librpc/gen_ndr/tables.c. This will allow us to only link in only the required gen_ndr files (speeds up linking quite a bit, makes binaries smaller). Each gen_ndr_* file now has a init function that calls the init functions of the interfaces it contains. I did it this way to keep pidl's code simple, though it might hurt startup time a bit. I'd be happy to change it if people like one function better. (This used to be commit 3c436590ae95b58ad6d00e72d6fdd08a4d80f208) --- source4/utils/ndrdump.c | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) (limited to 'source4/utils/ndrdump.c') diff --git a/source4/utils/ndrdump.c b/source4/utils/ndrdump.c index 826f0c6c6e..809e6729cc 100644 --- a/source4/utils/ndrdump.c +++ b/source4/utils/ndrdump.c @@ -21,22 +21,6 @@ #include "includes.h" #include "lib/cmdline/popt_common.h" #include "system/iconv.h" -#include "librpc/gen_ndr/tables.h" - -static const struct dcerpc_interface_table *find_pipe(const char *pipe_name) -{ - int i; - for (i=0;dcerpc_pipes[i];i++) { - if (strcmp(dcerpc_pipes[i]->name, pipe_name) == 0) { - break; - } - } - if (!dcerpc_pipes[i]) { - printf("pipe '%s' not in table\n", pipe_name); - exit(1); - } - return dcerpc_pipes[i]; -} static const struct dcerpc_interface_call *find_function( const struct dcerpc_interface_table *p, @@ -62,14 +46,14 @@ static const struct dcerpc_interface_call *find_function( static void show_pipes(void) { - int i; + struct dcerpc_interface_list *p; printf("\nYou must specify a pipe\n"); printf("known pipes are:\n"); - for (i=0;dcerpc_pipes[i];i++) { - if(dcerpc_pipes[i]->helpstring) { - printf("\t%s - %s\n", dcerpc_pipes[i]->name, dcerpc_pipes[i]->helpstring); + for (p=dcerpc_pipes;p;p=p->next) { + if(p->table->helpstring) { + printf("\t%s - %s\n", p->table->name, p->table->helpstring); } else { - printf("\t%s\n", dcerpc_pipes[i]->name); + printf("\t%s\n", p->table->name); } } exit(1); @@ -109,12 +93,12 @@ static void show_functions(const struct dcerpc_interface_table *p) POPT_TABLEEND }; - ndrdump_init_subsystems; - DEBUGLEVEL = 10; setup_logging("ndrdump", DEBUG_STDOUT); + ndrdump_init_subsystems; + pc = poptGetContext("ndrdump", argc, argv, long_options, 0); poptSetOtherOptionHelp(pc, " "); @@ -130,7 +114,7 @@ static void show_functions(const struct dcerpc_interface_table *p) exit(1); } - p = find_pipe(pipe_name); + p = idl_iface_by_name(pipe_name); function = poptGetArg(pc); inout = poptGetArg(pc); -- cgit