summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-07-14 14:43:31 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-07-14 14:43:31 -0700
commitad6042bb6f905a38c1c5b7a77981894355496e5c (patch)
tree9c9af40f82d0180071ca5831d51409dd0d5ca4b6
parentf00bbb22a2954fbc7541d20a829178d531bd15d1 (diff)
downloademacs-ad6042bb6f905a38c1c5b7a77981894355496e5c.tar.gz
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.
-rw-r--r--src/ChangeLog7
-rw-r--r--src/bidi.c4
2 files changed, 9 insertions, 2 deletions
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 <eggert@cs.ucla.edu>
+ 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