diff options
author | Mark H Weaver <mhw@netris.org> | 2013-04-05 14:04:53 -0400 |
---|---|---|
committer | Mark H Weaver <mhw@netris.org> | 2013-04-05 14:10:28 -0400 |
commit | 96965a6ecb04b5380fd6d618e70d64dec3ac37be (patch) | |
tree | fa54da91351ac2e7afc55ea4e561e1c72824997e | |
parent | e501f2111e0d5a8bc037cfe3df4e6ba0655285d5 (diff) | |
download | guile-96965a6ecb04b5380fd6d618e70d64dec3ac37be.tar.gz |
Use 'c_strcasecmp' instead of 'strcasecmp'.
* libguile/ports.c (scm_new_port_table_entry, get_codepoint,
scm_i_set_default_port_encoding, scm_i_port_iconv_descriptors,
scm_i_set_port_encoding_x):
* libguile/print.c (display_string_using_iconv):
* libguile/read.c (scm_i_scan_for_encoding): Use 'c_strcasecmp'.
-rw-r--r-- | libguile/ports.c | 19 | ||||
-rw-r--r-- | libguile/print.c | 5 | ||||
-rw-r--r-- | libguile/read.c | 3 |
3 files changed, 15 insertions, 12 deletions
diff --git a/libguile/ports.c b/libguile/ports.c index 365676611..47dc16535 100644 --- a/libguile/ports.c +++ b/libguile/ports.c @@ -35,6 +35,7 @@ #include <uniconv.h> #include <unistr.h> #include <striconveh.h> +#include <c-strcase.h> #include <assert.h> @@ -645,7 +646,7 @@ scm_new_port_table_entry (scm_t_bits tag) encoding = scm_i_default_port_encoding (); entry->ilseq_handler = scm_i_default_port_conversion_handler (); entry->encoding = encoding ? scm_gc_strdup (encoding, "port") : NULL; - if (encoding && strcasecmp (encoding, "UTF-8") == 0) + if (encoding && c_strcasecmp (encoding, "UTF-8") == 0) pti->encoding_mode = SCM_PORT_ENCODING_MODE_UTF8; else pti->encoding_mode = SCM_PORT_ENCODING_MODE_ICONV; @@ -1427,8 +1428,8 @@ get_codepoint (SCM port, scm_t_wchar *codepoint, if (SCM_UNLIKELY (*codepoint == SCM_UNICODE_BOM && (pti->encoding_mode == SCM_PORT_ENCODING_MODE_UTF8 - || strcasecmp (pt->encoding, "UTF-16") == 0 - || strcasecmp (pt->encoding, "UTF-32") == 0))) + || c_strcasecmp (pt->encoding, "UTF-16") == 0 + || c_strcasecmp (pt->encoding, "UTF-32") == 0))) return get_codepoint (port, codepoint, buf, len); } update_port_lf (*codepoint, port); @@ -2299,9 +2300,9 @@ scm_i_set_default_port_encoding (const char *encoding) SCM_EOL); if (encoding == NULL - || !strcasecmp (encoding, "ASCII") - || !strcasecmp (encoding, "ANSI_X3.4-1968") - || !strcasecmp (encoding, "ISO-8859-1")) + || c_strcasecmp (encoding, "ASCII") == 0 + || c_strcasecmp (encoding, "ANSI_X3.4-1968") == 0 + || c_strcasecmp (encoding, "ISO-8859-1") == 0) scm_fluid_set_x (SCM_VARIABLE_REF (default_port_encoding_var), SCM_BOOL_F); else scm_fluid_set_x (SCM_VARIABLE_REF (default_port_encoding_var), @@ -2489,9 +2490,9 @@ scm_i_port_iconv_descriptors (SCM port, scm_t_port_rw_active mode) /* If the specified encoding is UTF-16 or UTF-32, then make that more precise by deciding what byte order to use. */ - if (strcasecmp (pt->encoding, "UTF-16") == 0) + if (c_strcasecmp (pt->encoding, "UTF-16") == 0) precise_encoding = decide_utf16_encoding (port, mode); - else if (strcasecmp (pt->encoding, "UTF-32") == 0) + else if (c_strcasecmp (pt->encoding, "UTF-32") == 0) precise_encoding = decide_utf32_encoding (port, mode); else precise_encoding = pt->encoding; @@ -2532,7 +2533,7 @@ scm_i_set_port_encoding_x (SCM port, const char *encoding) because we do I/O ourselves. This saves 100+ KiB for each descriptor. */ pt->encoding = scm_gc_strdup (encoding, "port"); - if (strcasecmp (encoding, "UTF-8") == 0) + if (c_strcasecmp (encoding, "UTF-8") == 0) pti->encoding_mode = SCM_PORT_ENCODING_MODE_UTF8; else pti->encoding_mode = SCM_PORT_ENCODING_MODE_ICONV; diff --git a/libguile/print.c b/libguile/print.c index 3f72810c1..fa8499024 100644 --- a/libguile/print.c +++ b/libguile/print.c @@ -30,6 +30,7 @@ #include <uniconv.h> #include <unictype.h> +#include <c-strcase.h> #include "libguile/_scm.h" #include "libguile/chars.h" @@ -895,8 +896,8 @@ display_string_using_iconv (const void *str, int narrow_p, size_t len, pti->at_stream_start_for_bom_read = 0; /* Write a BOM if appropriate. */ - if (SCM_UNLIKELY (strcasecmp(pt->encoding, "UTF-16") == 0 - || strcasecmp(pt->encoding, "UTF-32") == 0)) + if (SCM_UNLIKELY (c_strcasecmp(pt->encoding, "UTF-16") == 0 + || c_strcasecmp(pt->encoding, "UTF-32") == 0)) display_character (SCM_UNICODE_BOM, port, iconveh_error); } diff --git a/libguile/read.c b/libguile/read.c index 3c5f0a44d..64b55c3e5 100644 --- a/libguile/read.c +++ b/libguile/read.c @@ -30,6 +30,7 @@ #include <unistd.h> #include <unicase.h> #include <unictype.h> +#include <c-strcase.h> #include "libguile/_scm.h" #include "libguile/bytevectors.h" @@ -2102,7 +2103,7 @@ scm_i_scan_for_encoding (SCM port) /* This wasn't in a comment */ return NULL; - if (utf8_bom && strcasecmp(encoding, "UTF-8")) + if (utf8_bom && c_strcasecmp(encoding, "UTF-8")) scm_misc_error (NULL, "the port input declares the encoding ~s but is encoded as UTF-8", scm_list_1 (scm_from_locale_string (encoding))); |