From 5a55772201829dc0055cc8d3022cc475ccbc2643 Mon Sep 17 00:00:00 2001 From: Nils Wallménius Date: Sun, 8 Feb 2009 11:09:55 +0000 Subject: Small code reuse improvement git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19943 a1c6a512-1295-4272-9138-f99709370657 --- apps/misc.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'apps/misc.c') diff --git a/apps/misc.c b/apps/misc.c index 1410d47244..6e871acd3b 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -605,8 +605,7 @@ bool settings_parseline(char* line, char** name, char** value) { char* ptr; - while ( isspace(*line) ) - line++; + line = skip_whitespace(line); if ( *line == '#' ) return false; @@ -618,8 +617,7 @@ bool settings_parseline(char* line, char** name, char** value) *name = line; *ptr = 0; ptr++; - while (isspace(*ptr)) - ptr++; + ptr = skip_whitespace(ptr); *value = ptr; return true; } @@ -1123,6 +1121,16 @@ char* strrsplt(char* str, int c) return s; } +char* skip_whitespace(char* const str) +{ + char *s = str; + + while (isspace(*s)) + s++; + + return s; +} + /* Test file existence, using dircache of possible */ bool file_exists(const char *file) { -- cgit v1.2.3