mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-25 14:57:20 +00:00
[common] option: trim whitespace from option names and values
This commit is contained in:
parent
ce9b94e93d
commit
51ca08719e
@ -458,6 +458,9 @@ bool option_load(const char * filename)
|
||||
goto exit;
|
||||
}
|
||||
|
||||
//rtrim
|
||||
while(nameLen > 1 && (name[nameLen-1] == ' ' || name[nameLen-1] == '\t'))
|
||||
--nameLen;
|
||||
name[nameLen] = '\0';
|
||||
expectValue = true;
|
||||
|
||||
@ -480,6 +483,10 @@ bool option_load(const char * filename)
|
||||
}
|
||||
line = false;
|
||||
|
||||
//ltrim
|
||||
if (*len == 0 && (c == ' ' || c == '\t'))
|
||||
break;
|
||||
|
||||
if (*len % 32 == 0)
|
||||
*p = realloc(*p, *len + 32 + 1);
|
||||
(*p)[(*len)++] = c;
|
||||
|
Loading…
Reference in New Issue
Block a user