From: John Darrington Date: Mon, 12 Sep 2005 11:33:55 +0000 (+0000) Subject: Fixed issues which arose on x86_64 architecture X-Git-Tag: v0.6.0~1224 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c2526641a2e88ff6dec7ea6ae5ffc063daf6957;p=pspp-builds.git Fixed issues which arose on x86_64 architecture --- diff --git a/src/ChangeLog b/src/ChangeLog index dc2c605e..199f8ec5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +Mon Sep 12 19:26:06 WST 2005 John Darrington + + * 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 * lexer.c: (lex_sbc_only_once) New function. diff --git a/src/dictionary.c b/src/dictionary.c index c63b2e1b..758f1997 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 e923d52d..e527dd51 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 d497078a..fe9ad814 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; }