[Pkg-shadow-commits] r3072 - in upstream/trunk: . lib libmisc

Nicolas FRANÇOIS nekral-guest at alioth.debian.org
Tue Sep 8 21:00:12 UTC 2009


Author: nekral-guest
Date: 2009-09-08 21:00:12 +0000 (Tue, 08 Sep 2009)
New Revision: 3072

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/lib/commonio.c
   upstream/trunk/libmisc/cleanup.c
Log:
	* lib/commonio.c: Avoid pre-decrement operator (--n). Add some
	comments.
	* libmisc/cleanup.c: Fix off by one in an assertion.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2009-09-08 20:46:43 UTC (rev 3071)
+++ upstream/trunk/ChangeLog	2009-09-08 21:00:12 UTC (rev 3072)
@@ -1,5 +1,11 @@
 2009-09-08  Nicolas François  <nicolas.francois at centraliens.net>
 
+	* lib/commonio.c: Avoid pre-decrement operator (--n). Add some
+	comments.
+	* libmisc/cleanup.c: Fix off by one in an assertion.
+
+2009-09-08  Nicolas François  <nicolas.francois at centraliens.net>
+
 	* src/su.c: Fix indentation.
 	* src/su.c: Add more messages for translation.
 	* src/su.c: Ignore kill() return value when sending the TERM

Modified: upstream/trunk/lib/commonio.c
===================================================================
--- upstream/trunk/lib/commonio.c	2009-09-08 20:46:43 UTC (rev 3071)
+++ upstream/trunk/lib/commonio.c	2009-09-08 21:00:12 UTC (rev 3072)
@@ -703,13 +703,16 @@
 	}
 	qsort (entries, n, sizeof (struct commonio_entry *), cmp);
 
+	/* Take care of the head and tail separately */
 	db->head = entries[0];
-	db->tail = entries[--n];
+	n--;
+	db->tail = entries[n];
 	db->head->prev = NULL;
 	db->head->next = entries[1];
 	db->tail->prev = entries[n - 1];
 	db->tail->next = NULL;
 
+	/* Now other elements have prev and next entries */
 	for (i = 1; i < n; i++) {
 		entries[i]->prev = entries[i - 1];
 		entries[i]->next = entries[i + 1];

Modified: upstream/trunk/libmisc/cleanup.c
===================================================================
--- upstream/trunk/libmisc/cleanup.c	2009-09-08 20:46:43 UTC (rev 3071)
+++ upstream/trunk/libmisc/cleanup.c	2009-09-08 21:00:12 UTC (rev 3072)
@@ -109,7 +109,8 @@
 	/* Move the rest of the cleanup functions */
 	for (; i<CLEANUP_FUNCTIONS; i++) {
 		/* Make sure the cleanup function was specified only once */
-		assert (cleanup_functions[i+1] != pcf);
+		assert (   (i == (CLEANUP_FUNCTIONS -1))
+		        || (cleanup_functions[i+1] != pcf));
 
 		if (i == (CLEANUP_FUNCTIONS -1)) {
 			cleanup_functions[i] = NULL;




More information about the Pkg-shadow-commits mailing list