[anjuta] symbol-db: fixed bgo#605343 - fix build warnings



commit 79b58d6a0b00dfeb6a2318994ebacbdeeb2d614b
Author: Maxim Ermilov <zaspire rambler ru>
Date:   Thu Dec 24 20:54:44 2009 +0100

    symbol-db: fixed bgo#605343 - fix build warnings

 plugins/symbol-db/anjuta-tags/gir.c                |   38 ++++++++-----------
 .../symbol-db/anjuta-tags/js_parser/js-context.c   |    5 ++-
 plugins/symbol-db/anjuta-tags/js_parser/js-node.c  |    2 +
 plugins/symbol-db/anjuta-tags/jscript.c            |   35 ++++++------------
 4 files changed, 34 insertions(+), 46 deletions(-)
---
diff --git a/plugins/symbol-db/anjuta-tags/gir.c b/plugins/symbol-db/anjuta-tags/gir.c
index 569556c..6997675 100644
--- a/plugins/symbol-db/anjuta-tags/gir.c
+++ b/plugins/symbol-db/anjuta-tags/gir.c
@@ -14,11 +14,11 @@
 #include <libxml/tree.h>
 
 static kindOption Kinds [] = {
-	{ TRUE,  'f', "function",	  "functions"		   },
-	{ TRUE,  'c', "class",		  "classes"			   },
-	{ TRUE,  'm', "method",		  "methods"			   },
-	{ TRUE,  'p', "property",	  "properties"		   },
-	{ TRUE,  'v', "variable",	  "global variables"   }
+	{ TRUE,  'f', "function",	  "functions"},
+	{ TRUE,  'c', "class",		  "classes"},
+	{ TRUE,  'm', "method",		  "methods"},
+	{ TRUE,  'p', "property",	  "properties"},
+	{ TRUE,  'v', "variable",	  "global variables"}
 };
 
 static void
@@ -51,7 +51,7 @@ parse_function (xmlNode *node, const gchar *parent)
 
 	name = (gchar*)xmlGetProp (node, (xmlChar*)"name");
 	if (!name)
-		return NULL;
+		return;
 
 	tag = (tagEntryInfo*)malloc (sizeof (tagEntryInfo));
 	initTagEntry (tag, name);
@@ -104,7 +104,7 @@ parse_function (xmlNode *node, const gchar *parent)
 	makeTagEntry (tag);
 }
 
-static void makeTags (const xmlNode *node, const gchar *parent);
+static void makeTags (xmlNode *node, const gchar *parent);
 
 static void
 parse_class (xmlNode *node)
@@ -116,11 +116,11 @@ parse_class (xmlNode *node)
 
 	name = (gchar*)xmlGetProp (node, (const xmlChar*)"name");
 	if (!name)
-		return NULL;
+		return;
 
 	tagEntryInfo *tag = (tagEntryInfo*)malloc (sizeof (tagEntryInfo));
 	initTagEntry (tag, name);
-	tag->isFileScope	= 1;
+	tag->isFileScope = 1;
 	tag->kindName = "class";
 	tag->kind = 'c';
 	get_file_pos (node->line, &tag->filePosition, File.fp);
@@ -134,10 +134,8 @@ parse_class (xmlNode *node)
 }
 
 static void
-makeTags (const xmlNode *node, const gchar *parent)
+makeTags (xmlNode *node, const gchar *parent)
 {
-	xmlNode *i;
-	
 	g_assert (node != NULL);
 	g_assert (node->name != NULL);
 
@@ -186,15 +184,13 @@ makeTags (const xmlNode *node, const gchar *parent)
 		makeTagEntry (tag);
 		return;
 	}
-	puts ((const gchar*)node->name);
+//	puts ((const gchar*)node->name);
 //	g_assert_not_reached ();
 }
 
-static boolean
-findTags (const unsigned int passCount)
+static void
+findTags (void)
 {
-	assert (passCount == 1);
-
 	xmlNode *i;
 	xmlDocPtr doc = xmlParseFile(getInputFileName());
 	xmlNode *root;
@@ -215,8 +211,6 @@ findTags (const unsigned int passCount)
 			makeTags (j, NULL);
 		}
 	}
-
-	return 1;
 }
 
 extern parserDefinition*
@@ -226,9 +220,9 @@ GirParser (void)
 	parserDefinition *const def = parserNew ("GObject-Introspection");
 	def->extensions = extensions;
 
-	def->kinds		= Kinds;
-	def->kindCount	= KIND_COUNT (Kinds);
-	def->parser		= findTags;
+	def->kinds = Kinds;
+	def->kindCount = KIND_COUNT (Kinds);
+	def->parser = findTags;
 	def->initialize = initialize;
 
 	return def;
