From: John Darrington <john@darrington.wattle.id.au>
Date: Mon, 12 Sep 2005 11:33:55 +0000 (+0000)
Subject: Fixed issues which arose on x86_64 architecture
X-Git-Tag: sav-api~2232
X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c2526641a2e88ff6dec7ea6ae5ffc063daf6957;p=pspp

Fixed issues which arose on x86_64 architecture
---

diff --git a/src/ChangeLog b/src/ChangeLog
index dc2c605edd..199f8ec52c 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
+Mon Sep 12 19:26:06 WST 2005 John Darrington <john@darrington.wattle.id.au>
+
+	* dictionary.[ch]  Changed cnt from size_t* to int* since that's
+	what it's called as, and on  x86_64 machines they're different sizes.
+	
+	* str.c: (ds_vprintf) Copied va_list args so they can be re-used
+	
 Sun Aug 21 00:12:24 2005  Ben Pfaff  <blp@gnu.org>
 
 	* lexer.c: (lex_sbc_only_once) New function.
diff --git a/src/dictionary.c b/src/dictionary.c
index c63b2e1bcf..758f199763 100644
--- a/src/dictionary.c
+++ b/src/dictionary.c
@@ -223,7 +223,7 @@ dict_get_var (const struct dictionary *d, size_t idx)
    exclude ordinary, system, and/or scratch variables. */
 void
 dict_get_vars (const struct dictionary *d, struct variable ***vars,
-               size_t *cnt, unsigned exclude_classes)
+               int *cnt, unsigned exclude_classes)
 {
   size_t count;
   size_t i;
diff --git a/src/dictionary.h b/src/dictionary.h
index e923d52dc2..e527dd518f 100644
--- a/src/dictionary.h
+++ b/src/dictionary.h
@@ -34,7 +34,7 @@ void dict_destroy (struct dictionary *);
 size_t dict_get_var_cnt (const struct dictionary *);
 struct variable *dict_get_var (const struct dictionary *, size_t idx);
 void dict_get_vars (const struct dictionary *,
-                    struct variable ***vars, size_t *cnt,
+                    struct variable ***vars, int *cnt,
                     unsigned exclude_classes);
 
 struct variable *dict_create_var (struct dictionary *, const char *,
diff --git a/src/str.c b/src/str.c
index d497078a58..fe9ad81468 100644
--- a/src/str.c
+++ b/src/str.c
@@ -453,7 +453,9 @@ ds_vprintf (struct string *st, const char *format, va_list args)
      been written. */
 
   int avail, needed;
+  va_list a1;
 
+  va_copy(a1, args);
   avail = st->capacity - st->length + 1;
   needed = vsnprintf (st->string + st->length, avail, format, args);
 
@@ -462,17 +464,22 @@ ds_vprintf (struct string *st, const char *format, va_list args)
     {
       ds_extend (st, st->length + needed);
       
-      vsprintf (st->string + st->length, format, args);
+      vsprintf (st->string + st->length, format, a1);
     }
   else
     while (needed == -1)
       {
+	va_list a2;
+	va_copy(a2, a1);
+
 	ds_extend (st, (st->capacity + 1) * 2);
 	avail = st->capacity - st->length + 1;
 
-	needed = vsnprintf (st->string + st->length, avail, format, args);
+	needed = vsnprintf (st->string + st->length, avail, format, a2);
+	va_end(a2);
 
       }
+  va_end(a1);
 
   st->length += needed;
 }