Commit f37350df authored by Morten Welinder's avatar Morten Welinder

GnmFunc: patch up things to please the test suite.

(I.e., things didn't work and crashes left and right. That sort of thing.)
parent 592cd1c3
......@@ -304,14 +304,14 @@ gnm_func_create_arg_names (GnmFunc *func)
gboolean
gnm_func_is_varargs (GnmFunc *func)
{
gnm_func_load_stub (func);
gnm_func_load_if_stub (func);
return func->fn_type == GNM_FUNC_TYPE_NODES;
}
gboolean
gnm_func_is_fixargs (GnmFunc *func)
{
gnm_func_load_stub (func);
gnm_func_load_if_stub (func);
return func->fn_type == GNM_FUNC_TYPE_ARGS;
}
......@@ -326,12 +326,6 @@ gnm_func_set_stub (GnmFunc *func)
g_free (func->arg_types);
func->arg_types = NULL;
if (func->arg_names) {
g_ptr_array_foreach (func->arg_names, (GFunc)g_free, NULL);
g_ptr_array_free (func->arg_names, TRUE);
func->arg_names = NULL;
}
func->min_args = func->max_args = 0;
func->nodes_func = NULL;
......@@ -395,10 +389,8 @@ gnm_func_set_fixargs (GnmFunc *func, GnmFuncArgs fn, const char *spec)
func->min_args = p - func->arg_types;
memmove (p, p + 1, strlen (p));
} else
func->min_args = 0;
func->min_args = strlen (func->arg_types);
func->max_args = strlen (func->arg_types);
gnm_func_create_arg_names (func);
}
/**
......@@ -440,6 +432,12 @@ gnm_func_set_help (GnmFunc *func, GnmFuncHelp const *help, int n)
func->help = NULL;
}
if (func->arg_names) {
g_ptr_array_foreach (func->arg_names, (GFunc)g_free, NULL);
g_ptr_array_free (func->arg_names, TRUE);
func->arg_names = NULL;
}
if (help) {
int i;
......@@ -450,6 +448,8 @@ gnm_func_set_help (GnmFunc *func, GnmFuncHelp const *help, int n)
}
func->help[n].type = GNM_FUNC_HELP_END;
func->help[n].text = NULL;
gnm_func_create_arg_names (func);
}
func->help_count = n;
......
......@@ -1039,8 +1039,8 @@ gnm_func_sanity_check1 (GnmFunc *fd)
res = 1;
}
if (check_argument_refs (aend + 1, fd)) {
g_printerr ("%s: Invalid argument reference in argument\n",
fd->name);
g_printerr ("%s: Invalid argument reference, %s, in argument\n",
aend + 1, fd->name);
res = 1;
}
argname = g_strndup (h->text, aend - h->text);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment