[gnumeric] Func: simplify placeholder creation, part 2.



commit 17bed2f2d162843da2b5f46f9bce38738a7542bb
Author: Morten Welinder <terra gnome org>
Date:   Thu Jan 10 20:10:52 2013 -0500

    Func: simplify placeholder creation, part 2.

 ChangeLog                         |    1 +
 plugins/applix/applix-read.c      |    2 +-
 plugins/excel/ms-excel-read.c     |    2 +-
 plugins/excel/ms-formula-read.c   |    4 ++--
 plugins/lotus-123/lotus-formula.c |    2 +-
 plugins/sc/sc.c                   |    2 +-
 src/func.c                        |   12 ++++++------
 src/func.h                        |    3 +--
 src/gnm-plugin.c                  |    3 +--
 9 files changed, 15 insertions(+), 16 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0b1eb72..2181639 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@
 	* src/func.c (gnm_func_lookup_or_add_placeholder): Drop copy_name
 	argument and assume TRUE.  Drop scope name and assume NULL (which
 	is what all callers should have used).  All callers changed.
+	(gnm_func_add_placeholder): Ditto.
 
 	* src/gnm-plugin.c (plugin_service_function_group_activate):
 	Upgrade existing placeholder functions as needed.
diff --git a/plugins/applix/applix-read.c b/plugins/applix/applix-read.c
index 4a6efaf..12c0ad0 100644
--- a/plugins/applix/applix-read.c
+++ b/plugins/applix/applix-read.c
@@ -1613,7 +1613,7 @@ applix_func_map_in (GnmConventions const *conv, Workbook *scope,
 	    NULL != (new_name = g_hash_table_lookup (namemap, name)))
 		name = new_name;
 	if (NULL == (f = gnm_func_lookup (name, scope)))
-		f = gnm_func_add_placeholder (scope, name, "", TRUE);
+		f = gnm_func_add_placeholder (scope, name, "");
 	return gnm_expr_new_funcall (f, args);
 }
 
diff --git a/plugins/excel/ms-excel-read.c b/plugins/excel/ms-excel-read.c
index f404767..eea99d0 100644
--- a/plugins/excel/ms-excel-read.c
+++ b/plugins/excel/ms-excel-read.c
@@ -3997,7 +3997,7 @@ excel_read_NAME (BiffQuery *q, GnmXLImporter *importer, ExcelReadSheet *esheet)
 
 			else if ((flags & 0xE) == 0xE) /* Function & VB-Proc & Proc */
 				gnm_func_add_placeholder (importer->wb,
-							  expr_name_name (nexpr), "VBA", TRUE);
+							  expr_name_name (nexpr), "VBA");
 		}
 	}
 
diff --git a/plugins/excel/ms-formula-read.c b/plugins/excel/ms-formula-read.c
index fe082bb..92273ab 100644
--- a/plugins/excel/ms-formula-read.c
+++ b/plugins/excel/ms-formula-read.c
@@ -662,7 +662,7 @@ make_function (GnmExprList **stack, int fn_idx, int numargs, Workbook *wb)
 			       f_name, numargs););
 
 		if (name == NULL)
-			name = gnm_func_add_placeholder (wb, f_name, "UNKNOWN", TRUE);
+			name = gnm_func_add_placeholder (wb, f_name, "UNKNOWN");
 
 		gnm_expr_free (tmp);
 		parse_list_push (stack, gnm_expr_new_funcall (name, args));
@@ -695,7 +695,7 @@ make_function (GnmExprList **stack, int fn_idx, int numargs, Workbook *wb)
 		if (fd->name) {
 			name = gnm_func_lookup (fd->name, wb);
 			if (name == NULL)
-				name = gnm_func_add_placeholder (wb, fd->name, "UNKNOWN", TRUE);
+				name = gnm_func_add_placeholder (wb, fd->name, "UNKNOWN");
 		}
 		/* This should not happen */
 		if (!name) {
diff --git a/plugins/lotus-123/lotus-formula.c b/plugins/lotus-123/lotus-formula.c
index e28e11a..ec80bbb 100644
--- a/plugins/lotus-123/lotus-formula.c
+++ b/plugins/lotus-123/lotus-formula.c
@@ -384,7 +384,7 @@ lotus_placeholder (char const *lname)
 	char *gname = g_strconcat ("LOTUS_", lname, NULL);
 	GnmFunc *func = gnm_func_lookup (gname, NULL);
 	if (!func)
-		func = gnm_func_add_placeholder (NULL, gname, "Lotus ", TRUE);
+		func = gnm_func_add_placeholder (NULL, gname, "Lotus");
 	g_free (gname);
 	return func;
 }
