From f26a505826acec6b1e1af8d1efdf959913421c3a Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Fri, 31 May 2013 05:48:01 -0700 Subject: [PATCH] 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. --- pkg.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg.c b/pkg.c index f9ab34a..66cd515 100644 --- a/pkg.c +++ b/pkg.c @@ -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); }