From: Joel E. Denny Date: Tue, 29 Sep 2009 10:54:38 +0000 (-0400) Subject: Use the correct conversion specifier for size_t. X-Git-Tag: v2.5_rc1~158 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=17a407dc5184b2a0fe70677c911b0d6a1d10ffdd;p=platform%2Fupstream%2Fbison.git Use the correct conversion specifier for size_t. Reported by Jim Meyering. * src/Sbitset.h (SBITSET__INDEX__CONVERSION_SPEC): New, "zu" because Sbitset__Index is size_t. * src/Sbitset.c (Sbitset__fprint): Use it instead of %d. (cherry picked from commit 47eced3099712180364f4e01b839242027d9a9d8) --- diff --git a/ChangeLog b/ChangeLog index 4b233db..12f3016 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-09-29 Joel E. Denny + + Use the correct conversion specifier for size_t. + Reported by Jim Meyering. + * src/Sbitset.h (SBITSET__INDEX__CONVERSION_SPEC): New, "zu" + because Sbitset__Index is size_t. + * src/Sbitset.c (Sbitset__fprint): Use it instead of %d. + 2009-09-27 Joel E. Denny tests: don't abuse AT_BISON_CHECK. diff --git a/src/Sbitset.c b/src/Sbitset.c index 0c1fedf..af8600b 100644 --- a/src/Sbitset.c +++ b/src/Sbitset.c @@ -65,14 +65,16 @@ Sbitset__fprint(Sbitset self, Sbitset__Index nbits, FILE *file) Sbitset__Index i; Sbitset itr; bool first = true; - fprintf (file, "nbits = %d, set = {", nbits); + fprintf (file, + "nbits = %" SBITSET__INDEX__CONVERSION_SPEC ", set = {", + nbits); SBITSET__FOR_EACH (self, nbits, itr, i) { if (first) first = false; else fprintf (file, ","); - fprintf (file, " %d", i); + fprintf (file, " %" SBITSET__INDEX__CONVERSION_SPEC, i); } fprintf (file, " }"); } diff --git a/src/Sbitset.h b/src/Sbitset.h index 4b4b750..a025040 100644 --- a/src/Sbitset.h +++ b/src/Sbitset.h @@ -22,6 +22,7 @@ typedef char *Sbitset; typedef size_t Sbitset__Index; +#define SBITSET__INDEX__CONVERSION_SPEC "zu" #define Sbitset__nbytes(NBITS) (((NBITS)+7)/8) #define Sbitset__byteAddress(SELF, INDEX) (((SELF) + (INDEX)/8))