[gnumeric] Compilation: don't use printf in C code.



commit 13d0e122b6b5dab7ff73f8f3d42abd20f7d8c700
Author: Morten Welinder <terra gnome org>
Date:   Fri Dec 28 16:20:42 2012 -0500

    Compilation: don't use printf in C code.
    
    Use g_printerr.

 ChangeLog                        |    2 +
 plugins/fn-derivatives/options.c |    2 +-
 plugins/fn-financial/functions.c |    4 +-
 src/colrow.c                     |    2 +-
 src/func.c                       |    2 +-
 src/gnm-random.c                 |   12 +++++-----
 src/mstyle.c                     |    2 +-
 src/number-match-test.c          |   39 --------------------------------------
 src/parser.y                     |    2 +-
 src/wbc-gtk.c                    |    2 +-
 10 files changed, 16 insertions(+), 53 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c4e9a65..642b6d3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2012-12-28  Morten Welinder  <terra gnome org>
 
+	* src/*.c: Eliminate use of printf.
+
 	* src/sheet-style.c (sheet_style_range_foreach): Move handling of
 	range offset here.  This may need to move further.
 	* src/ssdiff.c (cb_diff_sheets_styles_2): From here.
diff --git a/plugins/fn-derivatives/options.c b/plugins/fn-derivatives/options.c
index 675415f..925a65b 100644
--- a/plugins/fn-derivatives/options.c
+++ b/plugins/fn-derivatives/options.c
@@ -1937,7 +1937,7 @@ opt_binomial(GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 
 	for (j = n - 1; j > -1; --j) {
 		for (i = 0; i <= j; ++i) {
-			/*if (0==i)printf("secondloop %d\n",j);*/
+			/*if (0==i)g_printerr("secondloop %d\n",j);*/
 			if (OT_Euro == amer_euro_flag)
 				value_array[i] = (p * value_array[i + 1] + (1.0 - p) * value_array[i]) * Df;
 			else if (OT_Amer == amer_euro_flag) {
diff --git a/plugins/fn-financial/functions.c b/plugins/fn-financial/functions.c
index 56e0363..e615866 100644
--- a/plugins/fn-financial/functions.c
+++ b/plugins/fn-financial/functions.c
@@ -1262,7 +1262,7 @@ gnumeric_rate (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 		return value_new_error_VALUE (ei->pos);
 
 #if 0
-	printf ("Guess = %.15g\n", rate0);
+	g_printerr ("Guess = %.15g\n", rate0);
 #endif
 	goal_seek_initialize (&data);
 
@@ -1292,7 +1292,7 @@ gnumeric_rate (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 
 	if (status == GOAL_SEEK_OK) {
 #if 0
-		printf ("Root = %.15g\n\n", data.root);
+		g_printerr ("Root = %.15g\n\n", data.root);
 #endif
 		return value_new_float (data.root);
 	} else
diff --git a/src/colrow.c b/src/colrow.c
index 7fcb49f..67be14c 100644
--- a/src/colrow.c
+++ b/src/colrow.c
@@ -971,7 +971,7 @@ colrow_visibility (Sheet const *sheet, ColRowVisiblity * const dat,
 		res->first = (j >= first) ? j+1 : first;
 		res->last = i;
 #if 0
-		printf ("%d %d\n", res->index, res->count);
+		g_printerr ("%d %d\n", res->index, res->count);
 #endif
 		dat->elements = g_slist_insert_sorted (dat->elements, res,
 					(GCompareFunc)colrow_index_cmp);
diff --git a/src/func.c b/src/func.c
index 8b6bf34..d111d8c 100644
--- a/src/func.c
+++ b/src/func.c
@@ -237,7 +237,7 @@ function_dump_defs (char const *filename, int dump_type)
 	g_return_if_fail (filename != NULL);
 
 	if ((output_file = g_fopen (filename, "w")) == NULL){
-		printf (_("Cannot create file %s\n"), filename);
+		g_printerr (_("Cannot create file %s\n"), filename);
 		exit (1);
 	}
 
diff --git a/src/gnm-random.c b/src/gnm-random.c
index 42e7dbc..a83991f 100644
--- a/src/gnm-random.c
+++ b/src/gnm-random.c
@@ -219,15 +219,15 @@ int main(void)
     int i;
     unsigned long init[4]={0x123, 0x234, 0x345, 0x456}, length=4;
     init_by_array(init, length);
-    printf("1000 outputs of genrand_int32()\n");
+    g_printerr("1000 outputs of genrand_int32()\n");
     for (i=0; i<1000; i++) {
-      printf("%10lu ", genrand_int32());
-      if (i%5==4) printf("\n");
+      g_printerr("%10lu ", genrand_int32());
+      if (i%5==4) g_printerr("\n");
     }
-    printf("\n1000 outputs of genrand_real2()\n");
+    g_printerr("\n1000 outputs of genrand_real2()\n");
     for (i=0; i<1000; i++) {
-      printf("%10.8f ", genrand_real2());
-      if (i%5==4) printf("\n");
+      g_printerr("%10.8f ", genrand_real2());
+      if (i%5==4) g_printerr("\n");
     }
     return 0;
 }
diff --git a/src/mstyle.c b/src/mstyle.c
index d0afd33..e5cc8f5 100644
--- a/src/mstyle.c
+++ b/src/mstyle.c
@@ -131,7 +131,7 @@ gnm_style_element_name[MSTYLE_ELEMENT_MAX] = {
 
 /* Some ref/link count debugging */
 #if 0
-#define d(arg)	printf arg
+#define d(arg)	g_printerr arg
 #else
 #define d(arg)	do { } while (0)
 #endif
diff --git a/src/parser.y b/src/parser.y
index 417924d..862ceb0 100644
--- a/src/parser.y
+++ b/src/parser.y
@@ -1496,7 +1496,7 @@ int
 yyerror (char const *s)
 {
 #if 0
-	printf ("Error: %s\n", s);
+	g_printerr ("Error: %s\n", s);
 #endif
 	return 0;
 }
diff --git a/src/wbc-gtk.c b/src/wbc-gtk.c
index 854797e..af5b65c 100644
--- a/src/wbc-gtk.c
+++ b/src/wbc-gtk.c
@@ -2582,7 +2582,7 @@ cb_wbcg_drag_data_received (GtkWidget *widget, GdkDragContext *context,
 	} else {
 		GtkWidget *source_widget = gtk_drag_get_source_widget (context);
 		if (wbcg_is_local_drag (wbcg, source_widget))
-			printf ("autoscroll complete - stop it\n");
+			g_printerr ("autoscroll complete - stop it\n");
 		else
 			scg_drag_data_received (wbcg_cur_scg (wbcg),
 				source_widget, 0, 0, selection_data);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]