diff --git a/plugins/sc/sc.c b/plugins/sc/sc.c
index ac2e769..1fb3def 100644
--- a/plugins/sc/sc.c
+++ b/plugins/sc/sc.c
@@ -981,7 +981,7 @@ sc_func_map_in (GnmConventions const *conv, Workbook *scope,
 	    NULL != (new_name = g_hash_table_lookup (namemap, name)))
 		name = new_name;
 	if (NULL == (f = gnm_func_lookup (name, scope)))
-		f = gnm_func_add_placeholder (scope, name, "", TRUE);
+		f = gnm_func_add_placeholder (scope, name, "");
 	return gnm_expr_new_funcall (f, args);
 }
 
diff --git a/src/func.c b/src/func.c
index 5b4a274..4bc7612 100644
--- a/src/func.c
+++ b/src/func.c
@@ -1268,11 +1268,12 @@ invent_name (const char *pref, GHashTable *h, const char *template)
 static GnmFunc *
 gnm_func_add_placeholder_full (Workbook *scope,
 			       char const *gname, char const *lname,
-			       char const *type, gboolean copy_gname)
+			       char const *type)
 {
 	GnmFuncDescriptor desc;
 	GnmFunc *func;
 	char const *unknown_cat_name = N_("Unknown Function");
+	gboolean copy_gname = TRUE;
 	gboolean copy_lname = TRUE;
 
 	g_return_val_if_fail (gname || lname, NULL);
@@ -1353,16 +1354,15 @@ gnm_func_add_placeholder_full (Workbook *scope,
  */
 GnmFunc *
 gnm_func_add_placeholder (Workbook *scope,
-			  char const *name, char const *type,
-			  gboolean copy_name)
+			  char const *name, char const *type)
 {
-	return gnm_func_add_placeholder_full (scope, name, NULL, type, copy_name);
+	return gnm_func_add_placeholder_full (scope, name, NULL, type);
 }
 
 GnmFunc *
 gnm_func_add_placeholder_localized (char const *gname, char const *lname)
 {
-	return gnm_func_add_placeholder_full (NULL, gname, lname, "?", TRUE);
+	return gnm_func_add_placeholder_full (NULL, gname, lname, "?");
 }
 
 /* Utility routine to be used for import and analysis tools */
@@ -1371,7 +1371,7 @@ gnm_func_lookup_or_add_placeholder (char const *name)
 {
 	GnmFunc	* f = gnm_func_lookup (name, NULL);
 	if (f == NULL)
-		f = gnm_func_add_placeholder (NULL, name, "", TRUE);
+		f = gnm_func_add_placeholder (NULL, name, "");
 	return f;
 }
 
diff --git a/src/func.h b/src/func.h
index af26910..f3f42bd 100644
--- a/src/func.h
+++ b/src/func.h
@@ -240,8 +240,7 @@ GnmFunc    *gnm_func_add	     (GnmFuncGroup *group,
 				      const char *textdomain);
 GnmFunc    *gnm_func_add_placeholder (Workbook *optional_scope,
 				      char const *name,
-				      char const *type,
-				      gboolean copy_name);
+				      char const *type);
 GnmFunc    *gnm_func_add_placeholder_localized (char const *gname, char const *lname);
 GnmFunc	   *gnm_func_lookup_or_add_placeholder (char const *name);
 void        gnm_func_upgrade_placeholder
diff --git a/src/gnm-plugin.c b/src/gnm-plugin.c
index 1e6a1bc..b90ca1d 100644
--- a/src/gnm-plugin.c
+++ b/src/gnm-plugin.c
@@ -217,8 +217,7 @@ plugin_service_function_group_activate (GOPluginService *service, GOErrorInfo **
 			 g_printerr ("Reusing placeholder for %s\n", fname);
 #endif
 		 } else {
-			 fd = gnm_func_add_placeholder
-				 (NULL, fname, "?", TRUE);
+			 fd = gnm_func_add_placeholder (NULL, fname, "?");
 		 }
 		 if (fd->flags & GNM_FUNC_IS_PLACEHOLDER) {
 			 gnm_func_set_user_data (fd, service);



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