mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-22 13:52:57 +00:00
[common] options: fix build on windows (no strndup)
This commit is contained in:
parent
07bcc54732
commit
9d66a68403
1 changed files with 7 additions and 2 deletions
|
@ -357,7 +357,9 @@ bool option_parse(int argc, char * argv[])
|
|||
while (valueLen > 1 && isspace(v[valueLen-1]))
|
||||
--valueLen;
|
||||
|
||||
value = strndup(v, valueLen);
|
||||
value = malloc(valueLen + 1);
|
||||
memcpy(value, v, valueLen);
|
||||
value[valueLen] = '\0';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -389,7 +391,10 @@ bool option_parse(int argc, char * argv[])
|
|||
while (valueLen > 1 && isspace(value[valueLen-1]))
|
||||
--valueLen;
|
||||
|
||||
value = strndup(value, valueLen);
|
||||
char * v = malloc(valueLen + 1);
|
||||
memcpy(v, value, valueLen);
|
||||
v[valueLen] = '\0';
|
||||
value = v;
|
||||
}
|
||||
|
||||
free(arg);
|
||||
|
|
Loading…
Reference in a new issue