Fix remaining leaks in Gnumeric reader
[pspp] / src / language / stats / autorecode.c
index c3ab81c93dabebf6967f9cf952e8cc22d3ce19da..b2c4d4844c5c6cd083b54f0055d5a204c72baa7c 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 1997-9, 2000, 2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 1997-9, 2000, 2009, 2010, 2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 #include "libpspp/str.h"
 
 #include "gl/xalloc.h"
-#include "gl/vasnprintf.h"
+#include "gl/c-xvasprintf.h"
 #include "gl/mbiter.h"
 
+
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
 
@@ -134,7 +135,6 @@ cmd_autorecode (struct lexer *lexer, struct dataset *ds)
   size_t n_dsts = 0;
 
   enum arc_direction direction = ASCENDING;
-  bool print = true;
 
   struct casereader *input;
   struct ccase *c;
@@ -185,7 +185,9 @@ cmd_autorecode (struct lexer *lexer, struct dataset *ds)
       if (lex_match_id (lexer, "DESCENDING"))
        direction = DESCENDING;
       else if (lex_match_id (lexer, "PRINT"))
-       print = true;
+        {
+          /* Not yet implemented. */
+        }
       else if (lex_match_id (lexer, "GROUP"))
        {
          arc->global_items = xmalloc (sizeof (*arc->global_items));
@@ -294,7 +296,6 @@ cmd_autorecode (struct lexer *lexer, struct dataset *ds)
       for (j = 0; j < n_items; j++)
        {
          const union value *from = &items[j]->from;
-         size_t len;
          char *recoded_value  = NULL;
          char *c;
          const int src_width = items[j]->width;
@@ -314,7 +315,7 @@ cmd_autorecode (struct lexer *lexer, struct dataset *ds)
              recoded_value = recode_string (UTF8, dict_get_encoding (arc->dict), str, src_width);
            }
          else
-           recoded_value = asnprintf (NULL, &len, "%g", from->f);
+           recoded_value = c_xasprintf ("%g", from->f);
          
          /* Remove trailing whitespace */
          for (c = recoded_value; *c != '\0'; c++)