Enlightenment CVS committal Author : sebastid Project : e17 Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore_desktop Modified Files: ecore_desktop.c Log Message: Use isspace() to check for whitespace. Add missing return statement. =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_desktop/ecore_desktop.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -3 -r1.39 -r1.40 --- ecore_desktop.c 23 Sep 2006 08:05:23 -0000 1.39 +++ ecore_desktop.c 23 Sep 2006 08:06:52 -0000 1.40 @@ -51,7 +51,7 @@ Ecore_Hash *current = NULL; result = ecore_hash_new(ecore_str_hash, ecore_str_compare); - if (!result) NULL; + if (!result) return NULL; f = fopen(file, "r"); if (!f) @@ -74,12 +74,9 @@ c = buffer; /* Strip preceeding blanks. */ - while (((*c == ' ') || (*c == '\t')) && (*c != '\n') - && (*c != '\0')) - c++; + while ((*c != '\0') && (isspace(*c))) c++; /* Skip blank lines and comments */ - if ((*c == '\0') || (*c == '\n') || (*c == '#')) - continue; + if ((*c == '\0') || (*c == '\n') || (*c == '#')) continue; if (*c == '[') /* New group. */ { key = c + 1; @@ -103,31 +100,24 @@ key = c; /* Find trailing blanks or =. */ - while ((*c != '=') && (*c != ' ') && (*c != '\t') - && (*c != '\n') && (*c != '\0')) - c++; + while ((*c != '\0') && (*c != '=') && (!isspace(*c))) c++; if (*c != '=') /* Find equals. */ { *c++ = '\0'; - while ((*c != '=') && (*c != '\n') && (*c != '\0')) - c++; + while ((*c != '\0') && (*c != '=')) c++; } if (*c == '=') /* Equals found. */ { *c++ = '\0'; /* Strip preceeding blanks. */ - while (((*c == ' ') || (*c == '\t')) && (*c != '\n') - && (*c != '\0')) - c++; + while ((*c != '\0') && (isspace(*c))) c++; value = c; /* Find end. */ - while ((*c != '\n') && (*c != '\0')) - c++; + while ((*c != '\0') && (!isspace(*c))) c++; *c++ = '\0'; /* FIXME: should strip space at end, then unescape value. */ tv = ecore_hash_remove(current, key); - if (tv) - free(tv); + if (tv) free(tv); if (value[0] != '\0') ecore_hash_set(current, strdup(key), strdup(value)); #ifdef DEBUG ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs