From 726929c43aaf671dcbac9b45f9da5b7c9168f3ef Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 7 Mar 2011 16:35:37 -0800 Subject: [PATCH] * charset.c: Include . (Fsort_charsets): Redo min/max calculation to shorten the code a bit and to avoid gcc -Wuninitialized warning. --- src/ChangeLog | 3 +++ src/charset.c | 9 ++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index ec7322cfe4..39f806283f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -31,6 +31,9 @@ * charset.h (CHECK_CHARSET_GET_CHARSET): Rename locals to avoid shadowing. * charset.c (map_charset_for_dump, Fchar_charset): Likewise. + Include . + (Fsort_charsets): Redo min/max calculation to shorten the code a bit + and to avoid gcc -Wuninitialized warning. 2011-03-06 Chong Yidong diff --git a/src/charset.c b/src/charset.c index f2fcb5bf9d..0ce548d5a1 100644 --- a/src/charset.c +++ b/src/charset.c @@ -29,6 +29,7 @@ along with GNU Emacs. If not, see . */ #include #include #include +#include #include #include #include "lisp.h" @@ -2250,7 +2251,7 @@ See also `charset-priority-list' and `set-charset-priority'. */) int n = XFASTINT (len), i, j, done; Lisp_Object tail, elt, attrs; struct charset_sort_data *sort_data; - int id, min_id, max_id; + int id, min_id = INT_MAX, max_id = INT_MIN; USE_SAFE_ALLOCA; if (n == 0) @@ -2262,11 +2263,9 @@ See also `charset-priority-list' and `set-charset-priority'. */) CHECK_CHARSET_GET_ATTR (elt, attrs); sort_data[i].charset = elt; sort_data[i].id = id = XINT (CHARSET_ATTR_ID (attrs)); - if (i == 0) - min_id = max_id = id; - else if (id < min_id) + if (id < min_id) min_id = id; - else if (id > max_id) + if (id > max_id) max_id = id; } for (done = 0, tail = Vcharset_ordered_list, i = 0; -- 2.20.1