From 45c2afd612c04eb594aad53c7292a93ebfa367be Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 21 Sep 2011 13:14:57 -0700 Subject: [PATCH] * casetab.c (set_identity, shuffle): Use lint_assume. --- src/ChangeLog | 2 +- src/casetab.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index de618a225e3..382ca0f4e25 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -67,7 +67,7 @@ Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (casify_object): Avoid integer overflow when overallocating buffer. * casetab.c (set_identity, shuffle): Prefer int to unsigned when - either works. + either works. Use lint_assume to convince GCC 4.6.1 that it's OK. * category.c (Fchar_category_set): Don't assume fixnum fits in int. * category.h (CATEGORYP): Don't assume arg is nonnegative. * ccl.c (GET_CCL_INT): Remove; no longer needed, since the diff --git a/src/casetab.c b/src/casetab.c index 6b639147b7b..64e47859d9b 100644 --- a/src/casetab.c +++ b/src/casetab.c @@ -194,8 +194,7 @@ set_identity (Lisp_Object table, Lisp_Object c, Lisp_Object elt) { if (NATNUMP (elt)) { - int from; - int to; + int from, to; if (CONSP (c)) { @@ -204,7 +203,10 @@ set_identity (Lisp_Object table, Lisp_Object c, Lisp_Object elt) } else from = to = XINT (c); - for (; from <= to; from++) + + to++; + lint_assume (to <= MAX_CHAR + 1); + for (; from < to; from++) CHAR_TABLE_SET (table, from, make_number (from)); } } @@ -229,7 +231,9 @@ shuffle (Lisp_Object table, Lisp_Object c, Lisp_Object elt) else from = to = XINT (c); - for (; from <= to; from++) + to++; + lint_assume (to <= MAX_CHAR + 1); + for (; from < to; from++) { Lisp_Object tem = Faref (table, elt); Faset (table, elt, make_number (from)); -- 2.39.2