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>
* src/workbook-edit.c (wbcg_edit_start): If formatting as date
......
......@@ -5,6 +5,7 @@ Morten:
* Fix gui problems after replacing pristine book. [#410365] [#410371].
* Fix R1C1 preventing the use of, e.g., COS and RADIANS. [#410609]
* Fix editing of out-of-range numbers with date format.
* Improve CopyDown and CopyRight. [#112847]
Oliver Burnett-Hall:
* Fix R1C1 problem in formula guru.
......
......@@ -695,7 +695,7 @@ SAVE_CFLAGS=$CFLAGS
SAVE_LIBS=$LIBS
CFLAGS="$CFLAGS $GNUMERIC_CFLAGS"
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
LIBS=$SAVE_LIBS
......
......@@ -9,7 +9,6 @@
*/
#include <gnumeric-config.h>
#include <glib/gi18n-lib.h>
#include <stdio.h>
#include "gnumeric.h"
#include "command-context-stderr.h"
#include <gsf/gsf-impl-utils.h>
......@@ -55,7 +54,7 @@ ccs_error_error (GOCmdContext *cc, GError *error)
{
CmdContextStderr *ccs = COMMAND_CONTEXT_STDERR (cc);
fprintf (stderr, "Error: %s\n", error->message);
g_printerr ("Error: %s\n", error->message);
ccs->status = -1;
}
static void
......
......@@ -4,7 +4,7 @@
* commands.c: Handlers to undo & redo commands
*
* 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)
* Andreas J. Guelzow (aguelzow@taliesin.ca)
......@@ -653,7 +653,7 @@ truncate_undo_info (Workbook *wb)
max_num = gnm_app_prefs->undo_max_number;
#ifdef DEBUG_TRUNCATE_UNDO
fprintf (stderr, "Undo sizes:");
g_printerr ("Undo sizes:");
#endif
for (l = wb->undo_commands, prev = NULL, ok_count = 0;
......@@ -673,7 +673,7 @@ truncate_undo_info (Workbook *wb)
}
#ifdef DEBUG_TRUNCATE_UNDO
fprintf (stderr, " %d", size);
g_printerr (" %d", size);
#endif
/* Keep at least one undo item. */
......@@ -685,7 +685,7 @@ truncate_undo_info (Workbook *wb)
else
wb->undo_commands = NULL;
#ifdef DEBUG_TRUNCATE_UNDO
fprintf (stderr, "[trunc]\n");
g_printerr ("[trunc]\n");
#endif
return ok_count;
}
......@@ -699,7 +699,7 @@ truncate_undo_info (Workbook *wb)
}
#ifdef DEBUG_TRUNCATE_UNDO
fprintf (stderr, "\n");
g_printerr ("\n");
#endif
return -1;
}
......@@ -3327,7 +3327,7 @@ cmd_autofill (WorkbookControl *wbc, Sheet *sheet,
typedef struct {
GnmCommand cmd;
GnmCellRegion *contents;
GOUndo *undo;
GnmPasteTarget dst, src;
int dx, dy;
char const *name;
......@@ -3345,18 +3345,12 @@ static gboolean
cmd_copyrel_undo (GnmCommand *cmd, WorkbookControl *wbc)
{
CmdCopyRel *me = CMD_COPYREL (cmd);
gboolean res;
g_return_val_if_fail (wbc != NULL, TRUE);
g_return_val_if_fail (me != NULL, TRUE);
g_return_val_if_fail (me->contents != NULL, TRUE);
res = clipboard_paste_region (me->contents, &me->dst, GO_CMD_CONTEXT (wbc));
cellregion_unref (me->contents);
me->contents = NULL;
g_return_val_if_fail (me->undo != NULL, TRUE);
if (res)
return TRUE;
go_undo_undo (me->undo);
/* Select the newly pasted contents (this queues a redraw) */
select_range (me->dst.sheet, &me->dst.range, wbc);
......@@ -3372,11 +3366,6 @@ cmd_copyrel_redo (GnmCommand *cmd, WorkbookControl *wbc)
gboolean res;
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,
me->dst.range.start.col, me->dst.range.start.row,
......@@ -3405,10 +3394,9 @@ cmd_copyrel_finalize (GObject *cmd)
{
CmdCopyRel *me = CMD_COPYREL (cmd);
if (me->contents) {
cellregion_unref (me->contents);
me->contents = NULL;
}
if (me->undo)
g_object_unref (me->undo);
gnm_command_finalize (cmd);
}
......@@ -3421,18 +3409,34 @@ cmd_copyrel (WorkbookControl *wbc,
GnmRange target, src;
SheetView *sv = wb_control_cur_sheet_view (wbc);
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;
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 ||
src.start.row < 0 || src.start.row >= SHEET_MAX_ROWS)
return FALSE;
......@@ -3444,7 +3448,6 @@ cmd_copyrel (WorkbookControl *wbc,
me = g_object_new (CMD_COPYREL_TYPE, NULL);
me->contents = NULL;
me->dst.sheet = sheet;
me->dst.paste_flags = PASTE_CONTENTS | PASTE_FORMATS;
me->dst.range = target;
......@@ -3454,6 +3457,7 @@ cmd_copyrel (WorkbookControl *wbc,
me->dx = dx;
me->dy = dy;
me->name = name;
me->undo = clipboard_copy_range_undo (me->dst.sheet, &me->dst.range);
me->cmd.sheet = sheet;
me->cmd.size = 1;
......
......@@ -25,7 +25,6 @@
#include <gsf/gsf-impl-utils.h>
#include <gtk/gtkmain.h>
#include <stdio.h>
#include <stdlib.h>
#define PARENT_TYPE (G_TYPE_OBJECT)
......
......@@ -3,7 +3,6 @@
#include "gnumeric.h"
#include <goffice/utils/goffice-utils.h>
#include <stdio.h>
struct _GnmDependent {
guint flags;
......
......@@ -58,7 +58,6 @@
#include <gtk/gtkmenuitem.h>
#include <gsf/gsf-impl-utils.h>
#include <gdk/gdkkeysyms.h>
#include <stdio.h>
#define CELL_SORT_KEY "cell-sort-dialog"
......
......@@ -57,7 +57,6 @@
#include <gtk/gtkcelllayout.h>
#include <gtk/gtkcellrenderertext.h>
/*#include <gtk/gtkmenuitem.h>*/
#include <stdio.h>
/* FIXME: do not hardcode pixel counts. */
#define PREVIEW_X 170
......
......@@ -53,7 +53,6 @@
#include <gtk/gtkicontheme.h>
#include <gtk/gtkbox.h>
#include <string.h>
#include <stdio.h>
#define SHEET_ORDER_KEY "sheet-order-dialog"
......
......@@ -2999,7 +2999,7 @@ cb_expression_pool_leak (gpointer data, G_GNUC_UNUSED gpointer user)
pp.sheet = NULL;
pp.wb = NULL;
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);
}
#endif
......
......@@ -101,7 +101,7 @@ check_name_match (char const *name, char const *description, char const *tag)
char *desc_name, *up_name;
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;
}
......@@ -111,7 +111,7 @@ check_name_match (char const *name, char const *description, char const *tag)
desc_name = g_strndup (description, tmp-description);
up_name = g_ascii_strup (name, -1);
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 (desc_name);
return NULL;
......@@ -150,14 +150,14 @@ cb_generate_po (gpointer key, Symbol *sym, gpointer array)
return;
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;
}
if (NULL == (tmp = strstr (ptr, "@EXAMPLES="))) {
return;
}
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;
}
}
......
......@@ -32,7 +32,6 @@
#include <goffice/utils/go-locale.h>
#include <glib/gi18n-lib.h>
#include <string.h>
#include <stdio.h>
#include <style-font.h>
static char const *
......
......@@ -1101,8 +1101,8 @@ gnm_canvas_redraw_range (GnmCanvas *gcanvas, GnmRange const *r)
: INT_MAX;
#if 0
fprintf (stderr, "%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:", col_name (min_col), row_name (first_row));
g_printerr ("%s%s\n", col_name (max_col), row_name (last_row));
#endif
if (sheet->text_is_rtl) {
......
......@@ -22,7 +22,6 @@
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
......
......@@ -5,14 +5,14 @@
#define __FUNCTION__ __FILE__
#endif
#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); \
gnm_simple_canvas_grab (a, b, c,d); \
} while (0)
#define gnm_simple_canvas_ungrab(a,b) do { \
fprintf (stderr, "%s %d: ungrab "GNUMERIC_ITEM" %p\n", \
__FUNCTION__, __LINE__, a); \
gnm_simple_canvas_ungrab (a, b); \
#define gnm_simple_canvas_ungrab(a,b) do { \
g_printerr ("%s %d: ungrab "GNUMERIC_ITEM" %p\n", \
__FUNCTION__, __LINE__, a); \
gnm_simple_canvas_ungrab (a, b); \
} while (0)
#endif
......
......@@ -57,7 +57,6 @@
#include <math.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <float.h>
#include <fcntl.h>
#include <unistd.h>
......
......@@ -21,8 +21,6 @@
#include <goffice/utils/go-glib-extras.h>
#include <goffice/utils/go-font.h>
#include <stdio.h>
#define DEBUG_STYLES
#ifndef USE_MSTYLE_POOL
#define USE_MSTYLE_POOL 1
......@@ -1628,22 +1626,22 @@ static void
gnm_style_dump_color (GnmColor *color, GnmStyleElement elem)
{
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.green,
color->gdk_color.blue);
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
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)
fprintf (stderr, "%d\n", border->line_type);
g_printerr ("%d\n", border->line_type);
else
fprintf (stderr, "blank\n");
g_printerr ("blank\n");
}
void
......@@ -1651,7 +1649,7 @@ gnm_style_dump (GnmStyle const *style)
{
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))
gnm_style_dump_color (style->color.back, MSTYLE_COLOR_BACK);
if (elem_is_set (style, MSTYLE_COLOR_PATTERN))
......@@ -1662,70 +1660,70 @@ gnm_style_dump (GnmStyle const *style)
gnm_style_dump_border (style->borders[i-MSTYLE_BORDER_TOP], i);
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))
gnm_style_dump_color (style->color.font, MSTYLE_FONT_COLOR);
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))
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))
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))
switch (style->font_detail.underline) {
default :
case UNDERLINE_NONE :
fprintf (stderr, "\tno underline\n"); break;
g_printerr ("\tno underline\n"); break;
case UNDERLINE_SINGLE :
fprintf (stderr, "\tsingle underline\n"); break;
g_printerr ("\tsingle underline\n"); break;
case UNDERLINE_DOUBLE :
fprintf (stderr, "\tdouble underline\n"); break;
g_printerr ("\tdouble underline\n"); break;
}
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))
switch (style->font_detail.script) {
case GO_FONT_SCRIPT_SUB :
fprintf (stderr, "\tsubscript\n"); break;
g_printerr ("\tsubscript\n"); break;
default :
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 :
fprintf (stderr, "\tsuperscript\n"); break;
g_printerr ("\tsuperscript\n"); break;
}
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)) {
char *fmt = go_format_as_XL (style->format, FALSE);
fprintf (stderr, "\tformat '%s'\n", fmt);
g_printerr ("\tformat '%s'\n", fmt);
g_free (fmt);
}
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))
fprintf (stderr, "\thalign %hd\n", style->h_align);
g_printerr ("\thalign %hd\n", style->h_align);
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))
fprintf (stderr, "\trotation %d\n", style->rotation);
g_printerr ("\trotation %d\n", style->rotation);
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))
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))
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))
fprintf (stderr, "\tlocked %d\n", style->contents_locked);
g_printerr ("\tlocked %d\n", style->contents_locked);
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))
fprintf (stderr, "\tvalidation %p\n", style->validation);
g_printerr ("\tvalidation %p\n", style->validation);
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))
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))
fprintf (stderr, "\tconditions %p\n", style->conditions);
g_printerr ("\tconditions %p\n", style->conditions);
}
/* ------------------------------------------------------------------------- */
......@@ -1746,7 +1744,7 @@ static void
cb_gnm_style_pool_leak (gpointer data, gpointer user)
{
GnmStyle *style = data;
fprintf (stderr, "Leaking style at %p.\n", style);
g_printerr ("Leaking style at %p.\n", style);
gnm_style_dump (style);
}
#endif
......
......@@ -44,7 +44,6 @@
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <glib.h>
#include <string.h>
......
......@@ -25,10 +25,10 @@
#include "gnumeric-gconf.h"
#include <stdlib.h>
#include <stdio.h>
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <string.h>
#include <stdio.h>
#undef RANGE_DEBUG
......@@ -170,29 +170,29 @@ range_dump (GnmRange const *src, char const *suffix)
* keep these as 2 print statements, because
* col_name and row_name use a static buffer
*/
fprintf (stderr, "%s%s",
g_printerr ("%s%s",
col_name (src->start.col),
row_name (src->start.row));
if (src->start.col != src->end.col ||
src->start.row != src->end.row)
fprintf (stderr, ":%s%s",
g_printerr (":%s%s",
col_name (src->end.col),
row_name (src->end.row));
fprintf (stderr, suffix);
g_printerr (suffix);
}
#ifdef RANGE_DEBUG
static void
ranges_dump (GList *l, char const *txt)
{
fprintf (stderr, "%s: ", txt);
g_printerr ("%s: ", txt);
for (; l; l = l->next) {
range_dump (l->data, "");
if (l->next)
fprintf (stderr, ", ");
g_printerr (", ");
}
fprintf (stderr, "\n");
g_printerr ("\n");
}
#endif
......
......@@ -16,7 +16,6 @@
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#undef DEBUG_NEAR_SINGULAR
......@@ -54,8 +53,8 @@
for (_i = 0; _i < _d1; _i++) \
{ \
for (_j = 0; _j < _d2; _j++) \
fprintf (stderr, " %19.10" GNM_FORMAT_g, (var)[_i][_j]); \
fprintf (stderr, "\n"); \
g_printerr (" %19.10" GNM_FORMAT_g, (var)[_i][_j]); \
g_printerr ("\n"); \
} \
} while (0)
......@@ -118,8 +117,8 @@ rescale (gnm_float **A, gnm_float *b, int n, gnm_float *pdet)
(void)gnm_frexp (gnm_sqrt (max), &expn);
scale = gnm_ldexp (1, expn);
#ifdef DEBUG_NEAR_SINGULAR
printf ("scale[%d]=%" GNM_FORMAT_g "\n",
i, scale);
g_print ("scale[%d]=%" GNM_FORMAT_g "\n",
i, scale);
#endif
*pdet *= scale;
......@@ -180,8 +179,8 @@ LUPDecomp (gnm_float **A, gnm_float **LU, int *P, int n, gnm_float *b_scaled,
}
#ifdef DEBUG_NEAR_SINGULAR
PRINT_MATRIX (LU, n, n);
printf ("max[%d]=%" GNM_FORMAT_g " at %d\n",
i, max, mov);
g_print ("max[%d]=%" GNM_FORMAT_g " at %d\n",
i, max, mov);
#endif
if (max == 0)
return REG_singular;
......@@ -218,7 +217,7 @@ LUPDecomp (gnm_float **A, gnm_float **LU, int *P, int n, gnm_float *b_scaled,
cond = (gnm_log (highest) - gnm_log (lowest)) / gnm_log (2);
#ifdef DEBUG_NEAR_SINGULAR
printf ("cond=%.20" GNM_FORMAT_g "\n", cond);
g_print ("cond=%.20" GNM_FORMAT_g "\n", cond);
#endif
/* FIXME: make some science out of this. */
......@@ -1003,9 +1002,9 @@ derivative (RegressionFunction f,
}
#ifdef DEBUG
printf ("y1 = %lf\n", y1);
printf ("y2 = %lf\n", y2);
printf ("DELTA = %lf\n",DELTA);
g_print ("y1 = %lf\n", y1);
g_print ("y2 = %lf\n", y2);
g_print ("DELTA = %lf\n",DELTA);
#endif
*df = (y2 - y1) / (2 * DELTA);
......@@ -1096,9 +1095,9 @@ chi_derivative (RegressionFunction f,
}
#ifdef DEBUG
printf ("y1 = %lf\n", y1);
printf ("y2 = %lf\n", y2);
printf ("DELTA = %lf\n", DELTA);
g_print ("y1 = %lf\n", y1);
g_print ("y2 = %lf\n", y2);
g_print ("DELTA = %lf\n", DELTA);
#endif
*dchi = (y2 - y1) / (2 * DELTA);
......@@ -1280,7 +1279,7 @@ non_linear_regression (RegressionFunction f,
tmp_par = g_new (gnm_float, p_dim);
b = g_new (gnm_float, p_dim);
#ifdef DEBUG
printf ("Chi Squared : %lf", chi_pre);
g_print ("Chi Squared : %lf", chi_pre);
#endif
for (count = 0; count < MAX_STEPS; count++) {
......@@ -1317,9 +1316,9 @@ non_linear_regression (RegressionFunction f,
goto out;
#ifdef DEBUG
printf ("Chi Squared : %lf", chi_pre);
printf ("Chi Squared : %lf", chi_pos);
printf ("r : %lf", r);
g_print ("Chi Squared : %lf", chi_pre);
g_print ("Chi Squared : %lf", chi_pos);
g_print ("r : %lf", r);
#endif
if (chi_pos <= chi_pre + DELTA / 2) {
......
......@@ -512,11 +512,11 @@ gnm_rendered_value_init (void)
#if USE_RV_POOLS
static void
cb_rendered_value_pool_leak (gpointer data, gpointer user)
cb_rendered_value_pool_leak (gpointer data, G_GNUC_UNUSED gpointer user)
{
GnmRenderedValue *rendered_value = data;
fprintf (stderr, "Leaking rendered value at %p [%s].\n",
rendered_value, pango_layout_get_text (rendered_value->layout));
g_printerr ("Leaking rendered value at %p [%s].\n",
rendered_value, pango_layout_get_text (rendered_value->layout));
}
#endif
......
......@@ -679,7 +679,7 @@ selection_get_ranges (SheetView const *sv, gboolean allow_intersection)
#undef DEBUG_SELECTION
#ifdef DEBUG_SELECTION
fprintf (stderr, "============================\n");
g_printerr ("============================\n");
#endif
/*
......@@ -718,7 +718,7 @@ selection_get_ranges (SheetView const *sv, gboolean allow_intersection)
}
#ifdef DEBUG_SELECTION
fprintf (stderr, "a = ");
g_printerr ("a = ");
range_dump (a, "; b = ");
range_dump (b, "\n");
#endif
......@@ -728,14 +728,14 @@ selection_get_ranges (SheetView const *sv, gboolean allow_intersection)
b->start.col, b->end.col);
#ifdef DEBUG_SELECTION
fprintf (stderr, "col = %d\na = %s", col_intersect, col_name(a->start.col));
g_printerr ("col = %d\na = %s", col_intersect, col_name(a->start.col));
if (a->start.col != a->end.col)
fprintf (stderr, " -> %s", col_name(a->end.col));
fprintf (stderr, "\nb = %s", col_name(b->start.col));
g_printerr (" -> %s", col_name(a->end.col));
g_printerr ("\nb = %s", col_name(b->start.col));
if (b->start.col != b->end.col)
fprintf (stderr, " -> %s\n", col_name(b->end.col));
g_printerr (" -> %s\n", col_name(b->end.col));
else
fputc ('\n', stderr);
g_printerr ("\n");
#endif
/* No intersection */
......@@ -748,14 +748,14 @@ selection_get_ranges (SheetView const *sv, gboolean allow_intersection)
segments_intersect (a->start.row, a->end.row,
b->start.row, b->end.row);
#ifdef DEBUG_SELECTION
fprintf (stderr, "row = %d\na = %s", row_intersect, row_name (a->start.row));
g_printerr ("row = %d\na = %s", row_intersect, row_name (a->start.row));
if (a->start.row != a->end.row)
fprintf (stderr, " -> %s", row_name (a->end.row));
fprintf (stderr, "\nb = %s", row_name (b->start.row));
g_printerr (" -> %s", row_name (a->end.row));