From 0513110744d9ae86c12eea93466c6ff539ae3f77 Mon Sep 17 00:00:00 2001 From: Jason Rumney Date: Thu, 22 May 2008 14:54:27 +0000 Subject: [PATCH] * dispextern.h, xfaces.c (xstrcasecmp): Renamed from xstricmp. * dosfns.c, fileio.c, font.c, fontset.c, image.c, macfns.c: * macterm.c, process.c, w32.c, w32fns.c, w32proc.c, xfaces.c: * xfns.c, xfont.c: Callers changed. --- src/ChangeLog | 6 ++++++ src/dispextern.h | 2 +- src/dosfns.c | 2 +- src/fileio.c | 6 +++--- src/font.c | 9 +++++---- src/fontset.c | 2 +- src/image.c | 4 ++-- src/macfns.c | 4 ++-- src/macterm.c | 4 ++-- src/process.c | 2 +- src/w32.c | 32 ++++++++++++++++---------------- src/w32fns.c | 24 ++++++++++++------------ src/w32proc.c | 6 +++--- src/xfaces.c | 30 +++++++++++++++--------------- src/xfns.c | 2 +- src/xfont.c | 4 ++-- 16 files changed, 73 insertions(+), 66 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 6b18a74c5a..d90bac7b1e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,11 @@ 2008-05-22 Jason Rumney + * dispextern.h, xfaces.c (xstrcasecmp): Renamed from xstricmp. + + * dosfns.c, fileio.c, font.c, fontset.c, image.c, macfns.c: + * macterm.c, process.c, w32.c, w32fns.c, w32proc.c, xfaces.c: + * xfns.c, xfont.c: Callers changed. + * xfont.c (xfont_list_pattern, compare_font_names): Use xstricmp. * fontset.c (fs_query_fontset): Use xstricmp. diff --git a/src/dispextern.h b/src/dispextern.h index c644295fbf..2101d70478 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -2848,7 +2848,7 @@ char *choose_face_font P_ ((struct frame *, Lisp_Object *, Lisp_Object, int *)); int ascii_face_of_lisp_face P_ ((struct frame *, int)); void prepare_face_for_display P_ ((struct frame *, struct face *)); -int xstricmp P_ ((const unsigned char *, const unsigned char *)); +int xstrcasecmp P_ ((const unsigned char *, const unsigned char *)); int lookup_face P_ ((struct frame *, Lisp_Object *)); int lookup_non_ascii_face P_ ((struct frame *, int, struct face *)); int lookup_named_face P_ ((struct frame *, Lisp_Object, int)); diff --git a/src/dosfns.c b/src/dosfns.c index deb1de6005..ac336c9a5d 100644 --- a/src/dosfns.c +++ b/src/dosfns.c @@ -420,7 +420,7 @@ msdos_stdcolor_idx (const char *name) int i; for (i = 0; i < sizeof (vga_colors) / sizeof (vga_colors[0]); i++) - if (xstricmp (name, vga_colors[i]) == 0) + if (xstrcasecmp (name, vga_colors[i]) == 0) return i; return diff --git a/src/fileio.c b/src/fileio.c index 6ef3fe890a..c4b0113523 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -3033,9 +3033,9 @@ check_executable (filename) #else return (S_ISREG (st.st_mode) && len >= 5 - && (stricmp ((suffix = filename + len-4), ".com") == 0 - || stricmp (suffix, ".exe") == 0 - || stricmp (suffix, ".bat") == 0) + && (xstrcasecmp ((suffix = filename + len-4), ".com") == 0 + || xstrcasecmp (suffix, ".exe") == 0 + || xstrcasecmp (suffix, ".bat") == 0) || (st.st_mode & S_IFMT) == S_IFDIR); #endif /* not WINDOWSNT */ #else /* not DOS_NT */ diff --git a/src/font.c b/src/font.c index 11be985651..a8b460d9e1 100644 --- a/src/font.c +++ b/src/font.c @@ -312,7 +312,7 @@ font_style_to_value (prop, val, noerror) for (j = 1; j < ASIZE (AREF (table, i)); j++) { elt = AREF (AREF (table, i), j); - if (xstricmp (s, (char *) SDATA (SYMBOL_NAME (elt))) == 0) + if (xstrcasecmp (s, (char *) SDATA (SYMBOL_NAME (elt))) == 0) return ((XINT (AREF (AREF (table, i), 0)) << 8) | (i << 4) | (j - 1)); } @@ -1981,7 +1981,8 @@ font_score (entity, spec_prop, alternate_families) Lisp_Object entity_str = SYMBOL_NAME (AREF (entity, i)); Lisp_Object spec_str = SYMBOL_NAME (spec_prop[i]); - if (xstricmp ((char *) SDATA (spec_str), (char *) SDATA (entity_str))) + if (xstrcasecmp ((char *) SDATA (spec_str), + (char *) SDATA (entity_str))) { if (i == FONT_FAMILY_INDEX && CONSP (alternate_families)) { @@ -1991,8 +1992,8 @@ font_score (entity, spec_prop, alternate_families) j++, alternate_families = XCDR (alternate_families)) { spec_str = XCAR (alternate_families); - if (xstricmp ((char *) SDATA (spec_str), - (char *) SDATA (entity_str)) == 0) + if (xstrcasecmp ((char *) SDATA (spec_str), + (char *) SDATA (entity_str)) == 0) break; } diff --git a/src/fontset.c b/src/fontset.c index 06b13cd657..59929c0b4a 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -1082,7 +1082,7 @@ fs_query_fontset (name, name_pattern) this_name = FONTSET_NAME (fontset); if (name_pattern == 1 ? fast_string_match_ignore_case (name, this_name) >= 0 - : !xstricmp (SDATA (name), SDATA (this_name))) + : !xstrcasecmp (SDATA (name), SDATA (this_name))) return i; } return -1; diff --git a/src/image.c b/src/image.c index 3628a7f05d..652c738d10 100644 --- a/src/image.c +++ b/src/image.c @@ -4862,7 +4862,7 @@ xpm_load_image (f, img, contents, end) if (CONSP (specified_color) && STRINGP (XCDR (specified_color))) { - if (xstricmp (SDATA (XCDR (specified_color)), "None") == 0) + if (xstrcasecmp (SDATA (XCDR (specified_color)), "None") == 0) color_val = Qt; else if (x_defined_color (f, SDATA (XCDR (specified_color)), &cdef, 0)) @@ -4871,7 +4871,7 @@ xpm_load_image (f, img, contents, end) } if (NILP (color_val) && max_key > 0) { - if (xstricmp (max_color, "None") == 0) + if (xstrcasecmp (max_color, "None") == 0) color_val = Qt; else if (x_defined_color (f, max_color, &cdef, 0)) color_val = make_number (cdef.pixel); diff --git a/src/macfns.c b/src/macfns.c index 56320684a8..edc5a63441 100644 --- a/src/macfns.c +++ b/src/macfns.c @@ -105,7 +105,7 @@ extern Lisp_Object Vwindow_system_version; int image_cache_refcount, dpyinfo_refcount; #endif -#if 0 /* Use xstricmp instead. */ +#if 0 /* Use xstrcasecmp instead. */ /* compare two strings ignoring case */ static int @@ -1011,7 +1011,7 @@ mac_color_map_lookup (colorname) BLOCK_INPUT; for (i = 0; i < sizeof (mac_color_map) / sizeof (mac_color_map[0]); i++) - if (xstricmp (colorname, mac_color_map[i].name) == 0) + if (xstrcasecmp (colorname, mac_color_map[i].name) == 0) { ret = make_number (mac_color_map[i].color); break; diff --git a/src/macterm.c b/src/macterm.c index 0542b043f8..ae9aa1108d 100644 --- a/src/macterm.c +++ b/src/macterm.c @@ -9460,8 +9460,8 @@ x_query_font (f, fontname) for (i = 0; i < dpyinfo->n_fonts; i++) if (dpyinfo->font_table[i].name - && (!xstricmp (dpyinfo->font_table[i].name, fontname) - || !xstricmp (dpyinfo->font_table[i].full_name, fontname))) + && (!xstrcasecmp (dpyinfo->font_table[i].name, fontname) + || !xstrcasecmp (dpyinfo->font_table[i].full_name, fontname))) return (dpyinfo->font_table + i); return NULL; } diff --git a/src/process.c b/src/process.c index 50952bf164..e173575080 100644 --- a/src/process.c +++ b/src/process.c @@ -6146,7 +6146,7 @@ SIGCODE may be an integer, or a symbol whose name is a signal name. */) got_it: #define parse_signal(NAME, VALUE) \ - else if (!xstricmp (name, NAME)) \ + else if (!xstrcasecmp (name, NAME)) \ XSETINT (sigcode, VALUE) if (INTEGERP (sigcode)) diff --git a/src/w32.c b/src/w32.c index fea19518e2..254cd79dde 100644 --- a/src/w32.c +++ b/src/w32.c @@ -720,7 +720,7 @@ getpwnam (char *name) if (!pw) return pw; - if (stricmp (name, pw->pw_name)) + if (xstrcasecmp (name, pw->pw_name)) return NULL; return pw; @@ -754,7 +754,7 @@ init_user_info () { strcpy (dflt_passwd.pw_name, uname); /* Determine a reasonable uid value. */ - if (stricmp ("administrator", uname) == 0) + if (xstrcasecmp ("administrator", uname) == 0) { dflt_passwd.pw_uid = 500; /* well-known Administrator uid */ dflt_passwd.pw_gid = 513; /* well-known None gid */ @@ -786,7 +786,7 @@ init_user_info () else if (GetUserName (uname, &ulength)) { strcpy (dflt_passwd.pw_name, uname); - if (stricmp ("administrator", uname) == 0) + if (xstrcasecmp ("administrator", uname) == 0) dflt_passwd.pw_uid = 0; else dflt_passwd.pw_uid = 123; @@ -1296,7 +1296,7 @@ init_environment (char ** argv) abort (); *p = 0; - if ((p = strrchr (modname, '\\')) && stricmp (p, "\\bin") == 0) + if ((p = strrchr (modname, '\\')) && xstrcasecmp (p, "\\bin") == 0) { char buf[SET_ENV_BUF_SIZE]; @@ -1312,7 +1312,7 @@ init_environment (char ** argv) /* FIXME: should use substring of get_emacs_configuration (). But I don't think the Windows build supports alpha, mips etc anymore, so have taken the easy option for now. */ - else if (p && stricmp (p, "\\i386") == 0) + else if (p && xstrcasecmp (p, "\\i386") == 0) { *p = 0; p = strrchr (modname, '\\'); @@ -1320,7 +1320,7 @@ init_environment (char ** argv) { *p = 0; p = strrchr (modname, '\\'); - if (p && stricmp (p, "\\src") == 0) + if (p && xstrcasecmp (p, "\\src") == 0) { char buf[SET_ENV_BUF_SIZE]; @@ -1652,7 +1652,7 @@ lookup_volume_info (char * root_dir) volume_info_data * info; for (info = volume_cache; info; info = info->next) - if (stricmp (info->root_dir, root_dir) == 0) + if (xstrcasecmp (info->root_dir, root_dir) == 0) break; return info; } @@ -1930,10 +1930,10 @@ is_exec (const char * name) char * p = strrchr (name, '.'); return (p != NULL - && (stricmp (p, ".exe") == 0 || - stricmp (p, ".com") == 0 || - stricmp (p, ".bat") == 0 || - stricmp (p, ".cmd") == 0)); + && (xstrcasecmp (p, ".exe") == 0 || + xstrcasecmp (p, ".com") == 0 || + xstrcasecmp (p, ".bat") == 0 || + xstrcasecmp (p, ".cmd") == 0)); } /* Emulate the Unix directory procedures opendir, closedir, @@ -2877,7 +2877,7 @@ stat (const char * path, struct stat * buf) if (dir_find_handle != INVALID_HANDLE_VALUE && strnicmp (name, dir_pathname, len) == 0 && IS_DIRECTORY_SEP (name[len]) - && stricmp (name + len + 1, dir_static.d_name) == 0) + && xstrcasecmp (name + len + 1, dir_static.d_name) == 0) { /* This was the last entry returned by readdir. */ wfd = dir_find_data; @@ -3103,10 +3103,10 @@ fstat (int desc, struct stat * buf) #if 0 /* no way of knowing the filename */ char * p = strrchr (name, '.'); if (p != NULL && - (stricmp (p, ".exe") == 0 || - stricmp (p, ".com") == 0 || - stricmp (p, ".bat") == 0 || - stricmp (p, ".cmd") == 0)) + (xstrcasecmp (p, ".exe") == 0 || + xstrcasecmp (p, ".com") == 0 || + xstrcasecmp (p, ".bat") == 0 || + xstrcasecmp (p, ".cmd") == 0)) permission |= S_IEXEC; #endif } diff --git a/src/w32fns.c b/src/w32fns.c index 77355a2c62..9805afd119 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -4993,16 +4993,16 @@ x_to_w32_weight (lpw) { if (!lpw) return (FW_DONTCARE); - if (stricmp (lpw, "heavy") == 0) return FW_HEAVY; - else if (stricmp (lpw, "extrabold") == 0) return FW_EXTRABOLD; - else if (stricmp (lpw, "bold") == 0) return FW_BOLD; - else if (stricmp (lpw, "demibold") == 0) return FW_SEMIBOLD; - else if (stricmp (lpw, "semibold") == 0) return FW_SEMIBOLD; - else if (stricmp (lpw, "medium") == 0) return FW_MEDIUM; - else if (stricmp (lpw, "normal") == 0) return FW_NORMAL; - else if (stricmp (lpw, "light") == 0) return FW_LIGHT; - else if (stricmp (lpw, "extralight") == 0) return FW_EXTRALIGHT; - else if (stricmp (lpw, "thin") == 0) return FW_THIN; + if (xstrcasecmp (lpw, "heavy") == 0) return FW_HEAVY; + else if (xstrcasecmp (lpw, "extrabold") == 0) return FW_EXTRABOLD; + else if (xstrcasecmp (lpw, "bold") == 0) return FW_BOLD; + else if (xstrcasecmp (lpw, "demibold") == 0) return FW_SEMIBOLD; + else if (xstrcasecmp (lpw, "semibold") == 0) return FW_SEMIBOLD; + else if (xstrcasecmp (lpw, "medium") == 0) return FW_MEDIUM; + else if (xstrcasecmp (lpw, "normal") == 0) return FW_NORMAL; + else if (xstrcasecmp (lpw, "light") == 0) return FW_LIGHT; + else if (xstrcasecmp (lpw, "extralight") == 0) return FW_EXTRALIGHT; + else if (xstrcasecmp (lpw, "thin") == 0) return FW_THIN; else return FW_DONTCARE; } @@ -5057,7 +5057,7 @@ x_to_w32_charset (lpcs) if (NILP (this_entry)) { /* At startup, we want iso8859-1 fonts to come up properly. */ - if (stricmp (charset, "iso8859-1") == 0) + if (xstrcasecmp (charset, "iso8859-1") == 0) return ANSI_CHARSET; else return DEFAULT_CHARSET; @@ -6483,7 +6483,7 @@ w32_query_font (struct frame *f, char *fontname) for (i = 0; i < one_w32_display_info.n_fonts ;i++, pfi++) { - if (stricmp (pfi->name, fontname) == 0) return pfi; + if (xstrcasecmp (pfi->name, fontname) == 0) return pfi; } return NULL; diff --git a/src/w32proc.c b/src/w32proc.c index f8837c847b..3dce1e1f21 100644 --- a/src/w32proc.c +++ b/src/w32proc.c @@ -621,10 +621,10 @@ w32_executable_type (char * filename, int * is_dos_app, int * is_cygnus_app, int p = strrchr (filename, '.'); /* We can only identify DOS .com programs from the extension. */ - if (p && stricmp (p, ".com") == 0) + if (p && xstrcasecmp (p, ".com") == 0) *is_dos_app = TRUE; - else if (p && (stricmp (p, ".bat") == 0 - || stricmp (p, ".cmd") == 0)) + else if (p && (xstrcasecmp (p, ".bat") == 0 + || xstrcasecmp (p, ".cmd") == 0)) { /* A DOS shell script - it appears that CreateProcess is happy to accept this (somewhat surprisingly); presumably it looks at diff --git a/src/xfaces.c b/src/xfaces.c index b797705c4a..fca228e85d 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -798,11 +798,11 @@ x_free_gc (f, gc) #endif /* MAC_OS */ -/* Like stricmp. Used to compare parts of font names which are in - ISO8859-1. */ +/* Like strcasecmp/stricmp. Used to compare parts of font names which + are in ISO8859-1. */ int -xstricmp (s1, s2) +xstrcasecmp (s1, s2) const unsigned char *s1, *s2; { while (*s1 && *s2) @@ -1381,8 +1381,8 @@ face_color_supported_p (f, color_name, background_p) #ifdef HAVE_WINDOW_SYSTEM FRAME_WINDOW_P (f) ? (!NILP (Fxw_display_color_p (frame)) - || xstricmp (color_name, "black") == 0 - || xstricmp (color_name, "white") == 0 + || xstrcasecmp (color_name, "black") == 0 + || xstrcasecmp (color_name, "white") == 0 || (background_p && face_color_gray_p (f, color_name)) || (!NILP (Fx_display_grayscale_p (frame)) @@ -3564,13 +3564,13 @@ face_boolean_x_resource_value (value, signal_p) xassert (STRINGP (value)); - if (xstricmp (SDATA (value), "on") == 0 - || xstricmp (SDATA (value), "true") == 0) + if (xstrcasecmp (SDATA (value), "on") == 0 + || xstrcasecmp (SDATA (value), "true") == 0) result = Qt; - else if (xstricmp (SDATA (value), "off") == 0 - || xstricmp (SDATA (value), "false") == 0) + else if (xstrcasecmp (SDATA (value), "off") == 0 + || xstrcasecmp (SDATA (value), "false") == 0) result = Qnil; - else if (xstricmp (SDATA (value), "unspecified") == 0) + else if (xstrcasecmp (SDATA (value), "unspecified") == 0) result = Qunspecified; else if (signal_p) signal_error ("Invalid face attribute value from X resource", value); @@ -3590,7 +3590,7 @@ DEFUN ("internal-set-lisp-face-attribute-from-resource", CHECK_SYMBOL (attr); CHECK_STRING (value); - if (xstricmp (SDATA (value), "unspecified") == 0) + if (xstrcasecmp (SDATA (value), "unspecified") == 0) value = Qunspecified; else if (EQ (attr, QCheight)) { @@ -4127,8 +4127,8 @@ lface_same_font_attributes_p (lface1, lface2) { xassert (lface_fully_specified_p (lface1) && lface_fully_specified_p (lface2)); - return (xstricmp (SDATA (lface1[LFACE_FAMILY_INDEX]), - SDATA (lface2[LFACE_FAMILY_INDEX])) == 0 + return (xstrcasecmp (SDATA (lface1[LFACE_FAMILY_INDEX]), + SDATA (lface2[LFACE_FAMILY_INDEX])) == 0 && EQ (lface1[LFACE_HEIGHT_INDEX], lface2[LFACE_HEIGHT_INDEX]) && EQ (lface1[LFACE_SWIDTH_INDEX], lface2[LFACE_SWIDTH_INDEX]) && EQ (lface1[LFACE_WEIGHT_INDEX], lface2[LFACE_WEIGHT_INDEX]) @@ -4137,8 +4137,8 @@ lface_same_font_attributes_p (lface1, lface2) && (EQ (lface1[LFACE_FONTSET_INDEX], lface2[LFACE_FONTSET_INDEX]) || (STRINGP (lface1[LFACE_FONTSET_INDEX]) && STRINGP (lface2[LFACE_FONTSET_INDEX]) - && ! xstricmp (SDATA (lface1[LFACE_FONTSET_INDEX]), - SDATA (lface2[LFACE_FONTSET_INDEX])))) + && ! xstrcasecmp (SDATA (lface1[LFACE_FONTSET_INDEX]), + SDATA (lface2[LFACE_FONTSET_INDEX])))) ); } diff --git a/src/xfns.c b/src/xfns.c index e1dcee62bb..875c1599fe 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -4010,7 +4010,7 @@ select_visual (dpyinfo) /* Determine the visual class. */ for (i = 0; visual_classes[i].name; ++i) - if (xstricmp (s, visual_classes[i].name) == 0) + if (xstrcasecmp (s, visual_classes[i].name) == 0) { class = visual_classes[i].class; break; diff --git a/src/xfont.c b/src/xfont.c index af2665c567..8483ae5079 100644 --- a/src/xfont.c +++ b/src/xfont.c @@ -206,7 +206,7 @@ extern Lisp_Object Vface_alternative_font_registry_alist; static int compare_font_names (const void *name1, const void *name2) { - return xstricmp (*(const char **) name1, *(const char **) name2); + return xstrcasecmp (*(const char **) name1, *(const char **) name2); } static Lisp_Object xfont_list_pattern P_ ((Lisp_Object, Display *, char *)); @@ -253,7 +253,7 @@ xfont_list_pattern (frame, display, pattern) Lisp_Object entity; int result; - if (i > 0 && xstricmp (indices[i - 1], indices[i]) == 0) + if (i > 0 && xstrcasecmp (indices[i - 1], indices[i]) == 0) continue; entity = font_make_entity (); -- 2.20.1