[syslinux:master] com32: single instance of skipspace()

syslinux-bot for Erwan Velu erwanaliasr1 at gmail.com
Sun Feb 20 16:42:26 PST 2011


Commit-ID:  6d0cfd4b044a0e8294d27921cef9a10ce2cbaa7a
Gitweb:     http://syslinux.zytor.com/commit/6d0cfd4b044a0e8294d27921cef9a10ce2cbaa7a
Author:     Erwan Velu <erwanaliasr1 at gmail.com>
AuthorDate: Mon, 7 Feb 2011 23:11:39 +0100
Committer:  Erwan Velu <erwanaliasr1 at gmail.com>
CommitDate: Mon, 7 Feb 2011 23:11:39 +0100

com32: single instance of skipspace()

no need to keep several versions of it.


---
 com32/include/ctype.h    |    7 +++++++
 com32/lib/pci/scan.c     |   10 +---------
 com32/lib/vsscanf.c      |    7 -------
 com32/lua/src/pci.c      |   28 ++++++++++------------------
 com32/menu/readconfig.c  |    9 +--------
 com32/modules/ethersel.c |    9 +--------
 6 files changed, 20 insertions(+), 50 deletions(-)

diff --git a/com32/include/ctype.h b/com32/include/ctype.h
index 28fae9f..7709c03 100644
--- a/com32/include/ctype.h
+++ b/com32/include/ctype.h
@@ -114,4 +114,11 @@ __ctype_inline int tolower(int __c)
     return isupper(__c) ? _tolower(__c) : __c;
 }
 
+__ctype_inline char *skipspace(const char *p)
+{
+   while (isspace((unsigned char)*p))
+            p++;
+   return (char *)p;
+}
+
 #endif /* _CTYPE_H */
diff --git a/com32/lib/pci/scan.c b/com32/lib/pci/scan.c
index 2577b32..c8334b1 100644
--- a/com32/lib/pci/scan.c
+++ b/com32/lib/pci/scan.c
@@ -39,6 +39,7 @@
 #include <sys/pci.h>
 #include <com32.h>
 #include <stdbool.h>
+#include <ctype.h>
 #include <syslinux/zio.h>
 
 #ifdef DEBUG
@@ -49,15 +50,6 @@
 
 #define MAX_LINE 512
 
-/* searching the next char that is not a space */
-static char *skipspace(char *p)
-{
-    while (*p && *p <= ' ')
-	p++;
-
-    return p;
-}
-
 /* removing any \n found in a string */
 static void remove_eol(char *string)
 {
diff --git a/com32/lib/vsscanf.c b/com32/lib/vsscanf.c
index d9fec51..9a462c6 100644
--- a/com32/lib/vsscanf.c
+++ b/com32/lib/vsscanf.c
@@ -47,13 +47,6 @@ enum bail {
     bail_err			/* Conversion mismatch */
 };
 
-static const char *skipspace(const char *p)
-{
-    while (isspace((unsigned char)*p))
-	p++;
-    return p;
-}
-
 int vsscanf(const char *buffer, const char *format, va_list ap)
 {
     const char *p = format;
diff --git a/com32/lua/src/pci.c b/com32/lua/src/pci.c
index b9c1605..c367ba9 100644
--- a/com32/lua/src/pci.c
+++ b/com32/lua/src/pci.c
@@ -1,6 +1,7 @@
 #include <stdbool.h>
 #include <stdlib.h>
 #include <string.h>
+#include <ctype.h>
 
 #define lpcilib_c       /* Define the library */
 
@@ -9,6 +10,15 @@
 #include "lualib.h"
 #include <sys/pci.h>
 
+/* removing any \n found in a string */
+static void remove_eol(char *string)
+{
+    int j = strlen(string);
+    int i = 0;
+    for (i = 0; i < j; i++)
+        if (string[i] == '\n')
+            string[i] = 0;
+}
 
 static int pci_getinfo(lua_State *L)
 {
@@ -59,24 +69,6 @@ static int pci_getinfo(lua_State *L)
   return 1;
 }
 
-/* searching the next char that is not a space */
-static char *skipspace(char *p)
-{
-  while (*p && *p <= ' ')
-    p++;
-
-  return p;
-}
-
-/* removing any \n found in a string */
-static void remove_eol(char *string)
-{
- int j = strlen(string);
- int i = 0;
- for(i = 0; i < j; i++) if(string[i] == '\n') string[i] = 0;
-}
-
-
 /* Try to match any pci device to the appropriate kernel module */
 /* it uses the modules.pcimap from the boot device*/
 static int pci_getidlist(lua_State *L)
diff --git a/com32/menu/readconfig.c b/com32/menu/readconfig.c
index 8c16fda..f3b0f96 100644
--- a/com32/menu/readconfig.c
+++ b/com32/menu/readconfig.c
@@ -15,6 +15,7 @@
 #include <stdbool.h>
 #include <stdlib.h>
 #include <string.h>
+#include <ctype.h>
 #include <minmax.h>
 #include <alloca.h>
 #include <inttypes.h>
@@ -92,14 +93,6 @@ static struct menu *find_menu(const char *label)
 
 #define MAX_LINE 4096
 
-static char *skipspace(char *p)
-{
-    while (*p && my_isspace(*p))
-	p++;
-
-    return p;
-}
-
 /* Strip ^ from a string, returning a new reference to the same refstring
    if none present */
 static const char *strip_caret(const char *str)
diff --git a/com32/modules/ethersel.c b/com32/modules/ethersel.c
index f586e83..5c3cf02 100644
--- a/com32/modules/ethersel.c
+++ b/com32/modules/ethersel.c
@@ -30,6 +30,7 @@
 
 #include <inttypes.h>
 #include <stdio.h>
+#include <ctype.h>
 #include <stdlib.h>
 #include <string.h>
 #include <console.h>
@@ -44,14 +45,6 @@
 # define dprintf(...) ((void)0)
 #endif
 
-static char *skipspace(char *p)
-{
-    while (*p && *p <= ' ')
-	p++;
-
-    return p;
-}
-
 #define MAX_LINE 512
 
 /* Check to see if we are at a certain keyword (case insensitive) */



More information about the Syslinux-commits mailing list