On 23/10/06, Thomas Anders <[EMAIL PROTECTED]> wrote:
I'd suggest to rename init_mib() to netsnmp_init_mib() and only use this one
throughout our code, so it'll always use the correct function.

Dave has promised to post a provisional patch shortly. Assumed it works as
described, please vote whether this change should go into 5.4.

See attached.

The main question in my mind was whether to reuse the (existing)
NETSNMP_CLEAN_NAMESPACE token, or define a new one specifically
for this situation.  I chose to re-use the existing token, but would be
happy to change this.

Dave
Index: include/net-snmp/library/mib.h
===================================================================
RCS file: /cvsroot/net-snmp/net-snmp/include/net-snmp/library/mib.h,v
retrieving revision 5.12
diff -u -u -r5.12 mib.h
--- include/net-snmp/library/mib.h	15 Sep 2006 00:48:47 -0000	5.12
+++ include/net-snmp/library/mib.h	23 Oct 2006 21:46:18 -0000
@@ -118,7 +118,10 @@
     void            netsnmp_set_mib_directory(const char *dir);
     char            *netsnmp_get_mib_directory(void);
     void            netsnmp_fixup_mib_directory(void);
+    void            netsnmp_init_mib(void);
+#ifndef NETSNMP_CLEAN_NAMESPACE
     void            init_mib(void);
+#endif
     void            shutdown_mib(void);
     void            print_description(oid *, size_t, int);
     void            fprint_description(FILE *, oid *, size_t, int);
Index: include/net-snmp/library/parse.h
===================================================================
RCS file: /cvsroot/net-snmp/net-snmp/include/net-snmp/library/parse.h,v
retrieving revision 5.8
diff -u -u -r5.8 parse.h
--- include/net-snmp/library/parse.h	7 Sep 2006 11:30:12 -0000	5.8
+++ include/net-snmp/library/parse.h	23 Oct 2006 21:46:18 -0000
@@ -218,9 +218,10 @@
     int             netsnmp_unload_module(const char *name);
 #ifndef NETSNMP_CLEAN_NAMESPACE
     int             unload_module(const char *name);
+    void            init_mib_internals(void);
 #endif
+    void            netsnmp_init_mib_internals(void);
     void            unload_all_mibs(void);
-    void            init_mib_internals(void);
     int             add_mibfile(const char*, const char*, FILE *);
     int             add_mibdir(const char *);
     void            add_module_replacement(const char *, const char *,
Index: snmplib/mib.c
===================================================================
RCS file: /cvsroot/net-snmp/net-snmp/snmplib/mib.c,v
retrieving revision 5.102
diff -u -u -r5.102 mib.c
--- snmplib/mib.c	15 Sep 2006 00:48:48 -0000	5.102
+++ snmplib/mib.c	23 Oct 2006 21:46:19 -0000
@@ -2521,7 +2521,7 @@
  * Reads in all settings from the environment.
  */
 void
-init_mib(void)
+netsnmp_init_mib(void)
 {
     const char     *prefix;
     char           *env_var, *entry;
@@ -2530,7 +2530,7 @@
 
     if (Mib)
         return;
-    init_mib_internals();
+    netsnmp_init_mib_internals();
 
     /*
      * Initialise the MIB directory/ies 
@@ -2561,7 +2561,7 @@
         }
     }
 
-    init_mib_internals();
+    netsnmp_init_mib_internals();
 
     /*
      * Read in any modules or mibs requested 
@@ -2698,6 +2698,15 @@
     }
 }
 
+#ifndef NETSNMP_CLEAN_NAMESPACE
+void
+init_mib(void)
+{
+    netsnmp_init_mib();
+}
+#endif
+
+
 /**
  * Unloads all mibs.
  */
@@ -5489,7 +5498,7 @@
     int             count;
     netsnmp_variable_list variable;
 
-    init_mib();
+    netsnmp_init_mib();
     if (argc < 2)
         print_subtree(stdout, tree_head, 0);
     variable.type = ASN_INTEGER;
Index: snmplib/parse.c
===================================================================
RCS file: /cvsroot/net-snmp/net-snmp/snmplib/parse.c,v
retrieving revision 5.41
diff -u -u -r5.41 parse.c
--- snmplib/parse.c	15 Sep 2006 00:48:48 -0000	5.41
+++ snmplib/parse.c	23 Oct 2006 21:46:19 -0000
@@ -682,7 +682,7 @@
 }
 
 void
-init_mib_internals(void)
+netsnmp_init_mib_internals(void)
 {
     register struct tok *tp;
     register int    b, i;
@@ -723,6 +723,14 @@
      */
 }
 
+#ifndef NETSNMP_CLEAN_NAMESPACE
+void
+init_mib_internals(void)
+{
+    netsnmp_init_mib_internals();
+}
+#endif
+
 static void
 init_node_hash(struct node *nodes)
 {
@@ -3789,7 +3797,7 @@
     FILE           *fp;
     struct node    *np;
 
-    init_mib_internals();
+    netsnmp_init_mib_internals();
 
     for (mp = module_head; mp; mp = mp->next)
         if (!label_compare(mp->name, name)) {
@@ -4843,7 +4851,7 @@
     struct tree    *tp;
     netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_WARNINGS, 2);
 
-    init_mib();
+    netsnmp_init_mib();
 
     if (argc == 1)
         (void) read_all_mibs();
Index: snmplib/snmp_api.c
===================================================================
RCS file: /cvsroot/net-snmp/net-snmp/snmplib/snmp_api.c,v
retrieving revision 5.115
diff -u -u -r5.115 snmp_api.c
--- snmplib/snmp_api.c	19 Oct 2006 15:47:11 -0000	5.115
+++ snmplib/snmp_api.c	23 Oct 2006 21:46:20 -0000
@@ -633,7 +633,7 @@
 
     snmp_res_init();            /* initialize the mt locking structures */
 #ifndef NETSNMP_DISABLE_MIB_LOADING
-    init_mib_internals();
+    netsnmp_init_mib_internals();
 #endif /* NETSNMP_DISABLE_MIB_LOADING */
     netsnmp_tdomain_init();
 
@@ -851,7 +851,7 @@
 
     read_premib_configs();
 #ifndef NETSNMP_DISABLE_MIB_LOADING
-    init_mib();
+    netsnmp_init_mib();
 #endif /* NETSNMP_DISABLE_MIB_LOADING */
 
     read_configs();
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to