svn commit: [26088] trunk/busybox: include libbb modutils networking procps

vda at busybox.net vda at busybox.net
Mon Apr 13 20:52:01 UTC 2009


Author: vda
Date: 2009-04-13 20:52:00 +0000 (Mon, 13 Apr 2009)
New Revision: 26088

Log:
move llist_find_str from modutils to libbb



Modified:
   trunk/busybox/include/libbb.h
   trunk/busybox/libbb/llist.c
   trunk/busybox/modutils/modutils.c
   trunk/busybox/modutils/modutils.h
   trunk/busybox/networking/ifupdown.c
   trunk/busybox/procps/pidof.c


Changeset:
Modified: trunk/busybox/include/libbb.h
===================================================================
--- trunk/busybox/include/libbb.h	2009-04-13 20:32:31 UTC (rev 26087)
+++ trunk/busybox/include/libbb.h	2009-04-13 20:52:00 UTC (rev 26088)
@@ -859,6 +859,7 @@
 void llist_unlink(llist_t **head, llist_t *elm) FAST_FUNC;
 void llist_free(llist_t *elm, void (*freeit)(void *data)) FAST_FUNC;
 llist_t *llist_rev(llist_t *list) FAST_FUNC;
+llist_t *llist_find_str(llist_t *first, const char *str) FAST_FUNC;
 /* BTW, surprisingly, changing API to
  *   llist_t *llist_add_to(llist_t *old_head, void *data)
  * etc does not result in smaller code... */

Modified: trunk/busybox/libbb/llist.c
===================================================================
--- trunk/busybox/libbb/llist.c	2009-04-13 20:32:31 UTC (rev 26087)
+++ trunk/busybox/libbb/llist.c	2009-04-13 20:52:00 UTC (rev 26088)
@@ -86,3 +86,13 @@
 	}
 	return rev;
 }
+
+llist_t* FAST_FUNC llist_find_str(llist_t *list, const char *str)
+{
+	while (list) {
+		if (strcmp(list->data, str) == 0)
+			break;
+		list = list->link;
+	}
+	return list;
+}

Modified: trunk/busybox/modutils/modutils.c
===================================================================
--- trunk/busybox/modutils/modutils.c	2009-04-13 20:32:31 UTC (rev 26087)
+++ trunk/busybox/modutils/modutils.c	2009-04-13 20:52:00 UTC (rev 26088)
@@ -16,19 +16,6 @@
 # define delete_module(mod, flags) syscall(__NR_delete_module, mod, flags)
 #endif
 
-/*
- a libbb candidate from ice age!
-*/
-llist_t FAST_FUNC *llist_find(llist_t *first, const char *str)
-{
-	while (first != NULL) {
-		if (strcmp(first->data, str) == 0)
-			return first;
-		first = first->link;
-	}
-	return NULL;
-}
-
 void FAST_FUNC replace(char *s, char what, char with)
 {
 	while (*s) {

Modified: trunk/busybox/modutils/modutils.h
===================================================================
--- trunk/busybox/modutils/modutils.h	2009-04-13 20:32:31 UTC (rev 26087)
+++ trunk/busybox/modutils/modutils.h	2009-04-13 20:52:00 UTC (rev 26088)
@@ -18,7 +18,6 @@
 #define MODULE_NAME_LEN 256
 
 const char *moderror(int err) FAST_FUNC;
-llist_t *llist_find(llist_t *first, const char *str) FAST_FUNC;
 void replace(char *s, char what, char with) FAST_FUNC;
 char *replace_underscores(char *s) FAST_FUNC;
 int string_to_llist(char *string, llist_t **llist, const char *delim) FAST_FUNC;

Modified: trunk/busybox/networking/ifupdown.c
===================================================================
--- trunk/busybox/networking/ifupdown.c	2009-04-13 20:32:31 UTC (rev 26087)
+++ trunk/busybox/networking/ifupdown.c	2009-04-13 20:52:00 UTC (rev 26088)
@@ -692,20 +692,6 @@
 	return NULL;
 }
 
-static const llist_t *find_list_string(const llist_t *list, const char *string)
-{
-	if (string == NULL)
-		return NULL;
-
-	while (list) {
-		if (strcmp(list->data, string) == 0) {
-			return list;
-		}
-		list = list->link;
-	}
-	return NULL;
-}
-
 static struct interfaces_file_t *read_interfaces(const char *filename)
 {
 	/* Let's try to be compatible.
@@ -836,7 +822,7 @@
 			while ((first_word = next_word(&rest_of_line)) != NULL) {
 
 				/* Check the interface isnt already listed */
-				if (find_list_string(defn->autointerfaces, first_word)) {
+				if (llist_find_str(defn->autointerfaces, first_word)) {
 					bb_perror_msg_and_die("interface declared auto twice \"%s\"", buf);
 				}
 

Modified: trunk/busybox/procps/pidof.c
===================================================================
--- trunk/busybox/procps/pidof.c	2009-04-13 20:32:31 UTC (rev 26087)
+++ trunk/busybox/procps/pidof.c	2009-04-13 20:52:00 UTC (rev 26088)
@@ -35,12 +35,12 @@
 	/* fill omit list.  */
 	{
 		llist_t *omits_p = omits;
-		while (omits_p) {
+		while (1) {
+			omits_p = llist_find_str(omits_p, "%PPID");
+			if (!omits_p)
+				break;
 			/* are we asked to exclude the parent's process ID?  */
-			if (strcmp(omits_p->data, "%PPID") == 0) {
-				omits_p->data = utoa((unsigned)getppid());
-			}
-			omits_p = omits_p->link;
+			omits_p->data = utoa((unsigned)getppid());
 		}
 	}
 #endif



More information about the busybox-cvs mailing list