From: Bruno Haible Date: Fri, 26 Oct 2001 09:12:43 +0000 (+0000) Subject: Use getc_unlocked instead of getc where possible, for speed. X-Git-Tag: v0.11~404 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dc0a34c6be759f1f4fe0dbc6ce3058b572e589f3;p=thirdparty%2Fgettext.git Use getc_unlocked instead of getc where possible, for speed. --- diff --git a/intl/ChangeLog b/intl/ChangeLog index 2bb17d98f..cd3152cb2 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 61f8f3e85..54600cdc0 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) { diff --git a/lib/ChangeLog b/lib/ChangeLog index 722f252f0..09dee1670 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,7 @@ +2001-10-09 Bruno Haible + + * localcharset.c (getc): Define as getc_unlocked if available. + 2001-10-10 Bruno Haible * wait-process.h (wait_subprocess): New argument 'exit_on_error'. diff --git a/lib/localcharset.c b/lib/localcharset.c index 61f8f3e85..54600cdc0 100644 --- a/lib/localcharset.c +++ b/lib/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) { diff --git a/m4/ChangeLog b/m4/ChangeLog index 54e7b2625..480eb3095 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,7 @@ +2001-10-09 Bruno Haible + + * gettext.m4 (AM_GNU_GETTEXT): Add check for getc_unlocked. + 2001-09-29 Bruno Haible * hostname.m4: New file. diff --git a/m4/gettext.m4 b/m4/gettext.m4 index ca22e40e2..8b0ad3c8a 100644 --- a/m4/gettext.m4 +++ b/m4/gettext.m4 @@ -57,9 +57,9 @@ AC_DEFUN([AM_GNU_GETTEXT], AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ stdlib.h string.h unistd.h sys/param.h]) - AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \ -getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strcasecmp strdup \ -strtoul tsearch __argz_count __argz_stringify __argz_next]) + AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \ +geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \ +strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next]) AM_ICONV AM_LANGINFO_CODESET diff --git a/src/ChangeLog b/src/ChangeLog index b174aabf7..ed9665c52 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2001-10-09 Bruno Haible + + * po-lex.c (getc): Define as getc_unlocked if available. + 2001-10-21 Bruno Haible * msginit.c: New file. diff --git a/src/po-lex.c b/src/po-lex.c index b664d0f37..d0df8d19a 100644 --- a/src/po-lex.c +++ b/src/po-lex.c @@ -67,6 +67,11 @@ # include "utf8-ucs4.h" #endif +#ifdef HAVE_GETC_UNLOCKED +# undef getc +# define getc getc_unlocked +#endif + #if HAVE_C_BACKSLASH_A # define ALERT_CHAR '\a' #else