fragment: skip empty tokens (closes #99)

Due to the way that tokens are merged together for arguments which require explicit whitespace, an
empty token could result in a fragment like:

    {.type = 'I', .data = '/usr/include '}

Such a fragment would be treated differently than:

    {.type = 'I', .data = '/usr/include'}

This difference causes the compiler to include a system include path as part of the additional includes, thus
breaking things like include path shadowing, resulting in random build failures.  As such, we skip empty tokens
from the tokenizer as they do not have any relevance anyway.
pull/100/head
William Pitcock 2016-10-25 13:57:42 -05:00
parent 9a89bd051d
commit ce165646de
1 changed files with 3 additions and 0 deletions

View File

@ -105,6 +105,9 @@ pkgconf_fragment_add(pkgconf_list_t *list, const char *string, unsigned int flag
{ {
pkgconf_fragment_t *frag; pkgconf_fragment_t *frag;
if (*string == '\0')
return;
if (!pkgconf_fragment_is_special(string)) if (!pkgconf_fragment_is_special(string))
{ {
frag = calloc(sizeof(pkgconf_fragment_t), 1); frag = calloc(sizeof(pkgconf_fragment_t), 1);