Commit 07fc066e authored by Morten Welinder's avatar Morten Welinder Committed by Arturo Espinosa

Remove useless initialisation. Don't free individual selections here.

Sat Apr 24 14:39:32 1999  Morten Welinder  <terra@diku.dk>

	* src/sheet.c (sheet_selection_reset_only): Remove useless
 	initialisation.  Don't free individual selections here.

	(sheet_selections_free): Walk the list of selections and free each
 	one.

	(sheet_get_selection_name): Calculate buffer size based on the
 	size of an int.

	* src/fn-eng.c: Remove sqrtpi function -- it's already in fn-math.c

	* src/fn-math.c (gnumeric_sqrtpi): Add range check.

	* src/symbol.c (symbol_install): Add sanity check.
parent dd4a1442
Sat Apr 24 14:39:32 1999 Morten Welinder <terra@diku.dk>
* src/sheet.c (sheet_selection_reset_only): Remove useless
initialisation. Don't free individual selections here.
(sheet_selections_free): Walk the list of selections and free each
one.
(sheet_get_selection_name): Calculate buffer size based on the
size of an int.
* src/fn-eng.c: Remove sqrtpi function -- it's already in fn-math.c
* src/fn-math.c (gnumeric_sqrtpi): Add range check.
* src/symbol.c (symbol_install): Add sanity check.
Fri Apr 23 17:52:44 1999 Morten Welinder <terra@diku.dk>
* src/sheet.c (sheet_destroy): Don't check that workbook is
......
Sat Apr 24 14:39:32 1999 Morten Welinder <terra@diku.dk>
* src/sheet.c (sheet_selection_reset_only): Remove useless
initialisation. Don't free individual selections here.
(sheet_selections_free): Walk the list of selections and free each
one.
(sheet_get_selection_name): Calculate buffer size based on the
size of an int.
* src/fn-eng.c: Remove sqrtpi function -- it's already in fn-math.c
* src/fn-math.c (gnumeric_sqrtpi): Add range check.
* src/symbol.c (symbol_install): Add sanity check.
Fri Apr 23 17:52:44 1999 Morten Welinder <terra@diku.dk>
* src/sheet.c (sheet_destroy): Don't check that workbook is
......
Sat Apr 24 14:39:32 1999 Morten Welinder <terra@diku.dk>
* src/sheet.c (sheet_selection_reset_only): Remove useless
initialisation. Don't free individual selections here.
(sheet_selections_free): Walk the list of selections and free each
one.
(sheet_get_selection_name): Calculate buffer size based on the
size of an int.
* src/fn-eng.c: Remove sqrtpi function -- it's already in fn-math.c
* src/fn-math.c (gnumeric_sqrtpi): Add range check.
* src/symbol.c (symbol_install): Add sanity check.
Fri Apr 23 17:52:44 1999 Morten Welinder <terra@diku.dk>
* src/sheet.c (sheet_destroy): Don't check that workbook is
......
Sat Apr 24 14:39:32 1999 Morten Welinder <terra@diku.dk>
* src/sheet.c (sheet_selection_reset_only): Remove useless
initialisation. Don't free individual selections here.
(sheet_selections_free): Walk the list of selections and free each
one.
(sheet_get_selection_name): Calculate buffer size based on the
size of an int.
* src/fn-eng.c: Remove sqrtpi function -- it's already in fn-math.c
* src/fn-math.c (gnumeric_sqrtpi): Add range check.
* src/symbol.c (symbol_install): Add sanity check.
Fri Apr 23 17:52:44 1999 Morten Welinder <terra@diku.dk>
* src/sheet.c (sheet_destroy): Don't check that workbook is
......
......@@ -638,30 +638,6 @@ gnumeric_gestep (struct FunctionDefinition *i, Value *argv [], char **error_stri
return value_int (ans);
}
static char *help_sqrtpi = {
N_("@FUNCTION=SQRTPI\n"
"@SYNTAX=SQRTPI(x)\n"
"@DESCRIPTION="
"The SQRTPI function returns the square root of PI * x. "
"\n"
"if x < 0 a #NUM! error is returned."
"\n"
"@SEEALSO=ERF")
};
static Value *
gnumeric_sqrtpi (struct FunctionDefinition *i, Value *argv [], char **error_string)
{
float_t x;
if ((x=value_get_as_double(argv[0]))<0){
*error_string = _("#NUM!");
return NULL;
}
return value_float (sqrt (M_PI*x));
}
FunctionDefinition eng_functions [] = {
{ "bessely", "ff", "xnum,ynum", &help_bessely, NULL, gnumeric_bessely },
{ "besselj", "ff", "xnum,ynum", &help_besselj, NULL, gnumeric_besselj },
......@@ -681,7 +657,6 @@ FunctionDefinition eng_functions [] = {
{ "oct2bin", "?|f", "xnum,ynum", &help_oct2bin, NULL, gnumeric_oct2bin },
{ "oct2dec", "?", "number", &help_oct2dec, NULL, gnumeric_oct2dec },
{ "oct2hex", "?|f", "xnum,ynum", &help_oct2hex, NULL, gnumeric_oct2hex },
{ "sqrtpi", "f", "number", &help_sqrtpi, NULL, gnumeric_sqrtpi },
/* besseli */
/* besselk */
{ NULL, NULL },
......
......@@ -1679,6 +1679,10 @@ gnumeric_sqrtpi (struct FunctionDefinition *i, Value *argv [], char **error_stri
float_t n;
n = value_get_as_double (argv[0]);
if (n < 0) {
*error_string = _("#NUM!");
return NULL;
}
return value_float (sqrt (M_PI * n));
}
......
......@@ -638,30 +638,6 @@ gnumeric_gestep (struct FunctionDefinition *i, Value *argv [], char **error_stri
return value_int (ans);
}
static char *help_sqrtpi = {
N_("@FUNCTION=SQRTPI\n"
"@SYNTAX=SQRTPI(x)\n"
"@DESCRIPTION="
"The SQRTPI function returns the square root of PI * x. "
"\n"
"if x < 0 a #NUM! error is returned."
"\n"
"@SEEALSO=ERF")
};
static Value *
gnumeric_sqrtpi (struct FunctionDefinition *i, Value *argv [], char **error_string)
{
float_t x;
if ((x=value_get_as_double(argv[0]))<0){
*error_string = _("#NUM!");
return NULL;
}
return value_float (sqrt (M_PI*x));
}
FunctionDefinition eng_functions [] = {
{ "bessely", "ff", "xnum,ynum", &help_bessely, NULL, gnumeric_bessely },
{ "besselj", "ff", "xnum,ynum", &help_besselj, NULL, gnumeric_besselj },
......@@ -681,7 +657,6 @@ FunctionDefinition eng_functions [] = {
{ "oct2bin", "?|f", "xnum,ynum", &help_oct2bin, NULL, gnumeric_oct2bin },
{ "oct2dec", "?", "number", &help_oct2dec, NULL, gnumeric_oct2dec },
{ "oct2hex", "?|f", "xnum,ynum", &help_oct2hex, NULL, gnumeric_oct2hex },
{ "sqrtpi", "f", "number", &help_sqrtpi, NULL, gnumeric_sqrtpi },
/* besseli */
/* besselk */
{ NULL, NULL },
......
......@@ -1679,6 +1679,10 @@ gnumeric_sqrtpi (struct FunctionDefinition *i, Value *argv [], char **error_stri
float_t n;
n = value_get_as_double (argv[0]);
if (n < 0) {
*error_string = _("#NUM!");
return NULL;
}
return value_float (sqrt (M_PI * n));
}
......
......@@ -638,30 +638,6 @@ gnumeric_gestep (struct FunctionDefinition *i, Value *argv [], char **error_stri
return value_int (ans);
}
static char *help_sqrtpi = {
N_("@FUNCTION=SQRTPI\n"
"@SYNTAX=SQRTPI(x)\n"
"@DESCRIPTION="
"The SQRTPI function returns the square root of PI * x. "
"\n"
"if x < 0 a #NUM! error is returned."
"\n"
"@SEEALSO=ERF")
};
static Value *
gnumeric_sqrtpi (struct FunctionDefinition *i, Value *argv [], char **error_string)
{
float_t x;
if ((x=value_get_as_double(argv[0]))<0){
*error_string = _("#NUM!");
return NULL;
}
return value_float (sqrt (M_PI*x));
}
FunctionDefinition eng_functions [] = {
{ "bessely", "ff", "xnum,ynum", &help_bessely, NULL, gnumeric_bessely },
{ "besselj", "ff", "xnum,ynum", &help_besselj, NULL, gnumeric_besselj },
......@@ -681,7 +657,6 @@ FunctionDefinition eng_functions [] = {
{ "oct2bin", "?|f", "xnum,ynum", &help_oct2bin, NULL, gnumeric_oct2bin },
{ "oct2dec", "?", "number", &help_oct2dec, NULL, gnumeric_oct2dec },
{ "oct2hex", "?|f", "xnum,ynum", &help_oct2hex, NULL, gnumeric_oct2hex },
{ "sqrtpi", "f", "number", &help_sqrtpi, NULL, gnumeric_sqrtpi },
/* besseli */
/* besselk */
{ NULL, NULL },
......
......@@ -1679,6 +1679,10 @@ gnumeric_sqrtpi (struct FunctionDefinition *i, Value *argv [], char **error_stri
float_t n;
n = value_get_as_double (argv[0]);
if (n < 0) {
*error_string = _("#NUM!");
return NULL;
}
return value_float (sqrt (M_PI * n));
}
......
......@@ -680,7 +680,7 @@ static const char *
sheet_get_selection_name (Sheet *sheet)
{
SheetSelection *ss = sheet->selections->data;
static char buffer [40];
static char buffer [10 + 2 * 4 * sizeof (int)];
if (ss->start_col == ss->end_col && ss->start_row == ss->end_row){
return cell_name (ss->start_col, ss->start_row);
......@@ -1417,6 +1417,13 @@ sheet_selection_set (Sheet *sheet, int start_col, int start_row, int end_col, in
static void
sheet_selections_free (Sheet *sheet)
{
GList *list;
for (list = sheet->selections; list; list = list->next){
SheetSelection *ss = list->data;
g_free (ss);
}
g_list_free (sheet->selections);
sheet->selections = NULL;
}
......@@ -1432,7 +1439,7 @@ sheet_selections_free (Sheet *sheet)
void
sheet_selection_reset_only (Sheet *sheet)
{
GList *list = sheet->selections;
GList *list;
g_return_if_fail (sheet != NULL);
g_return_if_fail (IS_SHEET (sheet));
......@@ -1441,7 +1448,6 @@ sheet_selection_reset_only (Sheet *sheet)
SheetSelection *ss = list->data;
sheet_redraw_selection (sheet, ss);
g_free (ss);
}
sheet_selections_free (sheet);
......
......@@ -64,6 +64,9 @@ symbol_install (SymbolTable *st, const char *str, SymbolType type, void *data)
g_return_val_if_fail (str != NULL, NULL);
g_return_val_if_fail (st != NULL, NULL);
sym = (Symbol *) g_hash_table_lookup (st->hash, str);
if (sym) printf ("Symbol [%s] redefined.\n", str);
sym = g_new (Symbol, 1);
sym->ref_count = 1;
sym->type = type;
......
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