OSSP CVS Repository

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

ossp-pkg/rc/rc_config.c 1.2 -> 1.3

--- rc_config.c  2002/02/13 19:19:28     1.2
+++ rc_config.c  2002/02/28 15:30:04     1.3
@@ -38,20 +38,20 @@
 
 
 /***************************************
-* configInit(rc_config_t)              *
-* Initialize a configuration           *
+* configConstruct(rc_config_t)         *
+* Construct a configuration            *
 ***************************************/
-rc_return_t configInit(rc_config_t **ppConfig)
+rc_return_t configConstruct(rc_config_t **ppConfig)
 {
     ex_t Except;
 
-    *ppConfig = malloc(sizeof(rc_config_t));
-    if (!*ppConfig)
-        return(RC_THROW(RC_ERR_MEM));
-
-    ex_try {
-        val_create(&(*ppConfig)->pVal);
-    }
+    *ppConfig = malloc(sizeof(rc_config_t));    /* Allocate the    */
+    if (!*ppConfig)                             /* configuration's */
+        return(RC_THROW(RC_ERR_MEM));           /* identity        */
+
+    ex_try {                                    /* Make a val instance  */
+        val_create(&(*ppConfig)->pVal);         /* to hold individual   */
+    }                                           /* configuration values */
     ex_catch(Except) {
         rethrow;
     }
@@ -60,20 +60,20 @@
 }
 
 /************************************************
-* configFill(rc_config_t, int, char **)         *
-* Fill a configuration                          *
+* configLoad(rc_config_t, int, char **)         *
+* Load a configuration                          *
 ************************************************/
-rc_return_t configFill(rc_config_t *pConfig, int argc, char *argv[])
+rc_return_t configLoad(rc_config_t *pConfig, int argc, char *argv[])
 {
     ex_t Except;
     char *pTestopt = NULL;
     const char *pFuncpath = "/sfw/etc/rc.func";
 
-    ex_try {
+    ex_try {    /* Register and set configuration values */
         val_reg(pConfig->pVal, RC_FNC_NAME, VAL_TYPE_PTR, RC_FNC_DESC, NULL);
         val_set(pConfig->pVal, RC_FNC_NAME, pFuncpath);
         val_get(pConfig->pVal, RC_FNC_NAME, &pTestopt);
-        fprintf(stderr, "%s\n", pTestopt);
+        fprintf(stderr, "Hier!%s!\n", pTestopt);
     }
     ex_catch(Except) {
         rethrow;
@@ -91,14 +91,14 @@
     ex_t Except;
 
     assert(pConfig);
-    free(pConfig);
+    free(pConfig);      /* Deallocate configuration */
+    pConfig = NULL;     /* and clear its reference  */
 
     ex_try {
-        val_destroy(pConfig->pVal);
-    }
+        val_destroy(pConfig->pVal); /* Destroy the val instance and assume */
+    }                               /* that its reference is cleared also  */
     ex_catch(Except) {
         rethrow;
-        return(RC_THROW(RC_ERR_INT));
     }
 
     return(RC_THROW(RC_OK));

CVSTrac 2.0.1