mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
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'.
This commit is contained in:
parent
e501f2111e
commit
96965a6ecb
3 changed files with 15 additions and 12 deletions
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue