Commit c6dcedd4 authored by Andreas J. Guelzow's avatar Andreas J. Guelzow Committed by Andreas J. Guelzow

handle VALUE_ARRAY more reasonably (value_peek_string) : initialize all

2002-04-13  Andreas J. Guelzow <aguelzow@taliesin.ca>

	* src/value.c (value_get_as_string) : handle VALUE_ARRAY more reasonably
	(value_peek_string) : initialize all fields of cache
parent d05444fe
2002-04-13 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/value.c (value_get_as_string) : handle VALUE_ARRAY more reasonably
(value_peek_string) : initialize all fields of cache
2002-04-13 Jon K Hellan <hellan@acm.org> 2002-04-13 Jon K Hellan <hellan@acm.org>
* src/gui-file.c: s/ENABLE_BONOBO/WITH_BONOBO/ * src/gui-file.c: s/ENABLE_BONOBO/WITH_BONOBO/
......
2002-04-13 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/value.c (value_get_as_string) : handle VALUE_ARRAY more reasonably
(value_peek_string) : initialize all fields of cache
2002-04-13 Jon K Hellan <hellan@acm.org> 2002-04-13 Jon K Hellan <hellan@acm.org>
* src/gui-file.c: s/ENABLE_BONOBO/WITH_BONOBO/ * src/gui-file.c: s/ENABLE_BONOBO/WITH_BONOBO/
......
2002-04-13 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/value.c (value_get_as_string) : handle VALUE_ARRAY more reasonably
(value_peek_string) : initialize all fields of cache
2002-04-13 Jon K Hellan <hellan@acm.org> 2002-04-13 Jon K Hellan <hellan@acm.org>
* src/gui-file.c: s/ENABLE_BONOBO/WITH_BONOBO/ * src/gui-file.c: s/ENABLE_BONOBO/WITH_BONOBO/
......
...@@ -619,19 +619,13 @@ value_get_as_string (Value const *v) ...@@ -619,19 +619,13 @@ value_get_as_string (Value const *v)
for (y = 0; y < v->v_array.y; y++){ for (y = 0; y < v->v_array.y; y++){
for (x = 0; x < v->v_array.x; x++){ for (x = 0; x < v->v_array.x; x++){
Value const *val = v->v_array.vals[x][y]; Value const *val = v->v_array.vals[x][y];
char *text;
g_return_val_if_fail (val->type == VALUE_STRING ||
val->type == VALUE_FLOAT ||
val->type == VALUE_INTEGER,
g_strdup ("Duff Array contents"));
if (x) if (x)
g_string_append_c (str, row_sep); g_string_append_c (str, row_sep);
if (val->type == VALUE_STRING) text = value_get_as_string (val);
g_string_sprintfa (str, "\"%s\"", g_string_append (str, text);
val->v_str.val->str); g_free (text);
else
g_string_sprintfa (str, "%" GNUM_FORMAT_g,
value_get_as_float (val));
} }
if (y < v->v_array.y-1) if (y < v->v_array.y-1)
g_string_append_c (str, col_sep); g_string_append_c (str, col_sep);
...@@ -673,7 +667,7 @@ value_peek_string (Value const *v) ...@@ -673,7 +667,7 @@ value_peek_string (Value const *v)
else if (v->type == VALUE_ERROR) else if (v->type == VALUE_ERROR)
return v->v_err.mesg->str; return v->v_err.mesg->str;
else { else {
static char *cache[2] = { 0 }; static char *cache[2] = { 0 , 0};
static int next = 0; static int next = 0;
char const *s; char const *s;
......
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