[gnumeric] Func: always keep our own copy of the function name.



commit f40e1714a2b3f9036ab39f4d56694429e2cafc69
Author: Morten Welinder <terra gnome org>
Date:   Thu Jan 10 20:34:31 2013 -0500

    Func: always keep our own copy of the function name.

 ChangeLog  |    1 +
 src/func.c |   10 +++++-----
 src/func.h |    1 -
 3 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d0891c5..cd194b6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@
 	is what all callers should have used).  All callers changed.
 	(gnm_func_add_placeholder): Ditto.
 	(invent_name): Downcase the preferred name.
+	(gnm_func_add_placeholder_full): Eliminate GNM_FUNC_FREE_NAME.
 
 	* src/gnm-plugin.c (plugin_service_function_group_activate):
 	Upgrade existing placeholder functions as needed.
diff --git a/src/func.c b/src/func.c
index dad248c..47b8ad1 100644
--- a/src/func.c
+++ b/src/func.c
@@ -1017,8 +1017,8 @@ gnm_func_free (GnmFunc *func)
 
 	if (func->fn_type == GNM_FUNC_TYPE_ARGS)
 		g_free (func->fn.args.arg_types);
-	if (func->flags & GNM_FUNC_FREE_NAME)
-		g_free ((char *)func->name);
+
+	g_free ((char *)func->name);
 
 	if (func->textdomain)
 		go_string_unref (func->textdomain);
@@ -1148,7 +1148,7 @@ gnm_func_add (GnmFuncGroup *fn_group,
 	if (!textdomain)
 		textdomain = GETTEXT_PACKAGE;
 
-	func->name		= desc->name;
+	func->name		= g_strdup (desc->name);
 	func->help		= desc->help ? desc->help : NULL;
 	func->textdomain        = go_string_new (textdomain);
 	func->linker		= desc->linker;
@@ -1311,7 +1311,7 @@ gnm_func_add_placeholder_full (Workbook *scope,
 	desc.fn_nodes	  = &unknownFunctionHandler;
 	desc.linker	  = NULL;
 	desc.usage_notify = NULL;
-	desc.flags	  = GNM_FUNC_IS_PLACEHOLDER | (copy_gname ? GNM_FUNC_FREE_NAME : 0);
+	desc.flags	  = GNM_FUNC_IS_PLACEHOLDER;
 	desc.impl_status  = GNM_FUNC_IMPL_STATUS_EXISTS;
 	desc.test_status  = GNM_FUNC_TEST_STATUS_UNKNOWN;
 
@@ -1320,7 +1320,7 @@ gnm_func_add_placeholder_full (Workbook *scope,
 	else {
 #if 0
 		/* WISHLIST : it would be nice to have a log if these. */
-		g_warning ("Unknown %s function : %s", type, gname);
+		g_warning ("Unknown %s function : %s", type, desc.name);
 #endif
 	}
 
diff --git a/src/func.h b/src/func.h
index f3f42bd..518bb72 100644
--- a/src/func.h
+++ b/src/func.h
@@ -87,7 +87,6 @@ typedef enum {
 
 	/* an unknown function that will hopefully be defined later */
 	GNM_FUNC_IS_PLACEHOLDER		= 1 << 3,
-	GNM_FUNC_FREE_NAME		= 1 << 4,
 	GNM_FUNC_IS_WORKBOOK_LOCAL	= 1 << 5,
 	GNM_FUNC_INTERNAL		= 1 << 6,
 



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