From dc0a34c6be759f1f4fe0dbc6ce3058b572e589f3 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 26 Oct 2001 09:12:43 +0000 Subject: Use getc_unlocked instead of getc where possible, for speed. --- intl/ChangeLog | 4 ++++ intl/localcharset.c | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'intl') 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 + + * localcharset.c (getc): Define as getc_unlocked if available. + 2001-09-27 Bruno Haible * 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) { -- cgit v1.1