g_return_val_if_fail (str != NULL, NULL);
- while (*str && isspace (*str))
+ while (*str && isspace ((guchar)*str))
str++;
len = strlen (str);
- while (len > 0 && isspace (str[len-1]))
+ while (len > 0 && isspace ((guchar)str[len-1]))
len--;
return g_strndup (str, len);
}
-#define MODULE_SEPARATOR(c) ((c) == ',' || isspace ((c)))
+#define MODULE_SEPARATOR(c) ((c) == ',' || isspace ((guchar)(c)))
#define OPERATOR_CHAR(c) ((c) == '<' || (c) == '>' || (c) == '!' || (c) == '=')
/* A module list is a list of modules with optional version specification,
break;
case IN_MODULE_NAME:
- if (isspace (*p))
+ if (isspace ((guchar)*p))
{
/* Need to look ahead to determine next state */
const char *s = p;
- while (*s && isspace (*s))
+ while (*s && isspace ((guchar)*s))
++s;
if (*s == '\0')
/* We know an operator is coming up here due to lookahead from
* IN_MODULE_NAME
*/
- if (isspace (*p))
+ if (isspace ((guchar)*p))
; /* no change */
else if (OPERATOR_CHAR (*p))
state = IN_OPERATOR;
break;
case AFTER_OPERATOR:
- if (!isspace (*p))
+ if (!isspace ((guchar)*p))
state = IN_MODULE_VERSION;
break;
start = p;
- while (*p && !isspace (*p))
+ while (*p && !isspace ((guchar)*p))
++p;
while (*p && MODULE_SEPARATOR (*p))
start = p;
- while (*p && !isspace (*p))
+ while (*p && !isspace ((guchar)*p))
++p;
- while (*p && isspace (*p))
+ while (*p && isspace ((guchar)*p))
{
*p = '\0';
++p;
char *libname;
p += 2;
- while (*p && isspace (*p))
+ while (*p && isspace ((guchar)*p))
++p;
start = p;
- while (*p && !isspace (*p))
+ while (*p && !isspace ((guchar)*p))
++p;
libname = g_strndup (start, p - start);
char *libname;
p += 2;
- while (*p && isspace (*p))
+ while (*p && isspace ((guchar)*p))
++p;
start = p;
- while (*p && !isspace (*p))
+ while (*p && !isspace ((guchar)*p))
++p;
libname = g_strndup (start, p - start);
char *libname;
p += 2;
- while (*p && isspace (*p))
+ while (*p && isspace ((guchar)*p))
++p;
start = p;
- while (*p && !isspace (*p))
+ while (*p && !isspace ((guchar)*p))
++p;
libname = g_strndup (start, p - start);
tag = g_strndup (str, p - str);
- while (*p && isspace (*p))
+ while (*p && isspace ((guchar)*p))
++p;
if (*p == ':')
{
/* keyword */
++p;
- while (*p && isspace (*p))
+ while (*p && isspace ((guchar)*p))
++p;
if (strcmp (tag, "Name") == 0)
char *varval;
++p;
- while (*p && isspace (*p))
+ while (*p && isspace ((guchar)*p))
++p;
if (pkg->vars == NULL)
p = output;
- while (*p && isspace (*p))
+ while (*p && isspace ((guchar)*p))
++p;
if (*p == '\0')
}
/* only heuristic; find a number or . */
- while (*p && ! (isdigit (*p) || *p == '.'))
+ while (*p && ! (isdigit ((guchar)*p) || *p == '.'))
++p;
pkg->version = g_strdup (p);
p = output;
- while (*p && isspace (*p))
+ while (*p && isspace ((guchar)*p))
++p;
if (*p == '\0')
}
/* only heuristic; find a number or . */
- while (*p && ! (isdigit (*p) || *p == '.'))
+ while (*p && ! (isdigit ((guchar)*p) || *p == '.'))
++p;
pkg->version = g_strdup (p);
*/
p = output;
- while (*p && isspace (*p))
+ while (*p && isspace ((guchar)*p))
++p;
if (*p == '\0')
}
/* only heuristic; find a number or . */
- while (*p && ! (isdigit (*p) || *p == '.'))
+ while (*p && ! (isdigit ((guchar)*p) || *p == '.'))
++p;
pkg->version = g_strdup (p);
GSList *iter;
GSList *requires_iter;
GSList *conflicts_iter;
-
+ int count;
+
/* Be sure we have the required fields */
if (pkg->key == NULL)
g_slist_free (requires);
g_slist_free (conflicts);
+ count = 0;
iter = pkg->I_cflags;
while (iter != NULL)
{
{
verbose_error ("Package %s has -I/usr/include in Cflags; this may cause problems and is not recommended\n",
pkg->name);
+ if (g_getenv ("PKG_CONFIG_ALLOW_SYSTEM_CFLAGS") == NULL)
+ {
+ iter->data = NULL;
+ ++count;
+ debug_spew ("Removing -I/usr/include from cflags for %s\n", pkg->key);
+ }
+ }
+
+ iter = iter->next;
+ }
+
+ while (count)
+ {
+ pkg->I_cflags = g_slist_remove (pkg->I_cflags, NULL);
+ --count;
+ }
+
+ count = 0;
+ iter = pkg->L_libs;
+ while (iter != NULL)
+ {
+ if (strcmp (iter->data, "-L/usr/lib") == 0 ||
+ strcmp (iter->data, "-L /usr/lib") == 0)
+ {
+ verbose_error ("Package %s has -L/usr/lib in Libs; this may cause problems and is not recommended\n",
+ pkg->name);
+ if (g_getenv ("PKG_CONFIG_ALLOW_SYSTEM_LIBS") == NULL)
+ {
+ iter->data = NULL;
+ ++count;
+ debug_spew ("Removing -I/usr/lib from libs for %s\n", pkg->key);
+ }
}
iter = iter->next;
}
+
+ while (count)
+ {
+ pkg->L_libs = g_slist_remove (pkg->L_libs, NULL);
+ --count;
+ }
}
static char*
/* loop through each version segment of str1 and str2 and compare them */
while (*one && *two) {
- while (*one && !isalnum(*one)) one++;
- while (*two && !isalnum(*two)) two++;
+ while (*one && !isalnum((guchar)*one)) one++;
+ while (*two && !isalnum((guchar)*two)) two++;
str1 = one;
str2 = two;
/* grab first completely alpha or completely numeric segment */
/* leave one and two pointing to the start of the alpha or numeric */
/* segment and walk str1 and str2 to end of segment */
- if (isdigit(*str1)) {
- while (*str1 && isdigit(*str1)) str1++;
- while (*str2 && isdigit(*str2)) str2++;
+ if (isdigit((guchar)*str1)) {
+ while (*str1 && isdigit((guchar)*str1)) str1++;
+ while (*str2 && isdigit((guchar)*str2)) str2++;
isnum = 1;
} else {
- while (*str1 && isalpha(*str1)) str1++;
- while (*str2 && isalpha(*str2)) str2++;
+ while (*str1 && isalpha((guchar)*str1)) str1++;
+ while (*str2 && isalpha((guchar)*str2)) str2++;
isnum = 0;
}