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

nekral-guest at alioth.debian.org nekral-guest at alioth.debian.org
Fri Jun 13 21:39:24 UTC 2008


Author: nekral-guest
Date: 2008-06-13 21:39:24 +0000 (Fri, 13 Jun 2008)
New Revision: 2170

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/lib/groupio.c
Log:
	* lib/groupio.c: Add brackets.
	* lib/groupio.c: Make sure malloc receives a size_t.
	* lib/groupio.c: Avoid multi-statements lines.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2008-06-13 21:36:41 UTC (rev 2169)
+++ upstream/trunk/ChangeLog	2008-06-13 21:39:24 UTC (rev 2170)
@@ -1,5 +1,11 @@
 2008-06-13  Nicolas François  <nicolas.francois at centraliens.net>
 
+	* lib/groupio.c: Add brackets.
+	* lib/groupio.c: Make sure malloc receives a size_t.
+	* lib/groupio.c: Avoid multi-statements lines.
+
+2008-06-13  Nicolas François  <nicolas.francois at centraliens.net>
+
 	* lib/sgetspent.c: Use SHADOW_SP_FLAG_UNSET for the initial
 	value of spwd.sp_flag.
 

Modified: upstream/trunk/lib/groupio.c
===================================================================
--- upstream/trunk/lib/groupio.c	2008-06-13 21:36:41 UTC (rev 2169)
+++ upstream/trunk/lib/groupio.c	2008-06-13 21:39:24 UTC (rev 2170)
@@ -91,8 +91,9 @@
 {
 	unsigned int max_members = getdef_unum("MAX_MEMBERS_PER_GROUP", 0);
 
-	if (0 == max_members)
+	if (0 == max_members) {
 		return 1;
+	}
 
 	return split_groups (max_members);
 }
@@ -211,20 +212,23 @@
 {
 	gid_t u1, u2;
 
-	if ((*(struct commonio_entry **) p1)->eptr == NULL)
+	if ((*(struct commonio_entry **) p1)->eptr == NULL) {
 		return 1;
-	if ((*(struct commonio_entry **) p2)->eptr == NULL)
+	}
+	if ((*(struct commonio_entry **) p2)->eptr == NULL) {
 		return -1;
+	}
 
 	u1 = ((struct group *) (*(struct commonio_entry **) p1)->eptr)->gr_gid;
 	u2 = ((struct group *) (*(struct commonio_entry **) p2)->eptr)->gr_gid;
 
-	if (u1 < u2)
+	if (u1 < u2) {
 		return -1;
-	else if (u1 > u2)
+	} else if (u1 > u2) {
 		return 1;
-	else
+	} else {
 		return 0;
+	}
 }
 
 /* Sort entries by GID */
@@ -238,8 +242,9 @@
 	unsigned int max_members = getdef_unum("MAX_MEMBERS_PER_GROUP", 0);
 	struct commonio_entry *gr1, *gr2;
 
-	if (0 == max_members)
+	if (0 == max_members) {
 		return 1;
+	}
 
 	for (gr1 = group_db.head; gr1; gr1 = gr1->next) {
 		for (gr2 = gr1->next; gr2; gr2 = gr2->next) {
@@ -257,8 +262,9 @@
 				if (NULL == gr1)
 					return 0;
 				/* Unlink gr2 */
-				if (NULL != gr2->next)
+				if (NULL != gr2->next) {
 					gr2->next->prev = gr2->prev;
+				}
 				gr2->prev->next = gr2->next;
 			}
 		}
@@ -285,9 +291,9 @@
 	struct group *gptr1;
 	struct group *gptr2;
 	char **new_members;
-	int members = 0;
+	size_t members = 0;
 	char *new_line;
-	int new_line_len, i;
+	size_t new_line_len, i;
 	if (NULL == gr2 || NULL == gr1) {
 		errno = EINVAL;
 		return NULL;
@@ -316,30 +322,35 @@
 	for (i=0; NULL != gptr2->gr_mem[i]; i++) {
 		char **pmember = gptr1->gr_mem;
 		while (NULL != *pmember) {
-			if (0 == strcmp(*pmember, gptr2->gr_mem[i]))
+			if (0 == strcmp(*pmember, gptr2->gr_mem[i])) {
 				break;
+			}
 			pmember++;
 		}
-		if (NULL == *pmember)
+		if (NULL == *pmember) {
 			members++;
+		}
 	}
 	new_members = (char **)malloc ( (members+1) * sizeof(char*) );
 	if (NULL == new_members) {
 		errno = ENOMEM;
 		return NULL;
 	}
-	for (i=0; NULL != gptr1->gr_mem[i]; i++)
+	for (i=0; NULL != gptr1->gr_mem[i]; i++) {
 		new_members[i] = gptr1->gr_mem[i];
+	}
 	members = i;
 	for (i=0; NULL != gptr2->gr_mem[i]; i++) {
 		char **pmember = new_members;
 		while (NULL != *pmember) {
-			if (0 == strcmp(*pmember, gptr2->gr_mem[i]))
+			if (0 == strcmp(*pmember, gptr2->gr_mem[i])) {
 				break;
+			}
 			pmember++;
 		}
 		if (NULL == *pmember) {
-			new_members[members++] = gptr2->gr_mem[i];
+			new_members[members] = gptr2->gr_mem[i];
+			members++;
 			new_members[members] = NULL;
 		}
 	}




More information about the Pkg-shadow-commits mailing list