[syslinux] my_isspace can be isblank

Ram Yalamanchili ramyinc at gmail.com
Thu Mar 15 16:33:09 PDT 2007


Hey,

I noticed my_isspace() is being used in menu/mainmenu and readconfig
com32 modules.

Why not use isblank() instead? Here's a patch:

thanks.
Ram

--- com32/modules/menu.h
//depot/opensource/main/syslinux-3/com32/modules/menu.h#2
+++ com32/modules/menu.h  07-03-15 16:27:14
@@ -87,11 +87,6 @@
 void parse_configs(char **argv);
 extern int (*draw_background)(const char *filename);

-static inline int my_isspace(char c)
-{
-  return (unsigned char)c <= ' ';
-}
-
 int menu_main(int argc, char *argv[]);
 void console_prepare(void);
 void console_cleanup(void);
--- com32/modules/menumain.c
//depot/opensource/main/syslinux-3/com32/modules/menumain.c#2
+++ com32/modules/menumain.c  07-03-15 16:26:57
@@ -30,6 +30,7 @@
 #include <sha1.h>
 #include <base64.h>
 #include <colortbl.h>
+#include <ctype.h>
 #ifdef __COM32__
 #include <com32.h>
 #endif
@@ -483,10 +484,10 @@
       if ( cursor ) {
 	int prevcursor = cursor;

-	while ( cursor && my_isspace(cmdline[cursor-1]) )
+	while ( cursor && isblank(cmdline[cursor-1]) )
 	  cursor--;

-	while ( cursor && !my_isspace(cmdline[cursor-1]) )
+	while ( cursor && !isblank(cmdline[cursor-1]) )
 	  cursor--;

 	memmove(cmdline+cursor, cmdline+prevcursor, len-prevcursor+1);
@@ -806,13 +807,13 @@

   kernel = q;
   p = cmdline;
-  while ( *p && !my_isspace(*p) ) {
+  while ( *p && !isblank(*p) ) {
     *q++ = *p++;
   }
   *q++ = '\0';

   args = q;
-  while ( *p && my_isspace(*p) )
+  while ( *p && isblank(*p) )
     p++;

   strcpy(q, p);
--- com32/modules/readconfig.c
//depot/opensource/main/syslinux-3/com32/modules/readconfig.c#3
+++ com32/modules/readconfig.c  07-03-15 16:31:07
@@ -18,6 +18,7 @@
 #include <alloca.h>
 #include <inttypes.h>
 #include <colortbl.h>
+#include <ctype.h>
 #ifdef __COM32__
 # include <com32.h>
 #endif
@@ -110,7 +111,7 @@
 static char *
 skipspace(char *p)
 {
-  while (*p && my_isspace(*p))
+  while (*p && isblank(*p))
     p++;

   return p;
@@ -132,7 +133,7 @@
   if ( *q )
     return NULL;		/* Didn't see the keyword */

-  return my_isspace(*p) ? p : NULL; /* Must be EOL or whitespace */
+  return isblank(*p) ? p : NULL; /* Must be EOL or whitespace */
 }

 struct labeldata {
@@ -236,7 +237,7 @@
   int i, pos;

   p = str;
-  while ( *p && !my_isspace(*p) )
+  while ( *p && !isblank(*p) )
     p++;

   /* p now points to the first byte beyond the kernel name */
@@ -283,7 +284,7 @@
   char *dp;
   size_t len;

-  while (*ep && !my_isspace(*ep))
+  while (*ep && !isblank(*ep))
     ep++;

   *p = ep;




More information about the Syslinux mailing list