libpkgconf: strip trailing whitespace

feature/tap-sh
William Pitcock 2017-01-26 13:10:52 -06:00
parent 8b043a10ce
commit ef1503b769
1 changed files with 8 additions and 1 deletions

View File

@ -266,7 +266,8 @@ pkgconf_pkg_new_from_file(const pkgconf_client_t *client, const char *filename,
if (!isalpha((unsigned int)*key) && !isdigit((unsigned int)*p)) if (!isalpha((unsigned int)*key) && !isdigit((unsigned int)*p))
continue; continue;
while (*p && isspace((unsigned int)*p)) { while (*p && isspace((unsigned int)*p))
{
/* set to null to avoid trailing spaces in key */ /* set to null to avoid trailing spaces in key */
*p = '\0'; *p = '\0';
p++; p++;
@ -280,6 +281,12 @@ pkgconf_pkg_new_from_file(const pkgconf_client_t *client, const char *filename,
p++; p++;
value = p; value = p;
p = value + (strlen(value) - 1);
while (*p && isspace((unsigned int) *p) && p > value)
{
*p = '\0';
p--;
}
switch (op) switch (op)
{ {