aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2011-03-07 16:35:37 -0800
committerPaul Eggert2011-03-07 16:35:37 -0800
commit726929c43aaf671dcbac9b45f9da5b7c9168f3ef (patch)
tree847d6d249d99cacffad609b77bc975a4f1f48fc8
parentf60958682b055102431c24a30b598a2bf3ec97c3 (diff)
downloademacs-726929c43aaf671dcbac9b45f9da5b7c9168f3ef.tar.gz
emacs-726929c43aaf671dcbac9b45f9da5b7c9168f3ef.zip
* charset.c: Include <limits.h>.
(Fsort_charsets): Redo min/max calculation to shorten the code a bit and to avoid gcc -Wuninitialized warning.
-rw-r--r--src/ChangeLog3
-rw-r--r--src/charset.c9
2 files changed, 7 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index ec7322cfe43..39f806283f3 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -31,6 +31,9 @@
31 * charset.h (CHECK_CHARSET_GET_CHARSET): Rename locals to avoid 31 * charset.h (CHECK_CHARSET_GET_CHARSET): Rename locals to avoid
32 shadowing. 32 shadowing.
33 * charset.c (map_charset_for_dump, Fchar_charset): Likewise. 33 * charset.c (map_charset_for_dump, Fchar_charset): Likewise.
34 Include <limits.h>.
35 (Fsort_charsets): Redo min/max calculation to shorten the code a bit
36 and to avoid gcc -Wuninitialized warning.
34 37
352011-03-06 Chong Yidong <cyd@stupidchicken.com> 382011-03-06 Chong Yidong <cyd@stupidchicken.com>
36 39
diff --git a/src/charset.c b/src/charset.c
index f2fcb5bf9d7..0ce548d5a18 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -29,6 +29,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
29#include <stdio.h> 29#include <stdio.h>
30#include <unistd.h> 30#include <unistd.h>
31#include <ctype.h> 31#include <ctype.h>
32#include <limits.h>
32#include <sys/types.h> 33#include <sys/types.h>
33#include <setjmp.h> 34#include <setjmp.h>
34#include "lisp.h" 35#include "lisp.h"
@@ -2250,7 +2251,7 @@ See also `charset-priority-list' and `set-charset-priority'. */)
2250 int n = XFASTINT (len), i, j, done; 2251 int n = XFASTINT (len), i, j, done;
2251 Lisp_Object tail, elt, attrs; 2252 Lisp_Object tail, elt, attrs;
2252 struct charset_sort_data *sort_data; 2253 struct charset_sort_data *sort_data;
2253 int id, min_id, max_id; 2254 int id, min_id = INT_MAX, max_id = INT_MIN;
2254 USE_SAFE_ALLOCA; 2255 USE_SAFE_ALLOCA;
2255 2256
2256 if (n == 0) 2257 if (n == 0)
@@ -2262,11 +2263,9 @@ See also `charset-priority-list' and `set-charset-priority'. */)
2262 CHECK_CHARSET_GET_ATTR (elt, attrs); 2263 CHECK_CHARSET_GET_ATTR (elt, attrs);
2263 sort_data[i].charset = elt; 2264 sort_data[i].charset = elt;
2264 sort_data[i].id = id = XINT (CHARSET_ATTR_ID (attrs)); 2265 sort_data[i].id = id = XINT (CHARSET_ATTR_ID (attrs));
2265 if (i == 0) 2266 if (id < min_id)
2266 min_id = max_id = id;
2267 else if (id < min_id)
2268 min_id = id; 2267 min_id = id;
2269 else if (id > max_id) 2268 if (id > max_id)
2270 max_id = id; 2269 max_id = id;
2271 } 2270 }
2272 for (done = 0, tail = Vcharset_ordered_list, i = 0; 2271 for (done = 0, tail = Vcharset_ordered_list, i = 0;