[gnome-builder] gcc: Fix path extraction from makefile directories
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] gcc: Fix path extraction from makefile directories
- Date: Mon, 15 Feb 2016 21:48:20 +0000 (UTC)
commit 39ddfe40e269ec623659e2a09e98dc924db79e72
Author: Christian Hergert <christian hergert me>
Date: Mon Feb 15 13:47:59 2016 -0800
gcc: Fix path extraction from makefile directories
It looks like we were swallowing the trialing ' when tracking changes in
the current `make' directory. This looks for a suffix when parsing
directory paths and chomps the trailing '.
https://bugzilla.gnome.org/show_bug.cgi?id=761451
plugins/gcc/gbp-gcc-build-result-addin.c | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/plugins/gcc/gbp-gcc-build-result-addin.c b/plugins/gcc/gbp-gcc-build-result-addin.c
index 8f5c342..6bfff92 100644
--- a/plugins/gcc/gbp-gcc-build-result-addin.c
+++ b/plugins/gcc/gbp-gcc-build-result-addin.c
@@ -147,22 +147,26 @@ gbp_gcc_build_result_addin_log (GbpGccBuildResultAddin *self,
g_assert (GBP_IS_GCC_BUILD_RESULT_ADDIN (self));
g_assert (IDE_IS_BUILD_RESULT (result));
+#define ENTERING_DIRECTORY_BEGIN "Entering directory '"
+#define ENTERING_DIRECTORY_END "'\n"
+
/*
* This expects LANG=C, which is defined in the autotools Builder.
* Not the most ideal decoupling of logic, but we don't have a whole
* lot to work with here.
*/
- if ((enterdir = strstr (message, "Entering directory '")))
+ if (NULL != (enterdir = strstr (message, ENTERING_DIRECTORY_BEGIN)) &&
+ g_str_has_suffix (enterdir, ENTERING_DIRECTORY_END))
{
- gsize len;
+ gssize len;
- enterdir += IDE_LITERAL_LENGTH ("Entering directory '");
- len = strlen (enterdir);
+ enterdir += IDE_LITERAL_LENGTH (ENTERING_DIRECTORY_BEGIN);
+ len = strlen (enterdir) - IDE_LITERAL_LENGTH (ENTERING_DIRECTORY_END);
if (len > 0)
{
g_free (self->current_dir);
- self->current_dir = g_strndup (enterdir, len - 1);
+ self->current_dir = g_strndup (enterdir, len);
}
}
@@ -170,7 +174,7 @@ gbp_gcc_build_result_addin_log (GbpGccBuildResultAddin *self,
{
IdeDiagnostic *diagnostic;
- if ((diagnostic = create_diagnostic (self, match_info)))
+ if (NULL != (diagnostic = create_diagnostic (self, match_info)))
{
ide_build_result_emit_diagnostic (result, diagnostic);
ide_diagnostic_unref (diagnostic);
@@ -178,6 +182,9 @@ gbp_gcc_build_result_addin_log (GbpGccBuildResultAddin *self,
}
g_match_info_free (match_info);
+
+#undef ENTERING_DIRECTORY_BEGIN
+#undef ENTERING_DIRECTORY_END
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]