diff options
author | Dan Nicholson <dbn.lists@gmail.com> | 2013-05-31 05:48:01 -0700 |
---|---|---|
committer | Dan Nicholson <dbn.lists@gmail.com> | 2013-05-31 05:53:47 -0700 |
commit | f26a505826acec6b1e1af8d1efdf959913421c3a (patch) | |
tree | e8666b316aeb9c1d85ee36c15f71a8ff904ae51a | |
parent | dbf1b7cd093562b282c51ce89b8c5c978783153b (diff) |
Strip trailing space from --cflags/--libs output
pkg-config leaves a trailing space on the flags output as it may have to
do multiple iterations to collect all output and adding the space makes
concatenation simple. However, this leaves a trailing space on the full
returned string unless it's empty. Strip the trailing space after all
the processing is complete.
-rw-r--r-- | pkg.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -989,6 +989,10 @@ packages_get_flags (GList *pkgs, FlagType flags) g_free (cur); } + /* Strip trailing space. */ + if (str->len > 0 && str->str[str->len - 1] == ' ') + g_string_truncate (str, str->len - 1); + debug_spew ("returning flags string \"%s\"\n", str->str); return g_string_free (str, FALSE); } |