From: Paul Eggert Date: Thu, 14 Jul 2011 21:43:31 +0000 (-0700) Subject: Fix minor problems found by static checking. X-Git-Tag: emacs-pretest-24.0.90~104^2~264 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ad6042bb6f905a38c1c5b7a77981894355496e5c;p=emacs.git Fix minor problems found by static checking. * bidi.c (bidi_cache_size): Now EMACS_INT, not size_t. (elsz): Now a signed constant, not a size_t var. We prefer signed types to unsigned, to avoid integer comparison confusion. Without this change, GCC 4.6.1 with -Wunsafe-loop-optimizations complains "cannot optimize loop, the loop counter may overflow", a symptom of the confusion. --- diff --git a/src/ChangeLog b/src/ChangeLog index 3cdb3610dd0..625a0b7925c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,12 @@ 2011-07-14 Paul Eggert + Fix minor problems found by static checking. + * bidi.c (bidi_cache_size): Now EMACS_INT, not size_t. + (elsz): Now a signed constant, not a size_t var. We prefer signed + types to unsigned, to avoid integer comparison confusion. Without + this change, GCC 4.6.1 with -Wunsafe-loop-optimizations complains + "cannot optimize loop, the loop counter may overflow", a symptom + of the confusion. * indent.c (Fvertical_motion): Mark locals as initialized. * xdisp.c (reseat_to_string): Fix pointer signedness issue. diff --git a/src/bidi.c b/src/bidi.c index 22a5f0829cd..c83ee549923 100644 --- a/src/bidi.c +++ b/src/bidi.c @@ -299,8 +299,8 @@ bidi_copy_it (struct bidi_it *to, struct bidi_it *from) #define BIDI_CACHE_CHUNK 200 static struct bidi_it *bidi_cache; -static size_t bidi_cache_size = 0; -static size_t elsz = sizeof (struct bidi_it); +static EMACS_INT bidi_cache_size = 0; +enum { elsz = sizeof (struct bidi_it) }; static EMACS_INT bidi_cache_idx; /* next unused cache slot */ static EMACS_INT bidi_cache_last_idx; /* slot of last cache hit */ static EMACS_INT bidi_cache_start = 0; /* start of cache for this