Revision
23645
Author
zarzycki@apple.com
Date
2008-07-28 11:12:23 -0700 (Mon, 28 Jul 2008)

Log Message

Style

Modified Paths

Diff

Modified: trunk/launchd/src/liblaunch.c (23644 => 23645)


--- trunk/launchd/src/liblaunch.c	2008-07-22 15:53:59 UTC (rev 23644)
+++ trunk/launchd/src/liblaunch.c	2008-07-28 18:12:23 UTC (rev 23645)
@@ -356,11 +356,13 @@
 {
 	size_t i;
 
-	if (LAUNCH_DATA_DICTIONARY != dict->type)
+	if (LAUNCH_DATA_DICTIONARY != dict->type) {
 		return;
+	}
 
-	for (i = 0; i < dict->_array_cnt; i += 2)
+	for (i = 0; i < dict->_array_cnt; i += 2) {
 		cb(dict->_array[i + 1], dict->_array[i]->string, context);
+	}
 }
 
 bool
@@ -372,8 +374,10 @@
 		where->_array_cnt = ind + 1;
 	}
 
-	if (where->_array[ind])
+	if (where->_array[ind]) {
 		launch_data_free(where->_array[ind]);
+	}
+
 	where->_array[ind] = what;
 	return true;
 }
@@ -381,11 +385,11 @@
 launch_data_t
 launch_data_array_get_index(launch_data_t where, size_t ind)
 {
-	if (LAUNCH_DATA_ARRAY != where->type)
+	if (LAUNCH_DATA_ARRAY != where->type || ind >= where->_array_cnt) {
 		return NULL;
-	if (ind < where->_array_cnt)
+	} else {
 		return where->_array[ind];
-	return NULL;
+	}
 }
 
 launch_data_t