OSSP CVS Repository

ossp - Difference in ossp-pkg/rc/rc_config.c versions 1.7 and 1.8
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/rc/rc_config.c 1.7 -> 1.8

--- rc_config.c  2002/04/08 15:37:10     1.7
+++ rc_config.c  2002/04/09 17:01:54     1.8
@@ -33,9 +33,10 @@
 #include "rc.h"
 #include "rc_private.h"
 #include "rc_const.h"               /* String constants                 */
+#include "rc_config.h"              /* Config types and constants       */
 #include "rc_option.h"              /* Option operations rely on popt   */
 
-static rc_config_t *s_pInst = NULL; /* Singleton configuration instance */
+static rc_config_t *s_pInst = NULL; /* Singleton config instance        */
 
 
 /***************************************
@@ -46,20 +47,20 @@
 {
     ex_t Except;
 
-    if (s_pInst == NULL) {                  /* If we don't have one   */
-        s_pInst = malloc(sizeof(s_pInst));  /* yet, then allocate     */
-        if (!s_pInst)                       /* a configuration        */
-            return(RC_THROW(RC_ERR_MEM));   /* instance               */
-        s_pInst->nLocks = 0;
+    if (s_pInst == NULL) {                  /* If we don't have one     */
+        s_pInst = malloc(sizeof(s_pInst));  /* yet, then allocate       */
+        if (!s_pInst)                       /* a config instance        */
+            return(RC_THROW(RC_ERR_MEM));
+        s_pInst->m_nLocks = 0;
 
         ex_try {
-                                            /* Make a config instance */
+            clioptConstruct();              /* Make a config instance   */
         }
         ex_catch(Except) {
             rethrow;
         }
     }
-    s_pInst->nLocks++;                      /* FIXME not threadsafe */
+    s_pInst->m_nLocks++;                    /* FIXME not threadsafe     */
 
     return(RC_THROW(RC_OK));
 }
@@ -127,16 +128,16 @@
     ex_t Except;
 
     if (s_pInst) {
-        if (!(--s_pInst->nLocks)) {         /* If nLocks is 0, dealloc  */
-            ex_try {                        /* FIXME, not thread-safe   */
-
+        if (--s_pInst->m_nLocks == 0) { /* If m_nLocks is 0, dealloc    */
+            ex_try {                    /* FIXME, not thread-safe       */
+                clioptDestruct();
             }
             ex_catch(Except) {
                 rethrow;
             }
 
-            free(s_pInst);                  /* Deallocate configuration */
-            s_pInst = NULL;                 /* and clear its reference  */
+            free(s_pInst);              /* Deallocate config and        */
+            s_pInst = NULL;             /* clear its reference          */
         }
     }
     else

CVSTrac 2.0.1