src/server/daemon/configmanager.c

changeset 31
280250e45ba6
parent 25
5dee29c7c530
child 36
450d2d5f4735
--- a/src/server/daemon/configmanager.c	Thu May 24 12:51:52 2012 +0200
+++ b/src/server/daemon/configmanager.c	Fri May 25 18:16:24 2012 +0200
@@ -55,31 +55,23 @@
 
 int cfgmgr_load_config() {
     int cfgreload = 0;
-    /* check config files */
-    for(int i=0;i<config_files->size;i++) {
-        UcxMapElement *elm = &config_files->map[i];
-        while(elm != NULL) {
-            /*check file */
-            ConfigFile *f = elm->data;
+    
+    /* check config files */  
+    UcxMapIterator iter = ucx_map_iterator(config_files);
+    UCX_MAP_FOREACH(ConfigFile*, f, config_files, iter) {
+        struct stat s;
+        if(stat(f->file.ptr, &s) != 0) {
+            fprintf(
+                    stderr,
+                    "Error: Cannot get stat of file %s\n", f->file.ptr);
+            perror("cfgmgr_load_config: stat");
+            return -1;
+        }
 
-            if(f != NULL) {
-                struct stat s;
-                if(stat(f->file.ptr, &s) != 0) {
-                    fprintf(
-                            stderr,
-                            "Error: Cannot get stat of file %s\n", f->file.ptr);
-                    perror("cfgmgr_load_config: stat");
-                    return -1;
-                }
-
-                if(f->last_modified != s.st_mtim.tv_sec) {
-                    /* reload the file */
-                    f->reload(f, current_config);
-                    cfgreload = 1;
-                }
-            }
-
-            elm = elm->next;
+        if(f->last_modified != s.st_mtim.tv_sec) {
+            /* reload the file */
+            f->reload(f, current_config);
+            cfgreload = 1;
         }
     }
 

mercurial