From 8cd55cb48a097813ff13b8dc5e6570dd32fa1495 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 2 Apr 2011 22:56:37 -0700 Subject: [PATCH] * fns.c (sxhash): Redo loop for clarity and to avoid wraparound warning. --- src/ChangeLog | 1 + src/fns.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 04a27863fd0..821e663a311 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,7 @@ 2011-04-03 Paul Eggert * fns.c (substring_both): Remove var that is set but not used. + (sxhash): Redo loop for clarity and to avoid wraparound warning. * eval.c (funcall_lambda): Rename local to avoid shadowing. diff --git a/src/fns.c b/src/fns.c index 8346dbc690a..c45d9e31ef2 100644 --- a/src/fns.c +++ b/src/fns.c @@ -4219,9 +4219,9 @@ sxhash (Lisp_Object obj, int depth) { double val = XFLOAT_DATA (obj); unsigned char *p = (unsigned char *) &val; - unsigned char *e = p + sizeof val; - for (hash = 0; p < e; ++p) - hash = SXHASH_COMBINE (hash, *p); + size_t i; + for (hash = 0, i = 0; i < sizeof val; i++) + hash = SXHASH_COMBINE (hash, p[i]); break; } -- 2.39.2