[Midnightbsd-cvs] src: plist.c: Updated the error handling in mport_parse_plist_file().

ctriv at midnightbsd.org ctriv at midnightbsd.org
Wed Sep 26 23:26:39 EDT 2007


Log Message:
-----------
Updated the error handling in mport_parse_plist_file().

Modified Files:
--------------
    src/lib/libmport:
        plist.c (r1.1 -> r1.2)

-------------- next part --------------
Index: plist.c
===================================================================
RCS file: /home/cvs/src/lib/libmport/plist.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -Llib/libmport/plist.c -Llib/libmport/plist.c -u -r1.1 -r1.2
--- lib/libmport/plist.c
+++ lib/libmport/plist.c
@@ -83,8 +83,7 @@
          wack the last char in the string. */
       length++;
       if ((line = realloc(line, length)) == NULL) {
-        /* warn: out of mem */
-        return 1;
+        return MPORT_ERR_NO_MEM;
       }
     }
     
@@ -99,8 +98,7 @@
     mportPlistEntry *entry = (mportPlistEntry *)malloc(sizeof(mportPlistEntry));
     
     if (entry == NULL) {
-      // warn: out of mem!
-      return 1;
+      return MPORT_ERR_NO_MEM;
     }
        
     if (*line == CMND_MAGIC_COOKIE) {
@@ -108,8 +106,7 @@
       char *cmnd = strsep(&line, " \t");
       
       if (cmnd == NULL) {
-        // warn: malformed plist
-        return 1;
+        return MPORT_ERR_MALFORMED_PLIST;
       }   
 
       entry->type = parse_command(cmnd);      
@@ -134,8 +131,7 @@
       
       entry->data = (char  *)malloc(strlen(line) + 1);
       if (entry->data == NULL) {
-        /* warn: out of mem */
-        return 1;
+        return MPORT_ERR_NO_MEM;
       }
       
       strlcpy(entry->data, line, (strlen(line) + 1));
@@ -144,7 +140,7 @@
     STAILQ_INSERT_TAIL(list, entry, next);
   }
 
-  return 0;  
+  return MPORT_OK;  
 }
 
      


More information about the Midnightbsd-cvs mailing list