diff --git a/plugins/symbol-db/anjuta-tags/js_parser/js-context.c b/plugins/symbol-db/anjuta-tags/js_parser/js-context.c
index 39c447e..796a891 100644
--- a/plugins/symbol-db/anjuta-tags/js_parser/js-context.c
+++ b/plugins/symbol-db/anjuta-tags/js_parser/js-context.c
@@ -103,7 +103,8 @@ js_context_get_last_assignment (JSContext *my_cx, const gchar *name)
 			continue;
 		if (g_strcmp0 (t->name, name) != 0)
 			continue;
-		g_object_ref (t->node);
+		if (t->node)
+			g_object_ref (t->node);
 		return t->node;
 	}
 	for (i = g_list_last (my_cx->childs); i; i = g_list_previous (i))
@@ -442,6 +443,8 @@ interpretator (JSNode *node, JSContext *my_cx, GList **calls)
 					case TOK_ASSIGN:
 					///NOT COMPLETE
 						{
+							if (!node->pn_u.binary.left)
+								break;
 							const gchar *name = js_node_get_name (node->pn_u.binary.left);
 							Var *t = (Var *)g_new (Var, 1);
 							t->name = g_strdup (name);
diff --git a/plugins/symbol-db/anjuta-tags/js_parser/js-node.c b/plugins/symbol-db/anjuta-tags/js_parser/js-node.c
index ce2411b..7c995da 100644
--- a/plugins/symbol-db/anjuta-tags/js_parser/js-node.c
+++ b/plugins/symbol-db/anjuta-tags/js_parser/js-node.c
@@ -114,6 +114,8 @@ js_node_get_name (JSNode *node)
 			return node->pn_u.name.name;
 			break;
 		case TOK_DOT:
+			if (!node->pn_u.name.expr || !node->pn_u.name.name)
+				return NULL;
 			return g_strdup_printf ("%s.%s", js_node_get_name (node->pn_u.name.expr), js_node_get_name (node->pn_u.name.name));
 			break;
 		default:
diff --git a/plugins/symbol-db/anjuta-tags/jscript.c b/plugins/symbol-db/anjuta-tags/jscript.c
index 55ef5ae..f9eda46 100755
--- a/plugins/symbol-db/anjuta-tags/jscript.c
+++ b/plugins/symbol-db/anjuta-tags/jscript.c
@@ -128,7 +128,7 @@ get_member_list (JSContext *my_cx)
 						symbols = g_list_append (symbols, g_strdup (name));
 						
 						initTagEntry (tag, name);
-						tag->isFileScope	= 1;
+						tag->isFileScope = 1;
 						tag->kindName = "member";
 						tag->kind = 'm';
 						get_file_pos (pos->begin, &tag->filePosition, File.fp);
@@ -175,26 +175,18 @@ get_member_list (JSContext *my_cx)
 
 }
 
-typedef enum {
-	JSTAG_FUNCTION,
-	JSTAG_CLASS,
-	JSTAG_METHOD,
-	JSTAG_PROPERTY,
-	JSTAG_VARIABLE,
-	JSTAG_COUNT
-} jsKind;
-
 static kindOption JsKinds [] = {
-	{ TRUE,  'f', "function",	  "functions"		   },
-	{ TRUE,  'c', "class",		  "classes"			   },
-	{ TRUE,  'm', "method",		  "methods"			   },
-	{ TRUE,  'p', "property",	  "properties"		   },
-	{ TRUE,  'v', "variable",	  "global variables"   }
+	{ TRUE,  'f', "function",	  "functions"},
+	{ TRUE,  'c', "class",		  "classes"},
+	{ TRUE,  'm', "method",		  "methods"},
+	{ TRUE,  'p', "property",	  "properties"},
+	{ TRUE,  'v', "variable",	  "global variables"}
 };
 
 static void
 initialize (const langType language)
 {
+g_log_set_always_fatal(G_LOG_LEVEL_CRITICAL);
 	g_type_init ();
 }
 
@@ -299,10 +291,9 @@ findGlobal (JSContext *my_cx)
 	}
 }
 
-static boolean
-findJsTags (const unsigned int passCount)
+static void
+findJsTags (void)
 {
-	assert (passCount == 1);
 	g_assert (symbols == NULL);
 	g_assert (tags == NULL);
 
@@ -326,8 +317,6 @@ findJsTags (const unsigned int passCount)
 
 	g_list_free (tags);
 	tags = NULL;
-
-	return 1;
 }
 
 extern parserDefinition*
@@ -337,9 +326,9 @@ JavaScriptParser (void)
 	parserDefinition *const def = parserNew ("JavaScript");
 	def->extensions = extensions;
 
-	def->kinds		= JsKinds;
-	def->kindCount	= KIND_COUNT (JsKinds);
-	def->parser		= findJsTags;
+	def->kinds = JsKinds;
+	def->kindCount = KIND_COUNT (JsKinds);
+	def->parser = findJsTags;
 	def->initialize = initialize;
 
 	return def;



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