diff options
| author | Nils Wallménius <nils@rockbox.org> | 2009-02-08 11:09:55 +0000 |
|---|---|---|
| committer | Nils Wallménius <nils@rockbox.org> | 2009-02-08 11:09:55 +0000 |
| commit | 5a55772201829dc0055cc8d3022cc475ccbc2643 (patch) | |
| tree | 65440f5944388c9db3a439df7f37a75e5431709d /apps/misc.c | |
| parent | eda5ed06244abba643e09a775d71542d91691d4d (diff) | |
| download | rockbox-5a55772201829dc0055cc8d3022cc475ccbc2643.zip rockbox-5a55772201829dc0055cc8d3022cc475ccbc2643.tar.gz rockbox-5a55772201829dc0055cc8d3022cc475ccbc2643.tar.bz2 rockbox-5a55772201829dc0055cc8d3022cc475ccbc2643.tar.xz | |
Small code reuse improvement
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19943 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/misc.c')
| -rw-r--r-- | apps/misc.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/apps/misc.c b/apps/misc.c index 1410d47..6e871ac 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) { |