diff options
author | Bruno Haible <bruno@clisp.org> | 2001-10-26 09:12:43 +0000 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2001-10-26 09:12:43 +0000 |
commit | dc0a34c6be759f1f4fe0dbc6ce3058b572e589f3 (patch) | |
tree | 8b902fe340a202b81ab1decedb6ff1b6b8423813 /intl/localcharset.c | |
parent | 5640ef5179fa4ca31a5dac0a0b8353c6500f4529 (diff) | |
download | external_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/localcharset.c')
-rw-r--r-- | intl/localcharset.c | 11 |
1 files changed, 8 insertions, 3 deletions
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) { |