Commit a8111ec6 authored by Morten Welinder's avatar Morten Welinder Committed by Morten Welinder

Use the hash table to report leaked strings. Use slice allocator when

2007-02-26  Morten Welinder  <terra@gnome.org>

	* src/str.c (gnm_string_shutdown): Use the hash table to report
	leaked strings.  Use slice allocator when available.

	* src/value.c (value_shutdown): Use slice allocator when
	available.  Keep a running count of allocations and report leaks
	on shutdown.

	* src/commands.c (cmd_copyrel): Handle non-singleton areas.
	[#112847] Also switch to GOUndo.

	* */*.c: Use <stdio.h> only when needed.


svn path=/trunk/; revision=15433
parent 4f0be8b2
2007-02-26 Morten Welinder <terra@gnome.org>
* src/str.c (gnm_string_shutdown): Use the hash table to report
leaked strings. Use slice allocator when available.
* src/value.c (value_shutdown): Use slice allocator when
available. Keep a running count of allocations and report leaks
on shutdown.
* src/commands.c (cmd_copyrel): Handle non-singleton areas.
[#112847] Also switch to GOUndo.
* */*.c: Use <stdio.h> only when needed.
2007-02-24 Morten Welinder <terra@gnome.org> 2007-02-24 Morten Welinder <terra@gnome.org>
* src/workbook-edit.c (wbcg_edit_start): If formatting as date * src/workbook-edit.c (wbcg_edit_start): If formatting as date
......
...@@ -5,6 +5,7 @@ Morten: ...@@ -5,6 +5,7 @@ Morten:
* Fix gui problems after replacing pristine book. [#410365] [#410371]. * Fix gui problems after replacing pristine book. [#410365] [#410371].
* Fix R1C1 preventing the use of, e.g., COS and RADIANS. [#410609] * Fix R1C1 preventing the use of, e.g., COS and RADIANS. [#410609]
* Fix editing of out-of-range numbers with date format. * Fix editing of out-of-range numbers with date format.
* Improve CopyDown and CopyRight. [#112847]
Oliver Burnett-Hall: Oliver Burnett-Hall:
* Fix R1C1 problem in formula guru. * Fix R1C1 problem in formula guru.
......
...@@ -695,7 +695,7 @@ SAVE_CFLAGS=$CFLAGS ...@@ -695,7 +695,7 @@ SAVE_CFLAGS=$CFLAGS
SAVE_LIBS=$LIBS SAVE_LIBS=$LIBS
CFLAGS="$CFLAGS $GNUMERIC_CFLAGS" CFLAGS="$CFLAGS $GNUMERIC_CFLAGS"
LIBS="$GNUMERIC_LIBS $LIBS" LIBS="$GNUMERIC_LIBS $LIBS"
AC_CHECK_FUNCS(g_date_set_time_t) AC_CHECK_FUNCS(g_date_set_time_t g_slice_alloc)
CFLAGS=$SAVE_CFLAGS CFLAGS=$SAVE_CFLAGS
LIBS=$SAVE_LIBS LIBS=$SAVE_LIBS
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
*/ */
#include <gnumeric-config.h> #include <gnumeric-config.h>
#include <glib/gi18n-lib.h> #include <glib/gi18n-lib.h>
#include <stdio.h>
#include "gnumeric.h" #include "gnumeric.h"
#include "command-context-stderr.h" #include "command-context-stderr.h"
#include <gsf/gsf-impl-utils.h> #include <gsf/gsf-impl-utils.h>
...@@ -55,7 +54,7 @@ ccs_error_error (GOCmdContext *cc, GError *error) ...@@ -55,7 +54,7 @@ ccs_error_error (GOCmdContext *cc, GError *error)
{ {
CmdContextStderr *ccs = COMMAND_CONTEXT_STDERR (cc); CmdContextStderr *ccs = COMMAND_CONTEXT_STDERR (cc);
fprintf (stderr, "Error: %s\n", error->message); g_printerr ("Error: %s\n", error->message);
ccs->status = -1; ccs->status = -1;
} }
static void static void
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* commands.c: Handlers to undo & redo commands * commands.c: Handlers to undo & redo commands
* *
* Copyright (C) 1999-2006 Jody Goldberg (jody@gnome.org) * Copyright (C) 1999-2006 Jody Goldberg (jody@gnome.org)
* Copyright (C) 2002-2006 Morten Welinder (terra@gnome.org) * Copyright (C) 2002-2007 Morten Welinder (terra@gnome.org)
* *
* Contributors : Almer S. Tigelaar (almer@gnome.org) * Contributors : Almer S. Tigelaar (almer@gnome.org)
* Andreas J. Guelzow (aguelzow@taliesin.ca) * Andreas J. Guelzow (aguelzow@taliesin.ca)
...@@ -653,7 +653,7 @@ truncate_undo_info (Workbook *wb) ...@@ -653,7 +653,7 @@ truncate_undo_info (Workbook *wb)
max_num = gnm_app_prefs->undo_max_number; max_num = gnm_app_prefs->undo_max_number;
#ifdef DEBUG_TRUNCATE_UNDO #ifdef DEBUG_TRUNCATE_UNDO
fprintf (stderr, "Undo sizes:"); g_printerr ("Undo sizes:");
#endif #endif
for (l = wb->undo_commands, prev = NULL, ok_count = 0; for (l = wb->undo_commands, prev = NULL, ok_count = 0;
...@@ -673,7 +673,7 @@ truncate_undo_info (Workbook *wb) ...@@ -673,7 +673,7 @@ truncate_undo_info (Workbook *wb)
} }
#ifdef DEBUG_TRUNCATE_UNDO #ifdef DEBUG_TRUNCATE_UNDO
fprintf (stderr, " %d", size); g_printerr (" %d", size);
#endif #endif
/* Keep at least one undo item. */ /* Keep at least one undo item. */
...@@ -685,7 +685,7 @@ truncate_undo_info (Workbook *wb) ...@@ -685,7 +685,7 @@ truncate_undo_info (Workbook *wb)
else else
wb->undo_commands = NULL; wb->undo_commands = NULL;
#ifdef DEBUG_TRUNCATE_UNDO #ifdef DEBUG_TRUNCATE_UNDO
fprintf (stderr, "[trunc]\n"); g_printerr ("[trunc]\n");
#endif #endif
return ok_count; return ok_count;
} }
...@@ -699,7 +699,7 @@ truncate_undo_info (Workbook *wb) ...@@ -699,7 +699,7 @@ truncate_undo_info (Workbook *wb)
} }
#ifdef DEBUG_TRUNCATE_UNDO #ifdef DEBUG_TRUNCATE_UNDO
fprintf (stderr, "\n"); g_printerr ("\n");
#endif #endif
return -1; return -1;
} }
...@@ -3327,7 +3327,7 @@ cmd_autofill (WorkbookControl *wbc, Sheet *sheet, ...@@ -3327,7 +3327,7 @@ cmd_autofill (WorkbookControl *wbc, Sheet *sheet,
typedef struct { typedef struct {
GnmCommand cmd; GnmCommand cmd;
GnmCellRegion *contents; GOUndo *undo;
GnmPasteTarget dst, src; GnmPasteTarget dst, src;
int dx, dy; int dx, dy;
char const *name; char const *name;
...@@ -3345,18 +3345,12 @@ static gboolean ...@@ -3345,18 +3345,12 @@ static gboolean
cmd_copyrel_undo (GnmCommand *cmd, WorkbookControl *wbc) cmd_copyrel_undo (GnmCommand *cmd, WorkbookControl *wbc)
{ {
CmdCopyRel *me = CMD_COPYREL (cmd); CmdCopyRel *me = CMD_COPYREL (cmd);
gboolean res;
g_return_val_if_fail (wbc != NULL, TRUE); g_return_val_if_fail (wbc != NULL, TRUE);
g_return_val_if_fail (me != NULL, TRUE); g_return_val_if_fail (me != NULL, TRUE);
g_return_val_if_fail (me->contents != NULL, TRUE); g_return_val_if_fail (me->undo != NULL, TRUE);
res = clipboard_paste_region (me->contents, &me->dst, GO_CMD_CONTEXT (wbc));
cellregion_unref (me->contents);
me->contents = NULL;
if (res) go_undo_undo (me->undo);
return TRUE;
/* Select the newly pasted contents (this queues a redraw) */ /* Select the newly pasted contents (this queues a redraw) */
select_range (me->dst.sheet, &me->dst.range, wbc); select_range (me->dst.sheet, &me->dst.range, wbc);
...@@ -3372,11 +3366,6 @@ cmd_copyrel_redo (GnmCommand *cmd, WorkbookControl *wbc) ...@@ -3372,11 +3366,6 @@ cmd_copyrel_redo (GnmCommand *cmd, WorkbookControl *wbc)
gboolean res; gboolean res;
g_return_val_if_fail (me != NULL, TRUE); g_return_val_if_fail (me != NULL, TRUE);
g_return_val_if_fail (me->contents == NULL, TRUE);
me->contents = clipboard_copy_range (me->dst.sheet, &me->dst.range);
g_return_val_if_fail (me->contents != NULL, TRUE);
sheet_clear_region (me->dst.sheet, sheet_clear_region (me->dst.sheet,
me->dst.range.start.col, me->dst.range.start.row, me->dst.range.start.col, me->dst.range.start.row,
...@@ -3405,10 +3394,9 @@ cmd_copyrel_finalize (GObject *cmd) ...@@ -3405,10 +3394,9 @@ cmd_copyrel_finalize (GObject *cmd)
{ {
CmdCopyRel *me = CMD_COPYREL (cmd); CmdCopyRel *me = CMD_COPYREL (cmd);
if (me->contents) { if (me->undo)
cellregion_unref (me->contents); g_object_unref (me->undo);
me->contents = NULL;
}
gnm_command_finalize (cmd); gnm_command_finalize (cmd);
} }
...@@ -3421,18 +3409,34 @@ cmd_copyrel (WorkbookControl *wbc, ...@@ -3421,18 +3409,34 @@ cmd_copyrel (WorkbookControl *wbc,
GnmRange target, src; GnmRange target, src;
SheetView *sv = wb_control_cur_sheet_view (wbc); SheetView *sv = wb_control_cur_sheet_view (wbc);
Sheet *sheet = sv->sheet; Sheet *sheet = sv->sheet;
GnmCellPos const *pos = sv_is_singleton_selected (sv); GnmRange const *selr =
selection_first_range (sv, GO_CMD_CONTEXT (wbc), name);
g_return_val_if_fail (dx == 0 || dy == 0, TRUE);
if (!pos) if (!selr)
return FALSE; return FALSE;
target.start = target.end = *pos; target = *selr;
range_normalize (&target);
src.start = src.end = target.start;
if (dy) {
src.end.col = target.end.col;
if (target.start.row != target.end.row)
target.start.row++;
else
src.start.row = src.end.row = (target.start.row + dy);
}
if (dx) {
src.end.row = target.end.row;
if (target.start.col != target.end.col)
target.start.col++;
else
src.start.col = src.end.col = (target.start.col + dx);
}
src = target;
src.start.col += dx;
src.end.col += dx;
src.start.row += dy;
src.end.row += dy;
if (src.start.col < 0 || src.start.col >= SHEET_MAX_COLS || if (src.start.col < 0 || src.start.col >= SHEET_MAX_COLS ||
src.start.row < 0 || src.start.row >= SHEET_MAX_ROWS) src.start.row < 0 || src.start.row >= SHEET_MAX_ROWS)
return FALSE; return FALSE;
...@@ -3444,7 +3448,6 @@ cmd_copyrel (WorkbookControl *wbc, ...@@ -3444,7 +3448,6 @@ cmd_copyrel (WorkbookControl *wbc,
me = g_object_new (CMD_COPYREL_TYPE, NULL); me = g_object_new (CMD_COPYREL_TYPE, NULL);
me->contents = NULL;
me->dst.sheet = sheet; me->dst.sheet = sheet;
me->dst.paste_flags = PASTE_CONTENTS | PASTE_FORMATS; me->dst.paste_flags = PASTE_CONTENTS | PASTE_FORMATS;
me->dst.range = target; me->dst.range = target;
...@@ -3454,6 +3457,7 @@ cmd_copyrel (WorkbookControl *wbc, ...@@ -3454,6 +3457,7 @@ cmd_copyrel (WorkbookControl *wbc,
me->dx = dx; me->dx = dx;
me->dy = dy; me->dy = dy;
me->name = name; me->name = name;
me->undo = clipboard_copy_range_undo (me->dst.sheet, &me->dst.range);
me->cmd.sheet = sheet; me->cmd.sheet = sheet;
me->cmd.size = 1; me->cmd.size = 1;
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include <gsf/gsf-impl-utils.h> #include <gsf/gsf-impl-utils.h>
#include <gtk/gtkmain.h> #include <gtk/gtkmain.h>
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#define PARENT_TYPE (G_TYPE_OBJECT) #define PARENT_TYPE (G_TYPE_OBJECT)
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
#include "gnumeric.h" #include "gnumeric.h"
#include <goffice/utils/goffice-utils.h> #include <goffice/utils/goffice-utils.h>
#include <stdio.h>
struct _GnmDependent { struct _GnmDependent {
guint flags; guint flags;
......
...@@ -58,7 +58,6 @@ ...@@ -58,7 +58,6 @@
#include <gtk/gtkmenuitem.h> #include <gtk/gtkmenuitem.h>
#include <gsf/gsf-impl-utils.h> #include <gsf/gsf-impl-utils.h>
#include <gdk/gdkkeysyms.h> #include <gdk/gdkkeysyms.h>
#include <stdio.h>
#define CELL_SORT_KEY "cell-sort-dialog" #define CELL_SORT_KEY "cell-sort-dialog"
......
...@@ -57,7 +57,6 @@ ...@@ -57,7 +57,6 @@
#include <gtk/gtkcelllayout.h> #include <gtk/gtkcelllayout.h>
#include <gtk/gtkcellrenderertext.h> #include <gtk/gtkcellrenderertext.h>
/*#include <gtk/gtkmenuitem.h>*/ /*#include <gtk/gtkmenuitem.h>*/
#include <stdio.h>
/* FIXME: do not hardcode pixel counts. */ /* FIXME: do not hardcode pixel counts. */
#define PREVIEW_X 170 #define PREVIEW_X 170
......
...@@ -53,7 +53,6 @@ ...@@ -53,7 +53,6 @@
#include <gtk/gtkicontheme.h> #include <gtk/gtkicontheme.h>
#include <gtk/gtkbox.h> #include <gtk/gtkbox.h>
#include <string.h> #include <string.h>
#include <stdio.h>
#define SHEET_ORDER_KEY "sheet-order-dialog" #define SHEET_ORDER_KEY "sheet-order-dialog"
......
...@@ -2999,7 +2999,7 @@ cb_expression_pool_leak (gpointer data, G_GNUC_UNUSED gpointer user) ...@@ -2999,7 +2999,7 @@ cb_expression_pool_leak (gpointer data, G_GNUC_UNUSED gpointer user)
pp.sheet = NULL; pp.sheet = NULL;
pp.wb = NULL; pp.wb = NULL;
s = gnm_expr_as_string (expr, &pp, gnm_expr_conventions_default); s = gnm_expr_as_string (expr, &pp, gnm_expr_conventions_default);
fprintf (stderr, "Leaking expression at %p: %s.\n", expr, s); g_printerr ("Leaking expression at %p: %s.\n", expr, s);
g_free (s); g_free (s);
} }
#endif #endif
......
...@@ -101,7 +101,7 @@ check_name_match (char const *name, char const *description, char const *tag) ...@@ -101,7 +101,7 @@ check_name_match (char const *name, char const *description, char const *tag)
char *desc_name, *up_name; char *desc_name, *up_name;
if (NULL == (tmp = strstr (description, tag))) { if (NULL == (tmp = strstr (description, tag))) {
fprintf (stderr, "'%s' : missing '%s' section. text = '%s'\n", name, tag, description); g_printerr ("'%s' : missing '%s' section. text = '%s'\n", name, tag, description);
return NULL; return NULL;
} }
...@@ -111,7 +111,7 @@ check_name_match (char const *name, char const *description, char const *tag) ...@@ -111,7 +111,7 @@ check_name_match (char const *name, char const *description, char const *tag)
desc_name = g_strndup (description, tmp-description); desc_name = g_strndup (description, tmp-description);
up_name = g_ascii_strup (name, -1); up_name = g_ascii_strup (name, -1);
if (strcmp (desc_name, up_name)) { if (strcmp (desc_name, up_name)) {
fprintf (stderr, "'%s' : does not match '%s' in @FUNCTION\n", desc_name, up_name); g_printerr ("'%s' : does not match '%s' in @FUNCTION\n", desc_name, up_name);
g_free (up_name); g_free (up_name);
g_free (desc_name); g_free (desc_name);
return NULL; return NULL;
...@@ -150,14 +150,14 @@ cb_generate_po (gpointer key, Symbol *sym, gpointer array) ...@@ -150,14 +150,14 @@ cb_generate_po (gpointer key, Symbol *sym, gpointer array)
return; return;
if (NULL == (tmp = strstr (ptr, "@DESCRIPTION="))) { if (NULL == (tmp = strstr (ptr, "@DESCRIPTION="))) {
fprintf (stderr, "'%s' : missing @DESCRIPTION section\n", fd->name); g_printerr ("'%s' : missing @DESCRIPTION section\n", fd->name);
return; return;
} }
if (NULL == (tmp = strstr (ptr, "@EXAMPLES="))) { if (NULL == (tmp = strstr (ptr, "@EXAMPLES="))) {
return; return;
} }
if (NULL == (tmp = strstr (ptr, "@SEEALSO="))) { if (NULL == (tmp = strstr (ptr, "@SEEALSO="))) {
fprintf (stderr, "'%s' : missing @SEEALSO section\n", fd->name); g_printerr ("'%s' : missing @SEEALSO section\n", fd->name);
return; return;
} }
} }
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include <goffice/utils/go-locale.h> #include <goffice/utils/go-locale.h>
#include <glib/gi18n-lib.h> #include <glib/gi18n-lib.h>
#include <string.h> #include <string.h>
#include <stdio.h>
#include <style-font.h> #include <style-font.h>
static char const * static char const *
......
...@@ -1101,8 +1101,8 @@ gnm_canvas_redraw_range (GnmCanvas *gcanvas, GnmRange const *r) ...@@ -1101,8 +1101,8 @@ gnm_canvas_redraw_range (GnmCanvas *gcanvas, GnmRange const *r)
: INT_MAX; : INT_MAX;
#if 0 #if 0
fprintf (stderr, "%s%s:", col_name (min_col), row_name (first_row)); g_printerr ("%s%s:", col_name (min_col), row_name (first_row));
fprintf (stderr, "%s%s\n", col_name (max_col), row_name (last_row)); g_printerr ("%s%s\n", col_name (max_col), row_name (last_row));
#endif #endif
if (sheet->text_is_rtl) { if (sheet->text_is_rtl) {
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include <stdio.h>
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
......
...@@ -5,14 +5,14 @@ ...@@ -5,14 +5,14 @@
#define __FUNCTION__ __FILE__ #define __FUNCTION__ __FILE__
#endif #endif
#define gnm_simple_canvas_grab(a,b,c,d) do { \ #define gnm_simple_canvas_grab(a,b,c,d) do { \
fprintf (stderr, "%s %d: grab "GNUMERIC_ITEM" %p\n", \ g_printerr ("%s %d: grab "GNUMERIC_ITEM" %p\n", \
__FUNCTION__, __LINE__, a); \ __FUNCTION__, __LINE__, a); \
gnm_simple_canvas_grab (a, b, c,d); \ gnm_simple_canvas_grab (a, b, c,d); \
} while (0) } while (0)
#define gnm_simple_canvas_ungrab(a,b) do { \ #define gnm_simple_canvas_ungrab(a,b) do { \
fprintf (stderr, "%s %d: ungrab "GNUMERIC_ITEM" %p\n", \ g_printerr ("%s %d: ungrab "GNUMERIC_ITEM" %p\n", \
__FUNCTION__, __LINE__, a); \ __FUNCTION__, __LINE__, a); \
gnm_simple_canvas_ungrab (a, b); \ gnm_simple_canvas_ungrab (a, b); \
} while (0) } while (0)
#endif #endif
......
...@@ -57,7 +57,6 @@ ...@@ -57,7 +57,6 @@
#include <math.h> #include <math.h>
#include <errno.h> #include <errno.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <float.h> #include <float.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
......
...@@ -21,8 +21,6 @@ ...@@ -21,8 +21,6 @@
#include <goffice/utils/go-glib-extras.h> #include <goffice/utils/go-glib-extras.h>
#include <goffice/utils/go-font.h> #include <goffice/utils/go-font.h>
#include <stdio.h>
#define DEBUG_STYLES #define DEBUG_STYLES
#ifndef USE_MSTYLE_POOL #ifndef USE_MSTYLE_POOL
#define USE_MSTYLE_POOL 1 #define USE_MSTYLE_POOL 1
...@@ -1628,22 +1626,22 @@ static void ...@@ -1628,22 +1626,22 @@ static void
gnm_style_dump_color (GnmColor *color, GnmStyleElement elem) gnm_style_dump_color (GnmColor *color, GnmStyleElement elem)
{ {
if (color) if (color)
fprintf (stderr, "\t%s: %hx:%hx:%hx\n", gnm_style_element_name [elem], g_printerr ("\t%s: %hx:%hx:%hx\n", gnm_style_element_name [elem],
color->gdk_color.red, color->gdk_color.red,
color->gdk_color.green, color->gdk_color.green,
color->gdk_color.blue); color->gdk_color.blue);
else else
fprintf (stderr, "\t%s: (NULL)\n", gnm_style_element_name [elem]); g_printerr ("\t%s: (NULL)\n", gnm_style_element_name [elem]);
} }
static void static void
gnm_style_dump_border (GnmBorder *border, GnmStyleElement elem) gnm_style_dump_border (GnmBorder *border, GnmStyleElement elem)
{ {
fprintf (stderr, "\t%s: ", gnm_style_element_name[elem]); g_printerr ("\t%s: ", gnm_style_element_name[elem]);
if (border) if (border)
fprintf (stderr, "%d\n", border->line_type); g_printerr ("%d\n", border->line_type);
else else
fprintf (stderr, "blank\n"); g_printerr ("blank\n");
} }
void void
...@@ -1651,7 +1649,7 @@ gnm_style_dump (GnmStyle const *style) ...@@ -1651,7 +1649,7 @@ gnm_style_dump (GnmStyle const *style)
{ {
int i; int i;
fprintf (stderr, "Style Refs %d\n", style->ref_count); g_printerr ("Style Refs %d\n", style->ref_count);
if (elem_is_set (style, MSTYLE_COLOR_BACK)) if (elem_is_set (style, MSTYLE_COLOR_BACK))
gnm_style_dump_color (style->color.back, MSTYLE_COLOR_BACK); gnm_style_dump_color (style->color.back, MSTYLE_COLOR_BACK);
if (elem_is_set (style, MSTYLE_COLOR_PATTERN)) if (elem_is_set (style, MSTYLE_COLOR_PATTERN))
...@@ -1662,70 +1660,70 @@ gnm_style_dump (GnmStyle const *style) ...@@ -1662,70 +1660,70 @@ gnm_style_dump (GnmStyle const *style)
gnm_style_dump_border (style->borders[i-MSTYLE_BORDER_TOP], i); gnm_style_dump_border (style->borders[i-MSTYLE_BORDER_TOP], i);
if (elem_is_set (style, MSTYLE_PATTERN)) if (elem_is_set (style, MSTYLE_PATTERN))
fprintf (stderr, "\tpattern %d\n", style->pattern); g_printerr ("\tpattern %d\n", style->pattern);
if (elem_is_set (style, MSTYLE_FONT_COLOR)) if (elem_is_set (style, MSTYLE_FONT_COLOR))
gnm_style_dump_color (style->color.font, MSTYLE_FONT_COLOR); gnm_style_dump_color (style->color.font, MSTYLE_FONT_COLOR);
if (elem_is_set (style, MSTYLE_FONT_NAME)) if (elem_is_set (style, MSTYLE_FONT_NAME))
fprintf (stderr, "\tname '%s'\n", style->font_detail.name->str); g_printerr ("\tname '%s'\n", style->font_detail.name->str);
if (elem_is_set (style, MSTYLE_FONT_BOLD)) if (elem_is_set (style, MSTYLE_FONT_BOLD))
fprintf (stderr, style->font_detail.bold ? "\tbold\n" : "\tnot bold\n"); g_printerr (style->font_detail.bold ? "\tbold\n" : "\tnot bold\n");
if (elem_is_set (style, MSTYLE_FONT_ITALIC)) if (elem_is_set (style, MSTYLE_FONT_ITALIC))
fprintf (stderr, style->font_detail.italic ? "\titalic\n" : "\tnot italic\n"); g_printerr (style->font_detail.italic ? "\titalic\n" : "\tnot italic\n");
if (elem_is_set (style, MSTYLE_FONT_UNDERLINE)) if (elem_is_set (style, MSTYLE_FONT_UNDERLINE))
switch (style->font_detail.underline) { switch (style->font_detail.underline) {
default : default :
case UNDERLINE_NONE : case UNDERLINE_NONE :
fprintf (stderr, "\tno underline\n"); break; g_printerr ("\tno underline\n"); break;
case UNDERLINE_SINGLE : case UNDERLINE_SINGLE :
fprintf (stderr, "\tsingle underline\n"); break; g_printerr ("\tsingle underline\n"); break;
case UNDERLINE_DOUBLE : case UNDERLINE_DOUBLE :
fprintf (stderr, "\tdouble underline\n"); break; g_printerr ("\tdouble underline\n"); break;
} }
if (elem_is_set (style, MSTYLE_FONT_STRIKETHROUGH)) if (elem_is_set (style, MSTYLE_FONT_STRIKETHROUGH))
fprintf (stderr, style->font_detail.strikethrough ? "\tstrikethrough\n" : "\tno strikethrough\n"); g_printerr (style->font_detail.strikethrough ? "\tstrikethrough\n" : "\tno strikethrough\n");
if (elem_is_set (style, MSTYLE_FONT_SCRIPT)) if (elem_is_set (style, MSTYLE_FONT_SCRIPT))
switch (style->font_detail.script) { switch (style->font_detail.script) {
case GO_FONT_SCRIPT_SUB : case GO_FONT_SCRIPT_SUB :
fprintf (stderr, "\tsubscript\n"); break; g_printerr ("\tsubscript\n"); break;
default : default :
case GO_FONT_SCRIPT_STANDARD : case GO_FONT_SCRIPT_STANDARD :
fprintf (stderr, "\tno super or sub\n"); break; g_printerr ("\tno super or sub\n"); break;
case GO_FONT_SCRIPT_SUPER : case GO_FONT_SCRIPT_SUPER :
fprintf (stderr, "\tsuperscript\n"); break; g_printerr ("\tsuperscript\n"); break;
} }
if (elem_is_set (style, MSTYLE_FONT_SIZE)) if (elem_is_set (style, MSTYLE_FONT_SIZE))
fprintf (stderr, "\tsize %f\n", style->font_detail.size); g_printerr ("\tsize %f\n", style->font_detail.size);
if (elem_is_set (style, MSTYLE_FORMAT)) { if (elem_is_set (style, MSTYLE_FORMAT)) {
char *fmt = go_format_as_XL (style->format, FALSE); char *fmt = go_format_as_XL (style->format, FALSE);
fprintf (stderr, "\tformat '%s'\n", fmt); g_printerr ("\tformat '%s'\n", fmt);
g_free (fmt); g_free (fmt);
} }
if (elem_is_set (style, MSTYLE_ALIGN_V)) if (elem_is_set (style, MSTYLE_ALIGN_V))
fprintf (stderr, "\tvalign %hd\n", style->v_align); g_printerr ("\tvalign %hd\n", style->v_align);
if (elem_is_set (style, MSTYLE_ALIGN_H)) if (elem_is_set (style, MSTYLE_ALIGN_H))
fprintf (stderr, "\thalign %hd\n", style->h_align); g_printerr ("\thalign %hd\n", style->h_align);
if (elem_is_set (style, MSTYLE_INDENT)) if (elem_is_set (style, MSTYLE_INDENT))
fprintf (stderr, "\tindent %d\n", style->indent); g_printerr ("\tindent %d\n", style->indent);
if (elem_is_set (style, MSTYLE_ROTATION)) if (elem_is_set (style, MSTYLE_ROTATION))
fprintf (stderr, "\trotation %d\n", style->rotation); g_printerr ("\trotation %d\n", style->rotation);
if (elem_is_set (style, MSTYLE_TEXT_DIR)) if (elem_is_set (style, MSTYLE_TEXT_DIR))
fprintf (stderr, "\ttext dir %d\n", style->text_dir); g_printerr ("\ttext dir %d\n", style->text_dir);
if (elem_is_set (style, MSTYLE_WRAP_TEXT)) if (elem_is_set (style, MSTYLE_WRAP_TEXT))
fprintf (stderr, "\twrap text %d\n", style->wrap_text); g_printerr ("\twrap text %d\n", style->wrap_text);
if (elem_is_set (style, MSTYLE_SHRINK_TO_FIT)) if (elem_is_set (style, MSTYLE_SHRINK_TO_FIT))
fprintf (stderr, "\tshrink to fit %d\n", style->shrink_to_fit); g_printerr ("\tshrink to fit %d\n", style->shrink_to_fit);
if (elem_is_set (style, MSTYLE_CONTENTS_LOCKED)) if (elem_is_set (style, MSTYLE_CONTENTS_LOCKED))
fprintf (stderr, "\tlocked %d\n", style->contents_locked); g_printerr ("\tlocked %d\n", style->contents_locked);
if (elem_is_set (style, MSTYLE_CONTENTS_HIDDEN)) if (elem_is_set (style, MSTYLE_CONTENTS_HIDDEN))
fprintf (stderr, "\thidden %d\n", style->contents_hidden); g_printerr ("\thidden %d\n", style->contents_hidden);
if (elem_is_set (style, MSTYLE_VALIDATION)) if (elem_is_set (style, MSTYLE_VALIDATION))
fprintf (stderr, "\tvalidation %p\n", style->validation); g_printerr ("\tvalidation %p\n", style->validation);
if (elem_is_set (style, MSTYLE_HLINK)) if (elem_is_set (style, MSTYLE_HLINK))
fprintf (stderr, "\thlink %p\n", style->hlink); g_printerr ("\thlink %p\n", style->hlink);
if (elem_is_set (style, MSTYLE_INPUT_MSG)) if (elem_is_set (style, MSTYLE_INPUT_MSG))
fprintf (stderr, "\tinput msg %p\n", style->input_msg); g_printerr ("\tinput msg %p\n", style->input_msg);
if (elem_is_set (style, MSTYLE_CONDITIONS)) if (elem_is_set (style, MSTYLE_CONDITIONS))
fprintf (stderr, "\tconditions %p\n", style->conditions); g_printerr ("\tconditions %p\n", style->conditions);
} }
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
...@@ -1746,7 +1744,7 @@ static void ...@@ -1746,7 +1744,7 @@ static void
cb_gnm_style_pool_leak (gpointer data, gpointer user) cb_gnm_style_pool_leak (gpointer data, gpointer user)
{ {
GnmStyle *style = data; GnmStyle *style = data;
fprintf (stderr, "Leaking style at %p.\n", style); g_printerr ("Leaking style at %p.\n", style);
gnm_style_dump (style); gnm_style_dump (style);
} }
#endif #endif
......
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
#include <errno.h> #include <errno.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>