aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-02-05 02:20:15 -0800
committerPaul Eggert2011-02-05 02:20:15 -0800
commit25a48bd06bd5979d201cddde99e2dec1eb54c184 (patch)
treeaef22df016ceb89400520afb0a2a323ec9dc43f1 /src
parentd154c079dd429eb5b641139152e7714bfddca519 (diff)
downloademacs-25a48bd06bd5979d201cddde99e2dec1eb54c184.tar.gz
emacs-25a48bd06bd5979d201cddde99e2dec1eb54c184.zip
xstrcasecmp: conform to C89 pointer rules
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/dispextern.h3
-rw-r--r--src/font.c6
-rw-r--r--src/fontset.c2
-rw-r--r--src/ftfont.c6
-rw-r--r--src/image.c4
-rw-r--r--src/process.c4
-rw-r--r--src/xfaces.c32
-rw-r--r--src/xfont.c4
9 files changed, 36 insertions, 30 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 48d3983e253..02644342d46 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,10 @@
12011-02-05 Paul Eggert <eggert@cs.ucla.edu> 12011-02-05 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 xstrcasecmp: conform to C89 pointer rules
4 * xfaces.c (xstrcasecmp): Change args from const unsigned char *
5 to const char *, since they're usually low-level C strings, and
6 this stays compatible with C89 pointer rules. All callers changed.
7
3 * charset.c: conform to C89 pointer rules 8 * charset.c: conform to C89 pointer rules
4 (define_charset_internal): Switch between char * and unsigned char *. 9 (define_charset_internal): Switch between char * and unsigned char *.
5 10
diff --git a/src/dispextern.h b/src/dispextern.h
index 26e0bb61f17..6d54ebefd84 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -3151,7 +3151,7 @@ char *choose_face_font (struct frame *, Lisp_Object *, Lisp_Object,
3151 int *); 3151 int *);
3152int ascii_face_of_lisp_face (struct frame *, int); 3152int ascii_face_of_lisp_face (struct frame *, int);
3153void prepare_face_for_display (struct frame *, struct face *); 3153void prepare_face_for_display (struct frame *, struct face *);
3154int xstrcasecmp (const unsigned char *, const unsigned char *); 3154int xstrcasecmp (const char *, const char *);
3155int lookup_named_face (struct frame *, Lisp_Object, int); 3155int lookup_named_face (struct frame *, Lisp_Object, int);
3156int lookup_basic_face (struct frame *, int); 3156int lookup_basic_face (struct frame *, int);
3157int smaller_face (struct frame *, int, int); 3157int smaller_face (struct frame *, int, int);
@@ -3361,4 +3361,3 @@ extern Lisp_Object x_default_parameter (struct frame *, Lisp_Object,
3361#endif /* HAVE_WINDOW_SYSTEM */ 3361#endif /* HAVE_WINDOW_SYSTEM */
3362 3362
3363#endif /* not DISPEXTERN_H_INCLUDED */ 3363#endif /* not DISPEXTERN_H_INCLUDED */
3364
diff --git a/src/font.c b/src/font.c
index 907271566da..394c0055328 100644
--- a/src/font.c
+++ b/src/font.c
@@ -315,7 +315,7 @@ font_style_to_value (enum font_property_index prop, Lisp_Object val, int noerror
315 315
316 if (SYMBOLP (val)) 316 if (SYMBOLP (val))
317 { 317 {
318 unsigned char *s; 318 char *s;
319 Lisp_Object args[2], elt; 319 Lisp_Object args[2], elt;
320 320
321 /* At first try exact match. */ 321 /* At first try exact match. */
@@ -325,12 +325,12 @@ font_style_to_value (enum font_property_index prop, Lisp_Object val, int noerror
325 return ((XINT (AREF (AREF (table, i), 0)) << 8) 325 return ((XINT (AREF (AREF (table, i), 0)) << 8)
326 | (i << 4) | (j - 1)); 326 | (i << 4) | (j - 1));
327 /* Try also with case-folding match. */ 327 /* Try also with case-folding match. */
328 s = SDATA (SYMBOL_NAME (val)); 328 s = SSDATA (SYMBOL_NAME (val));
329 for (i = 0; i < len; i++) 329 for (i = 0; i < len; i++)
330 for (j = 1; j < ASIZE (AREF (table, i)); j++) 330 for (j = 1; j < ASIZE (AREF (table, i)); j++)
331 { 331 {
332 elt = AREF (AREF (table, i), j); 332 elt = AREF (AREF (table, i), j);
333 if (xstrcasecmp (s, SDATA (SYMBOL_NAME (elt))) == 0) 333 if (xstrcasecmp (s, SSDATA (SYMBOL_NAME (elt))) == 0)
334 return ((XINT (AREF (AREF (table, i), 0)) << 8) 334 return ((XINT (AREF (AREF (table, i), 0)) << 8)
335 | (i << 4) | (j - 1)); 335 | (i << 4) | (j - 1));
336 } 336 }
diff --git a/src/fontset.c b/src/fontset.c
index f94bc954fa4..f297fd10a71 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -1166,7 +1166,7 @@ fs_query_fontset (Lisp_Object name, int name_pattern)
1166 this_name = FONTSET_NAME (fontset); 1166 this_name = FONTSET_NAME (fontset);
1167 if (name_pattern == 1 1167 if (name_pattern == 1
1168 ? fast_string_match_ignore_case (name, this_name) >= 0 1168 ? fast_string_match_ignore_case (name, this_name) >= 0
1169 : !xstrcasecmp (SDATA (name), SDATA (this_name))) 1169 : !xstrcasecmp (SSDATA (name), SSDATA (this_name)))
1170 return i; 1170 return i;
1171 } 1171 }
1172 return -1; 1172 return -1;
diff --git a/src/ftfont.c b/src/ftfont.c
index a20f2013e5a..576bc42a6ff 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -1022,12 +1022,12 @@ ftfont_list (Lisp_Object frame, Lisp_Object spec)
1022 1022
1023 if (! NILP (adstyle) 1023 if (! NILP (adstyle)
1024 && (NILP (this_adstyle) 1024 && (NILP (this_adstyle)
1025 || xstrcasecmp (SDATA (SYMBOL_NAME (adstyle)), 1025 || xstrcasecmp (SSDATA (SYMBOL_NAME (adstyle)),
1026 SDATA (SYMBOL_NAME (this_adstyle))) != 0)) 1026 SSDATA (SYMBOL_NAME (this_adstyle))) != 0))
1027 continue; 1027 continue;
1028 if (langname 1028 if (langname
1029 && ! NILP (this_adstyle) 1029 && ! NILP (this_adstyle)
1030 && xstrcasecmp (langname, SDATA (SYMBOL_NAME (this_adstyle)))) 1030 && xstrcasecmp (langname, SSDATA (SYMBOL_NAME (this_adstyle))))
1031 continue; 1031 continue;
1032 } 1032 }
1033 entity = ftfont_pattern_entity (fontset->fonts[i], 1033 entity = ftfont_pattern_entity (fontset->fonts[i],
diff --git a/src/image.c b/src/image.c
index 8303fac4c98..717d41eb91b 100644
--- a/src/image.c
+++ b/src/image.c
@@ -3906,7 +3906,7 @@ xpm_load_image (struct frame *f,
3906 3906
3907 while (num_colors-- > 0) 3907 while (num_colors-- > 0)
3908 { 3908 {
3909 unsigned char *color, *max_color; 3909 char *color, *max_color;
3910 int key, next_key, max_key = 0; 3910 int key, next_key, max_key = 0;
3911 Lisp_Object symbol_color = Qnil, color_val; 3911 Lisp_Object symbol_color = Qnil, color_val;
3912 XColor cdef; 3912 XColor cdef;
@@ -3958,7 +3958,7 @@ xpm_load_image (struct frame *f,
3958 3958
3959 if (CONSP (specified_color) && STRINGP (XCDR (specified_color))) 3959 if (CONSP (specified_color) && STRINGP (XCDR (specified_color)))
3960 { 3960 {
3961 if (xstrcasecmp (SDATA (XCDR (specified_color)), "None") == 0) 3961 if (xstrcasecmp (SSDATA (XCDR (specified_color)), "None") == 0)
3962 color_val = Qt; 3962 color_val = Qt;
3963 else if (x_defined_color (f, SDATA (XCDR (specified_color)), 3963 else if (x_defined_color (f, SDATA (XCDR (specified_color)),
3964 &cdef, 0)) 3964 &cdef, 0))
diff --git a/src/process.c b/src/process.c
index ca29145bfd4..da97e3de18a 100644
--- a/src/process.c
+++ b/src/process.c
@@ -6168,10 +6168,10 @@ SIGCODE may be an integer, or a symbol whose name is a signal name. */)
6168 ; 6168 ;
6169 else 6169 else
6170 { 6170 {
6171 unsigned char *name; 6171 char *name;
6172 6172
6173 CHECK_SYMBOL (sigcode); 6173 CHECK_SYMBOL (sigcode);
6174 name = SDATA (SYMBOL_NAME (sigcode)); 6174 name = SSDATA (SYMBOL_NAME (sigcode));
6175 6175
6176 if (!strncmp (name, "SIG", 3) || !strncmp (name, "sig", 3)) 6176 if (!strncmp (name, "SIG", 3) || !strncmp (name, "sig", 3))
6177 name += 3; 6177 name += 3;
diff --git a/src/xfaces.c b/src/xfaces.c
index f1d21c098f0..e4f9f317b8e 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -716,12 +716,14 @@ x_free_gc (struct frame *f, GC gc)
716 are in ISO8859-1. */ 716 are in ISO8859-1. */
717 717
718int 718int
719xstrcasecmp (const unsigned char *s1, const unsigned char *s2) 719xstrcasecmp (const char *s1, const char *s2)
720{ 720{
721 while (*s1 && *s2) 721 while (*s1 && *s2)
722 { 722 {
723 unsigned char c1 = tolower (*s1); 723 unsigned char b1 = *s1;
724 unsigned char c2 = tolower (*s2); 724 unsigned char b2 = *s2;
725 unsigned char c1 = tolower (b1);
726 unsigned char c2 = tolower (b2);
725 if (c1 != c2) 727 if (c1 != c2)
726 return c1 < c2 ? -1 : 1; 728 return c1 < c2 ? -1 : 1;
727 ++s1, ++s2; 729 ++s1, ++s2;
@@ -3466,13 +3468,13 @@ face_boolean_x_resource_value (Lisp_Object value, int signal_p)
3466 3468
3467 xassert (STRINGP (value)); 3469 xassert (STRINGP (value));
3468 3470
3469 if (xstrcasecmp (SDATA (value), "on") == 0 3471 if (xstrcasecmp (SSDATA (value), "on") == 0
3470 || xstrcasecmp (SDATA (value), "true") == 0) 3472 || xstrcasecmp (SSDATA (value), "true") == 0)
3471 result = Qt; 3473 result = Qt;
3472 else if (xstrcasecmp (SDATA (value), "off") == 0 3474 else if (xstrcasecmp (SSDATA (value), "off") == 0
3473 || xstrcasecmp (SDATA (value), "false") == 0) 3475 || xstrcasecmp (SSDATA (value), "false") == 0)
3474 result = Qnil; 3476 result = Qnil;
3475 else if (xstrcasecmp (SDATA (value), "unspecified") == 0) 3477 else if (xstrcasecmp (SSDATA (value), "unspecified") == 0)
3476 result = Qunspecified; 3478 result = Qunspecified;
3477 else if (signal_p) 3479 else if (signal_p)
3478 signal_error ("Invalid face attribute value from X resource", value); 3480 signal_error ("Invalid face attribute value from X resource", value);
@@ -3491,7 +3493,7 @@ DEFUN ("internal-set-lisp-face-attribute-from-resource",
3491 CHECK_SYMBOL (attr); 3493 CHECK_SYMBOL (attr);
3492 CHECK_STRING (value); 3494 CHECK_STRING (value);
3493 3495
3494 if (xstrcasecmp (SDATA (value), "unspecified") == 0) 3496 if (xstrcasecmp (SSDATA (value), "unspecified") == 0)
3495 value = Qunspecified; 3497 value = Qunspecified;
3496 else if (EQ (attr, QCheight)) 3498 else if (EQ (attr, QCheight))
3497 { 3499 {
@@ -4051,10 +4053,10 @@ lface_same_font_attributes_p (Lisp_Object *lface1, Lisp_Object *lface2)
4051{ 4053{
4052 xassert (lface_fully_specified_p (lface1) 4054 xassert (lface_fully_specified_p (lface1)
4053 && lface_fully_specified_p (lface2)); 4055 && lface_fully_specified_p (lface2));
4054 return (xstrcasecmp (SDATA (lface1[LFACE_FAMILY_INDEX]), 4056 return (xstrcasecmp (SSDATA (lface1[LFACE_FAMILY_INDEX]),
4055 SDATA (lface2[LFACE_FAMILY_INDEX])) == 0 4057 SSDATA (lface2[LFACE_FAMILY_INDEX])) == 0
4056 && xstrcasecmp (SDATA (lface1[LFACE_FOUNDRY_INDEX]), 4058 && xstrcasecmp (SSDATA (lface1[LFACE_FOUNDRY_INDEX]),
4057 SDATA (lface2[LFACE_FOUNDRY_INDEX])) == 0 4059 SSDATA (lface2[LFACE_FOUNDRY_INDEX])) == 0
4058 && EQ (lface1[LFACE_HEIGHT_INDEX], lface2[LFACE_HEIGHT_INDEX]) 4060 && EQ (lface1[LFACE_HEIGHT_INDEX], lface2[LFACE_HEIGHT_INDEX])
4059 && EQ (lface1[LFACE_SWIDTH_INDEX], lface2[LFACE_SWIDTH_INDEX]) 4061 && EQ (lface1[LFACE_SWIDTH_INDEX], lface2[LFACE_SWIDTH_INDEX])
4060 && EQ (lface1[LFACE_WEIGHT_INDEX], lface2[LFACE_WEIGHT_INDEX]) 4062 && EQ (lface1[LFACE_WEIGHT_INDEX], lface2[LFACE_WEIGHT_INDEX])
@@ -4063,8 +4065,8 @@ lface_same_font_attributes_p (Lisp_Object *lface1, Lisp_Object *lface2)
4063 && (EQ (lface1[LFACE_FONTSET_INDEX], lface2[LFACE_FONTSET_INDEX]) 4065 && (EQ (lface1[LFACE_FONTSET_INDEX], lface2[LFACE_FONTSET_INDEX])
4064 || (STRINGP (lface1[LFACE_FONTSET_INDEX]) 4066 || (STRINGP (lface1[LFACE_FONTSET_INDEX])
4065 && STRINGP (lface2[LFACE_FONTSET_INDEX]) 4067 && STRINGP (lface2[LFACE_FONTSET_INDEX])
4066 && ! xstrcasecmp (SDATA (lface1[LFACE_FONTSET_INDEX]), 4068 && ! xstrcasecmp (SSDATA (lface1[LFACE_FONTSET_INDEX]),
4067 SDATA (lface2[LFACE_FONTSET_INDEX])))) 4069 SSDATA (lface2[LFACE_FONTSET_INDEX]))))
4068 ); 4070 );
4069} 4071}
4070 4072
diff --git a/src/xfont.c b/src/xfont.c
index 51b1c1c6ded..222b4d9edf9 100644
--- a/src/xfont.c
+++ b/src/xfont.c
@@ -164,8 +164,8 @@ xfont_get_cache (FRAME_PTR f)
164static int 164static int
165compare_font_names (const void *name1, const void *name2) 165compare_font_names (const void *name1, const void *name2)
166{ 166{
167 return xstrcasecmp (*(const unsigned char **) name1, 167 return xstrcasecmp (*(const char **) name1,
168 *(const unsigned char **) name2); 168 *(const char **) name2);
169} 169}
170 170
171/* Decode XLFD as iso-8859-1 into OUTPUT, and return the byte length 171/* Decode XLFD as iso-8859-1 into OUTPUT, and return the byte length