r26580: Include sentinel in build.h, in case the list is empty.
authorJelmer Vernooij <jelmer@samba.org>
Mon, 24 Dec 2007 07:28:22 +0000 (01:28 -0600)
committerStefan Metzmacher <metze@samba.org>
Mon, 24 Dec 2007 07:51:07 +0000 (01:51 -0600)
(This used to be commit f1997dabed584bdc864c4b7235c29603c312ef46)

17 files changed:
source4/auth/auth.c
source4/auth/gensec/gensec.c
source4/build/smb_build/config_mk.pm
source4/build/smb_build/header.pm
source4/build/smb_build/input.pm
source4/lib/events/events.c
source4/lib/ldb/common/ldb_modules.c
source4/ntptr/ntptr_base.c
source4/ntvfs/ntvfs_base.c
source4/ntvfs/sysdep/sys_notify.c
source4/param/share.c
source4/rpc_server/service_rpc.c
source4/scripting/ejs/smbcalls.c
source4/scripting/python/config.mk
source4/smbd/process_model.c
source4/smbd/server.c
source4/torture/torture.c

index 4bfc92e8f9de350a39e325762035440b8dcba8dd..ed590f2ced520b974e9de772940de055bc882924 100644 (file)
@@ -516,7 +516,7 @@ NTSTATUS auth_init(void)
 {
        static bool initialized = false;
 
-       init_module_fn static_init[] = { STATIC_auth_MODULES, NULL };
+       init_module_fn static_init[] = { STATIC_auth_MODULES };
        
        if (initialized) return NT_STATUS_OK;
        initialized = true;
index 6f7ff91db6c6636fe5ecebfb1fc65493e80b1d37..cd2066d9fd5f93044fa92e68497a9794350410f0 100644 (file)
@@ -1268,7 +1268,7 @@ NTSTATUS gensec_init(struct loadparm_context *lp_ctx)
 {
        static bool initialized = false;
 
-       init_module_fn static_init[] = { STATIC_gensec_MODULES, NULL };
+       init_module_fn static_init[] = { STATIC_gensec_MODULES };
        init_module_fn *shared_init;
 
        if (initialized) return NT_STATUS_OK;
index 4f231c035659b8e6e1ec2ad540de484efd9e5c34..7ad6600a8c4510053d215830dc49734c462612ed 100644 (file)
@@ -44,7 +44,8 @@ my $section_types = {
 
                "CFLAGS"                => "list",
                "LDFLAGS"               => "list",
-               "STANDARD_VISIBILITY"   => "string"
+               "STANDARD_VISIBILITY"   => "string",
+               "INIT_FUNCTION_SENTINEL" => "string"
                },
        "MODULE" => {
                "SUBSYSTEM"             => "string",
@@ -88,6 +89,7 @@ my $section_types = {
                "LIBRARY_REALNAME" => "string",
                
                "INIT_FUNCTION_TYPE"    => "string",
+               "INIT_FUNCTION_SENTINEL" => "string",
                "OUTPUT_TYPE"           => "list",
 
                "OBJ_FILES"             => "list",
index b0dced48975d38e3179495530c1131d79d63db77..b52464922b995ccc3a8ce37971a18464f979368d 100644 (file)
@@ -44,13 +44,12 @@ sub _prepare_build_h($)
                        $DEFINE->{VAL} .= "\t$_, \\\n";
                        unless (/{/) {
                                my $fn = $key->{INIT_FUNCTION_TYPE};
-                               unless(defined($fn)) { $fn = "NTSTATUS (*) (void)"; }
                                $fn =~ s/\(\*\)/$_/;
                                $output .= "$fn;\n";
                        }
                }
 
-               $DEFINE->{VAL} =~ s/, \\\n$//g; # Remove the last comma
+               $DEFINE->{VAL} .= "\t$key->{INIT_FUNCTION_SENTINEL} \n";
 
                push(@defines,$DEFINE);
        }
index ae37a7602bcc54227247afb74687c8d072ca66d6..6d5c4f4a1ed5fbdb610802467d19d112a75416f9 100644 (file)
@@ -63,6 +63,10 @@ sub check_subsystem($$$)
        unless(defined($subsys->{OUTPUT_TYPE})) {
                $subsys->{OUTPUT_TYPE} = $default_ot;
        }
+
+       unless (defined($subsys->{INIT_FUNCTION_TYPE})) { $subsys->{INIT_FUNCTION_TYPE} = "NTSTATUS (*) (void)"; }
+       unless (defined($subsys->{INIT_FUNCTION_SENTINEL})) { $subsys->{INIT_FUNCTION_SENTINEL} = "NULL"; }
+
        add_libreplace($subsys);
 }
 
@@ -136,9 +140,9 @@ sub check_library($$$)
                return;
        }
 
-       unless (defined($lib->{INIT_FUNCTION_TYPE})) {
-               $lib->{INIT_FUNCTION_TYPE} = "NTSTATUS (*) (void)";
-       }
+       unless (defined($lib->{INIT_FUNCTION_TYPE})) { $lib->{INIT_FUNCTION_TYPE} = "NTSTATUS (*) (void)"; }
+
+       unless (defined($lib->{INIT_FUNCTION_SENTINEL})) { $lib->{INIT_FUNCTION_SENTINEL} = "NULL"; }
 
        unless(defined($lib->{INSTALLDIR})) {
                $lib->{INSTALLDIR} = "LIBDIR";
index db7c3a5066a3a1e4ef80da7dbc1389eb48b85ecc..245be14326461cd921726942ba7a2d8e079d52b4 100644 (file)
@@ -102,7 +102,7 @@ void event_set_default_backend(const char *backend)
 static void event_backend_init(void)
 {
 #if _SAMBA_BUILD_
-       init_module_fn static_init[] = { STATIC_LIBEVENTS_MODULES, NULL };
+       init_module_fn static_init[] = { STATIC_LIBEVENTS_MODULES };
        init_module_fn *shared_init;
        if (event_backends) return;
        shared_init = load_samba_modules(NULL, global_loadparm, "events");
index 4e70b177bc50532b5614fa469d7b18dc1e07ac1c..18070bdb8633ba10f253871992196292739fd003 100644 (file)
@@ -160,12 +160,13 @@ static const struct ldb_module_ops *ldb_find_module_ops(const char *name)
        ldb_rdn_name_init,      \
        ldb_paged_results_init, \
        ldb_sort_init,          \
-       ldb_asq_init
+       ldb_asq_init, \
+       NULL
 #endif
 
 int ldb_global_init(void)
 {
-       int (*static_init_fns[])(void) = { STATIC_LIBLDB_MODULES, NULL };
+       int (*static_init_fns[])(void) = { STATIC_LIBLDB_MODULES };
 
        static int initialized = 0;
        int ret = 0, i;
index 275f2045248c95b960353255d49bb3994db440bc..26e192d64bee7529802df974da0814f233601be6 100644 (file)
@@ -71,7 +71,7 @@ NTSTATUS ntptr_register(const void *_ops)
 
 NTSTATUS ntptr_init(struct loadparm_context *lp_ctx)
 {
-       init_module_fn static_init[] = { STATIC_ntptr_MODULES, NULL };
+       init_module_fn static_init[] = { STATIC_ntptr_MODULES };
        init_module_fn *shared_init = load_samba_modules(NULL, lp_ctx, "ntptr");
 
        run_init_functions(static_init);
index d4ae6c8b4fcfbf706f48532cfb6cad7c0b45010c..f5a24f23a030ed9d66f590e3eb554007115c88cf 100644 (file)
@@ -202,7 +202,7 @@ NTSTATUS ntvfs_init_connection(TALLOC_CTX *mem_ctx, struct share_config *scfg, e
 NTSTATUS ntvfs_init(struct loadparm_context *lp_ctx)
 {
        static bool initialized = false;
-       init_module_fn static_init[] = { STATIC_ntvfs_MODULES, NULL };
+       init_module_fn static_init[] = { STATIC_ntvfs_MODULES };
        init_module_fn *shared_init;
 
        if (initialized) return NT_STATUS_OK;
index a6d0a698bcb7094a58c806095b434f238f7e71f1..2ed9908af7c4d23cd7aae754d748b3b1c330c797 100644 (file)
@@ -125,7 +125,7 @@ _PUBLIC_ NTSTATUS sys_notify_init(void)
 {
        static bool initialized = false;
 
-       init_module_fn static_init[] = { STATIC_sys_notify_MODULES, NULL };
+       init_module_fn static_init[] = { STATIC_sys_notify_MODULES };
        init_module_fn *shared_init;
 
        if (initialized) return NT_STATUS_OK;
index edbb68b5f01a54966db599e348e4f88ceb3a8516..2c97625bccd9c6c9dc4d008cd4d01a59bed97057 100644 (file)
@@ -146,7 +146,7 @@ NTSTATUS share_get_context_by_name(TALLOC_CTX *mem_ctx, const char *backend_name
 */
 NTSTATUS share_init(void)
 {
-       init_module_fn static_init[] = { STATIC_share_MODULES, NULL };
+       init_module_fn static_init[] = { STATIC_share_MODULES };
 
        run_init_functions(static_init);
 
index 0483736912f81937449a01b0868158289db83442..46b869ad7123b38bfa69f52e2c1dc67d15d04cfc 100644 (file)
@@ -467,7 +467,7 @@ static NTSTATUS dcesrv_init(struct event_context *event_context,
 
 NTSTATUS server_service_rpc_init(void)
 {
-       init_module_fn static_init[] = { STATIC_dcerpc_server_MODULES, NULL };
+       init_module_fn static_init[] = { STATIC_dcerpc_server_MODULES };
        init_module_fn *shared_init = load_samba_modules(NULL, global_loadparm, "dcerpc_server");
 
        run_init_functions(static_init);
index da13f1f6ef60d208d928f3adf22f50a95f432879..1f29fce00249e6bd1e18c32a052a6198c5c3837a 100644 (file)
@@ -173,7 +173,7 @@ _PUBLIC_ void ejs_exception(const char *reason)
 */
 void smb_setup_ejs_functions(void (*exception_handler)(const char *))
 {
-       init_module_fn static_init[] = { STATIC_smbcalls_MODULES, NULL };
+       init_module_fn static_init[] = { STATIC_smbcalls_MODULES };
        init_module_fn *shared_init;
 
        ejs_exception_handler = exception_handler;
index 601e43290639a21e710af7f70acf6fa416c1f817..226f9637dbdaafbbfae17e11668c51900afe0edf 100644 (file)
@@ -4,6 +4,7 @@ OBJ_FILES = smbpython.o
 
 [SUBSYSTEM::LIBPYTHON]
 PUBLIC_DEPENDENCIES = EXT_LIB_PYTHON
+INIT_FUNCTION_SENTINEL = { NULL, NULL }
 OBJ_FILES = modules.o
 
 [PYTHON::python_uuid]
index dc3ede613c22f93250895a69cc28c6717cd06640..8939637c3fd00b817654ec59459772d132bb359b 100644 (file)
@@ -82,7 +82,7 @@ _PUBLIC_ NTSTATUS register_process_model(const void *_ops)
 
 NTSTATUS process_model_init(struct loadparm_context *lp_ctx)
 {
-       init_module_fn static_init[] = { STATIC_process_model_MODULES, NULL };
+       init_module_fn static_init[] = { STATIC_process_model_MODULES };
        init_module_fn *shared_init = load_samba_modules(NULL, lp_ctx, "process_model");
 
        run_init_functions(static_init);
index 78892b6760bca2067da843881713362ece402f6f..c256eed96cde60383e4332fdfaac9a89a9abc4cd 100644 (file)
@@ -187,7 +187,7 @@ static int binary_smbd_main(const char *binary_name, int argc, const char *argv[
        bool opt_interactive = false;
        int opt;
        poptContext pc;
-       init_module_fn static_init[] = { STATIC_service_MODULES, NULL };
+       init_module_fn static_init[] = { STATIC_service_MODULES };
        init_module_fn *shared_init;
        struct event_context *event_ctx;
        NTSTATUS status;
index 6bce38363e7a34c35e8be0d4d0fc6c2f36c16f1c..b471135ce119a4b476f8799fd324c5e38d91f352 100644 (file)
@@ -64,7 +64,7 @@ struct torture_context *torture_context_init(TALLOC_CTX *mem_ctx,
 
 int torture_init(void)
 {
-       init_module_fn static_init[] = { STATIC_torture_MODULES, NULL };
+       init_module_fn static_init[] = { STATIC_torture_MODULES };
        init_module_fn *shared_init = load_samba_modules(NULL, cmdline_lp_ctx, "torture");
 
        run_init_functions(static_init);