summaryrefslogtreecommitdiffstats
path: root/intl
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2001-10-26 09:12:43 +0000
committerBruno Haible <bruno@clisp.org>2001-10-26 09:12:43 +0000
commitdc0a34c6be759f1f4fe0dbc6ce3058b572e589f3 (patch)
tree8b902fe340a202b81ab1decedb6ff1b6b8423813 /intl
parent5640ef5179fa4ca31a5dac0a0b8353c6500f4529 (diff)
downloadexternal_gettext-dc0a34c6be759f1f4fe0dbc6ce3058b572e589f3.zip
external_gettext-dc0a34c6be759f1f4fe0dbc6ce3058b572e589f3.tar.gz
external_gettext-dc0a34c6be759f1f4fe0dbc6ce3058b572e589f3.tar.bz2
Use getc_unlocked instead of getc where possible, for speed.
Diffstat (limited to 'intl')
-rw-r--r--intl/ChangeLog4
-rw-r--r--intl/localcharset.c11
2 files changed, 12 insertions, 3 deletions
diff --git a/intl/ChangeLog b/intl/ChangeLog
index 2bb17d9..cd3152c 100644
--- a/intl/ChangeLog
+++ b/intl/ChangeLog
@@ -1,3 +1,7 @@
+2001-10-09 Bruno Haible <haible@clisp.cons.org>
+
+ * localcharset.c (getc): Define as getc_unlocked if available.
+
2001-09-27 Bruno Haible <haible@clisp.cons.org>
* Makefile.in (install-strip, installdirs): New rules.
diff --git a/intl/localcharset.c b/intl/localcharset.c
index 61f8f3e..54600cd 100644
--- a/intl/localcharset.c
+++ b/intl/localcharset.c
@@ -63,6 +63,11 @@
# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
#endif
+#ifdef HAVE_GETC_UNLOCKED
+# undef getc
+# define getc getc_unlocked
+#endif
+
/* The following static variable is declared 'volatile' to avoid a
possible multithread problem in the function get_charset_aliases. If we
are running in a threaded environment, and if two threads initialize
@@ -138,19 +143,19 @@ get_charset_aliases ()
continue;
}
ungetc (c, fp);
- if (fscanf(fp, "%50s %50s", buf1, buf2) < 2)
+ if (fscanf (fp, "%50s %50s", buf1, buf2) < 2)
break;
l1 = strlen (buf1);
l2 = strlen (buf2);
if (res_size == 0)
{
res_size = l1 + 1 + l2 + 1;
- res_ptr = malloc (res_size + 1);
+ res_ptr = (char *) malloc (res_size + 1);
}
else
{
res_size += l1 + 1 + l2 + 1;
- res_ptr = realloc (res_ptr, res_size + 1);
+ res_ptr = (char *) realloc (res_ptr, res_size + 1);
}
if (res_ptr == NULL)
{