Package: recutils / 1.7-1.1

csv2rec-format-warning.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From: Daiki Ueno
Reviewed-by: Jose E. Marchesi <jemarch@gnu.org>
Subject: Fix printf template slots to avoid warnings when compiled with -Wformat
Origin: upstream, http://git.savannah.gnu.org/cgit/recutils.git/commit/?id=85c116026ebe4f6f97a730325f32df066443b054

--- recutils-1.7.orig/utils/csv2rec.c
+++ recutils-1.7/utils/csv2rec.c
@@ -248,7 +248,6 @@ field_cb (void *s, size_t len, void *dat
         {
           if (ctx->num_fields > ctx->num_field_names)
             {
-              char *errmsg = NULL;
               char *source = csv2rec_csv_file;
 
               if (!source)
@@ -256,13 +255,10 @@ field_cb (void *s, size_t len, void *dat
                   source = "stdin";
                 }
 
-              if (!asprintf (&errmsg,
-                             _("%s: %d: this line contains %d fields, but %d header fields were read\n"),
-                             source,
-                             ctx->lineno, ctx->num_field_names, ctx->num_fields))
-                recutl_out_of_memory ();
-
-              fprintf (stderr, errmsg);
+              fprintf (stderr,
+                       _("%s: %lu: this line contains %lu fields, but %lu header fields were read\n"),
+                       source,
+                       ctx->lineno, ctx->num_field_names, ctx->num_fields);
               exit (EXIT_FAILURE);
             }
           field = rec_field_new (ctx->field_names[ctx->num_fields], str);