forked from len0rd/rockbox
Small code reuse improvement
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19943 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
eda5ed0624
commit
5a55772201
5 changed files with 17 additions and 30 deletions
16
apps/misc.c
16
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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue