[anjuta] Fix check if the executable is part of the debug configuration



commit 78bc6bf236f9236a5ec548c1b226f289343815ae
Author: Sébastien Granjoux <seb sfo free fr>
Date:   Sun Oct 18 15:31:18 2009 +0200

    Fix check if the executable is part of the debug configuration

 plugins/build-basic-autotools/configuration-list.c |    6 ++++++
 plugins/build-basic-autotools/plugin.c             |   14 ++++++++++----
 plugins/debug-manager/start.c                      |    2 +-
 3 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/plugins/build-basic-autotools/configuration-list.c b/plugins/build-basic-autotools/configuration-list.c
index 599f096..56c95db 100644
--- a/plugins/build-basic-autotools/configuration-list.c
+++ b/plugins/build-basic-autotools/configuration-list.c
@@ -58,6 +58,12 @@ struct  _DefaultBuildConfiguration
 	gchar *args;
 };
 
+/* The name value is kept untranslated for saving in the session file or
+ * used as an id but a translated value is needed for displaying it.
+ * Some predefined names are defined using contants named
+ * IANJUTA_BUILDER_CONFIGURATION_*. They cannot be used in the name
+ * field as we need a translated value, so they are used in build
+ * directory instead */
 const DefaultBuildConfiguration default_config[] = {
 	{N_("Default"), NULL, "--enable-maintainer-mode"},
 	{N_("Debug"), IANJUTA_BUILDER_CONFIGURATION_DEBUG, "--enable-maintainer-mode 'CFLAGS=-g -O0' 'CXXFLAGS=-g -O0' 'JFLAGS=-g -O0' 'FFLAGS=-g -O0'"},
diff --git a/plugins/build-basic-autotools/plugin.c b/plugins/build-basic-autotools/plugin.c
index 470f86c..23ee9a4 100644
--- a/plugins/build-basic-autotools/plugin.c
+++ b/plugins/build-basic-autotools/plugin.c
@@ -2090,18 +2090,24 @@ static const gchar*
 build_get_uri_configuration (BasicAutotoolsPlugin *plugin, const gchar *uri)
 {
 	BuildConfiguration *cfg;
-	
+	BuildConfiguration *uri_cfg;
+	gsize uri_len = 0;
+
+	/* Check all configurations as other configuration directories are
+	 * normally child of default configuration directory */	
 	for (cfg = build_configuration_list_get_first (plugin->configurations); cfg != NULL; cfg = build_configuration_next (cfg))
 	{
 		const gchar *root = build_configuration_list_get_build_uri  (plugin->configurations, cfg);
+		gsize len = strlen (root);
 
-		if (strncmp (uri, root, strlen (root)) == 0)
+		if ((len > uri_len) && (strncmp (uri, root, len) == 0))
 		{
-			return build_configuration_get_name (cfg);
+			uri_cfg = cfg;
+			uri_len = len;
 		}
 	}
 
-	return NULL;
+	return uri_len == 0 ? NULL : build_configuration_get_name (uri_cfg);
 }
 
 
diff --git a/plugins/debug-manager/start.c b/plugins/debug-manager/start.c
index 82d0cd1..8a80c37 100644
--- a/plugins/debug-manager/start.c
+++ b/plugins/debug-manager/start.c
@@ -1059,7 +1059,7 @@ check_target (DmaStart *this, const gchar *target)
 		found = g_list_find_custom(cfg_list, IANJUTA_BUILDER_CONFIGURATION_DEBUG, (GCompareFunc)strcmp);
 		if (found != NULL)
 		{
-			if (ianjuta_builder_get_uri_configuration (builder, target, NULL) != (const gchar *)found)
+			if (ianjuta_builder_get_uri_configuration (builder, target, NULL) != found->data)
 			{
 				if (!show_check_debug_dialog (this)) return FALSE;
 			}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]