[gnumeric] rewrite function_def_get_arg_name
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnumeric] rewrite function_def_get_arg_name
- Date: Fri, 14 Aug 2009 21:18:29 +0000 (UTC)
commit a6dfed4a85b006f69b35cfab0cacc94cb4ad23a0
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date: Fri Aug 14 15:18:02 2009 -0600
rewrite function_def_get_arg_name
2009-08-14 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/func.c (function_def_get_arg_name): rewrite without using
fn_def->arg_names
ChangeLog | 5 +++++
src/func.c | 37 +++++++++++--------------------------
2 files changed, 16 insertions(+), 26 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8ab649f..cee9e60 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-08-14 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * src/func.c (function_def_get_arg_name): rewrite without using
+ fn_def->arg_names
+
2009-08-14 Morten Welinder <terra gnome org>
* src/func.c (gnm_func_sanity_check1): Check argument count too.
diff --git a/src/func.c b/src/func.c
index c7aabfb..177b374 100644
--- a/src/func.c
+++ b/src/func.c
@@ -1109,39 +1109,24 @@ function_def_get_arg_type_string (GnmFunc const *fn_def,
char *
function_def_get_arg_name (GnmFunc const *fn_def, int arg_idx)
{
- const char *start, *end;
- const char *translated_arguments;
- gunichar uc;
- char delimiter[7];
+ int i;
g_return_val_if_fail (arg_idx >= 0, NULL);
g_return_val_if_fail (fn_def != NULL, NULL);
gnm_func_load_if_stub ((GnmFunc *)fn_def);
- if (!fn_def->arg_names)
- return NULL;
-
- translated_arguments = (strlen (fn_def->arg_names)>0
- ? _(fn_def->arg_names)
- : fn_def->arg_names);
- uc = (strcmp (translated_arguments, fn_def->arg_names) == 0)
- ? ','
- : go_locale_get_arg_sep ();
- delimiter[g_unichar_to_utf8 (uc, delimiter)] = 0;
-
- start = translated_arguments;
- while (arg_idx > 0) {
- const char *del = strstr (start, delimiter);
- if (!del)
- return NULL;
- arg_idx--;
- start = del + strlen (delimiter);
+ for (i = 0;
+ fn_def->help[i].type != GNM_FUNC_HELP_END;
+ i++) {
+ if (fn_def->help[i].type == GNM_FUNC_HELP_ARG) {
+ if (arg_idx == 0)
+ return split_at_colon (_(fn_def->help[i].text), NULL);
+ else
+ arg_idx--;
+ }
}
- end = strstr (start, delimiter);
- if (!end) end = start + strlen (start);
-
- return g_strndup (start, end - start);
+ return NULL;
}
/* ------------------------------------------------------------------------- */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]