summaryrefslogtreecommitdiff
path: root/parse.c
diff options
context:
space:
mode:
authorDan Nicholson <dbn.lists@gmail.com>2010-05-27 22:23:19 +0200
committerTollef Fog Heen <tfheen@err.no>2010-05-27 22:23:19 +0200
commit6a27c57057df8c05815b4816aea78b41ae57336e (patch)
tree67ae7d3d01b18c894433c5fde375782350f718c9 /parse.c
parentd9077956e29b47bc4eabd4a77294f5b50248e757 (diff)
downloadpkg-config-6a27c57057df8c05815b4816aea78b41ae57336e.tar.gz
Handle empty valued fields with newer external popt
The bundled popt handled the case of Cflags or Libs with no value, but newer popt linked through --with-installed-popt chokes parsing it into a vector. This is arguably a popt bug in poptParseArgvString, but I guess they expect you not to ask it to split an empty string.
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c52
1 files changed, 31 insertions, 21 deletions
diff --git a/parse.c b/parse.c
index 918b4f1..48f6f2b 100644
--- a/parse.c
+++ b/parse.c
@@ -742,7 +742,7 @@ parse_libs (Package *pkg, const char *str, const char *path)
char *trimmed;
char **argv = NULL;
- int argc;
+ int argc = 0;
int result;
if (pkg->libs_num > 0)
@@ -754,15 +754,19 @@ parse_libs (Package *pkg, const char *str, const char *path)
trimmed = trim_and_sub (pkg, str, path);
- result = poptParseArgvString (trimmed, &argc, &argv);
-
- if (result < 0)
+ if (trimmed && *trimmed)
{
- verbose_error ("Couldn't parse Libs field into an argument vector: %s\n",
- poptStrerror (result));
+ result = poptParseArgvString (trimmed, &argc, &argv);
- exit (1);
+ if (result < 0)
+ {
+ verbose_error ("Couldn't parse Libs field into an argument vector: %s\n",
+ poptStrerror (result));
+
+ exit (1);
+ }
}
+
_do_parse_libs(pkg, argc, argv);
g_free (trimmed);
@@ -787,7 +791,7 @@ parse_libs_private (Package *pkg, const char *str, const char *path)
char *trimmed;
char **argv = NULL;
- int argc;
+ int argc = 0;
int result;
if (pkg->libs_private_num > 0)
@@ -799,14 +803,17 @@ parse_libs_private (Package *pkg, const char *str, const char *path)
trimmed = trim_and_sub (pkg, str, path);
- result = poptParseArgvString (trimmed, &argc, &argv);
-
- if (result < 0)
+ if (trimmed && *trimmed)
{
- verbose_error ("Couldn't parse Libs.private field into an argument vector: %s\n",
- poptStrerror (result));
+ result = poptParseArgvString (trimmed, &argc, &argv);
- exit (1);
+ if (result < 0)
+ {
+ verbose_error ("Couldn't parse Libs.private field into an argument vector: %s\n",
+ poptStrerror (result));
+
+ exit (1);
+ }
}
_do_parse_libs(pkg, argc, argv);
@@ -824,7 +831,7 @@ parse_cflags (Package *pkg, const char *str, const char *path)
char *trimmed;
char **argv = NULL;
- int argc;
+ int argc = 0;
int result;
int i;
@@ -837,14 +844,17 @@ parse_cflags (Package *pkg, const char *str, const char *path)
trimmed = trim_and_sub (pkg, str, path);
- result = poptParseArgvString (trimmed, &argc, &argv);
-
- if (result < 0)
+ if (trimmed && *trimmed)
{
- verbose_error ("Couldn't parse Cflags field into an argument vector: %s\n",
- poptStrerror (result));
+ result = poptParseArgvString (trimmed, &argc, &argv);
- exit (1);
+ if (result < 0)
+ {
+ verbose_error ("Couldn't parse Cflags field into an argument vector: %s\n",
+ poptStrerror (result));
+
+ exit (1);
+ }
}
i = 0;