From d2762c86419d6d55bf59fd62ea1c9fa3525411c0 Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Mon, 15 Nov 2010 22:44:51 -0800 Subject: Convert definitions to standard C. * src/strftime.c (LOCALE_PARAM_DECL): Update for standard C. (LOCALE_PARAM, LOCALE_PARAM_PROTO): Remove, unused. (memcpy_lowcase, so_week_days, extra_args_spec, emacs_strftimeu): Convert definitions to standard C. * src/regex.c: Do not include , config.h does it. Include unistd.h. (xrealloc, init_syntax_once, re_match, regcomp, regexec) (regerror, regfree): Convert definitions to standard C. * src/mktime.c (my_mktime_localtime_r, ydhms_tm_diff, ranged_convert) (__mktime_internal): Convert definitions to standard C. --- src/strftime.c | 49 +++++++++---------------------------------------- 1 file changed, 9 insertions(+), 40 deletions(-) (limited to 'src/strftime.c') diff --git a/src/strftime.c b/src/strftime.c index a7617427793..56c2a2c0fb0 100644 --- a/src/strftime.c +++ b/src/strftime.c @@ -318,14 +318,10 @@ static const CHAR_T zeroes[16] = /* "0000000000000000" */ # undef _NL_CURRENT # define _NL_CURRENT(category, item) \ (current->values[_NL_ITEM_INDEX (item)].string) -# define LOCALE_PARAM , loc # define LOCALE_ARG , loc -# define LOCALE_PARAM_DECL __locale_t loc; -# define LOCALE_PARAM_PROTO , __locale_t loc +# define LOCALE_PARAM_DECL , __locale_t loc # define HELPER_LOCALE_ARG , current #else -# define LOCALE_PARAM -# define LOCALE_PARAM_PROTO # define LOCALE_ARG # define LOCALE_PARAM_DECL # ifdef _LIBC @@ -363,30 +359,16 @@ static const CHAR_T zeroes[16] = /* "0000000000000000" */ more reliable way to accept other sets of digits. */ #define ISDIGIT(Ch) ((unsigned int) (Ch) - L_('0') <= 9) -static CHAR_T *memcpy_lowcase (CHAR_T *dest, const CHAR_T *src, - size_t len LOCALE_PARAM_PROTO); - static CHAR_T * -memcpy_lowcase (dest, src, len LOCALE_PARAM) - CHAR_T *dest; - const CHAR_T *src; - size_t len; - LOCALE_PARAM_DECL +memcpy_lowcase (CHAR_T *dest, const CHAR_T *src, size_t len LOCALE_PARAM_DECL) { while (len-- > 0) dest[len] = TOLOWER ((UCHAR_T) src[len], loc); return dest; } -static CHAR_T *memcpy_uppcase (CHAR_T *dest, const CHAR_T *src, - size_t len LOCALE_PARAM_PROTO); - static CHAR_T * -memcpy_uppcase (dest, src, len LOCALE_PARAM) - CHAR_T *dest; - const CHAR_T *src; - size_t len; - LOCALE_PARAM_DECL +memcpy_uppcase (CHAR_T *dest, const CHAR_T *src, size_t len LOCALE_PARAM_DECL) { while (len-- > 0) dest[len] = TOUPPER ((UCHAR_T) src[len], loc); @@ -437,9 +419,7 @@ static int iso_week_days (int, int); __inline__ #endif static int -iso_week_days (yday, wday) - int yday; - int wday; +iso_week_days (int yday, int wday) { /* Add enough to the first operand of % to make it nonnegative. */ int big_enough_multiple_of_7 = (-YDAY_MINIMUM / 7 + 2) * 7; @@ -470,7 +450,7 @@ static CHAR_T const month_name[][10] = #ifdef my_strftime # define extra_args , ut, ns -# define extra_args_spec int ut; int ns; +# define extra_args_spec , int ut, int ns # define extra_args_spec_iso , int ut, int ns #else # ifdef COMPILE_WIDE @@ -517,13 +497,8 @@ static CHAR_T const month_name[][10] = anywhere, so to determine how many characters would be written, use NULL for S and (size_t) UINT_MAX for MAXSIZE. */ size_t -my_strftime (s, maxsize, format, tp extra_args LOCALE_PARAM) - CHAR_T *s; - size_t maxsize; - const CHAR_T *format; - const struct tm *tp; - extra_args_spec - LOCALE_PARAM_DECL +my_strftime (CHAR_T *s, size_t maxsize, const CHAR_T *format, + const struct tm *tp extra_args_spec LOCALE_PARAM_DECL) { #if defined _LIBC && defined USE_IN_EXTENDED_LOCALE_MODEL struct locale_data *const current = loc->__locales[LC_TIME]; @@ -1474,16 +1449,10 @@ libc_hidden_def (my_strftime) /* For Emacs we have a separate interface which corresponds to the normal strftime function plus the ut argument, but without the ns argument. */ size_t -emacs_strftimeu (s, maxsize, format, tp, ut) - char *s; - size_t maxsize; - const char *format; - const struct tm *tp; - int ut; +emacs_strftimeu (char *s, size_t maxsize, const char *format, + const struct tm *tp, int ut) { return my_strftime (s, maxsize, format, tp, ut, 0); } #endif -/* arch-tag: 662bc9c4-f8e2-41b6-bf96-b8346d0ce0d8 - (do not change this comment) */ -- cgit v1.2.1 From 654ef137a33c238befb60a27e0df1d3855fb025e Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Thu, 18 Nov 2010 08:49:30 -0800 Subject: Convert definitions to standard C. * src/strftime.c (my_strftime_gmtime_r, my_strftime_localtime_r) (tm_diff): Convert definitions to standard C. (extra_args_spec_iso): Remove, unused. --- src/strftime.c | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) (limited to 'src/strftime.c') diff --git a/src/strftime.c b/src/strftime.c index 56c2a2c0fb0..e372e86ec8d 100644 --- a/src/strftime.c +++ b/src/strftime.c @@ -179,11 +179,8 @@ extern char *tzname[]; Similarly for localtime_r. */ # if ! HAVE_TM_GMTOFF -static struct tm *my_strftime_gmtime_r (const time_t *, struct tm *); static struct tm * -my_strftime_gmtime_r (t, tp) - const time_t *t; - struct tm *tp; +my_strftime_gmtime_r (const time_t *t, struct tm *tp) { struct tm *l = gmtime (t); if (! l) @@ -192,11 +189,8 @@ my_strftime_gmtime_r (t, tp) return tp; } -static struct tm *my_strftime_localtime_r (const time_t *, struct tm *); static struct tm * -my_strftime_localtime_r (t, tp) - const time_t *t; - struct tm *tp; +my_strftime_localtime_r (const time_t *t, struct tm *tp) { struct tm *l = localtime (t); if (! l) @@ -380,11 +374,8 @@ memcpy_uppcase (CHAR_T *dest, const CHAR_T *src, size_t len LOCALE_PARAM_DECL) /* Yield the difference between *A and *B, measured in seconds, ignoring leap seconds. */ # define tm_diff ftime_tm_diff -static int tm_diff (const struct tm *, const struct tm *); static int -tm_diff (a, b) - const struct tm *a; - const struct tm *b; +tm_diff (const struct tm *a, const struct tm *b) { /* Compute intervening leap days correctly even if year is negative. Take care to avoid int overflow in leap day calculations, @@ -451,7 +442,6 @@ static CHAR_T const month_name[][10] = #ifdef my_strftime # define extra_args , ut, ns # define extra_args_spec , int ut, int ns -# define extra_args_spec_iso , int ut, int ns #else # ifdef COMPILE_WIDE # define my_strftime wcsftime @@ -462,7 +452,6 @@ static CHAR_T const month_name[][10] = # endif # define extra_args # define extra_args_spec -# define extra_args_spec_iso /* We don't have this information in general. */ # define ut 0 # define ns 0 @@ -471,15 +460,9 @@ static CHAR_T const month_name[][10] = #if !defined _LIBC && !defined(WINDOWSNT) && HAVE_TZNAME && HAVE_TZSET /* Solaris 2.5 tzset sometimes modifies the storage returned by localtime. Work around this bug by copying *tp before it might be munged. */ - size_t _strftime_copytm (char *, size_t, const char *, - const struct tm * extra_args_spec_iso); size_t - my_strftime (s, maxsize, format, tp extra_args) - CHAR_T *s; - size_t maxsize; - const CHAR_T *format; - const struct tm *tp; - extra_args_spec + my_strftime (CHAR_T *s, size_t maxsize, const CHAR_T *format, + const struct tm *tp extra_args_spec) { struct tm tmcopy; tmcopy = *tp; -- cgit v1.2.1 From 94fa383385a237b800e9096c4fb3019f5cd359ae Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Thu, 18 Nov 2010 13:39:15 -0800 Subject: * src/strftime.c (_strftime_copytm): Add declaration. --- src/strftime.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/strftime.c') diff --git a/src/strftime.c b/src/strftime.c index e372e86ec8d..5a0923e3723 100644 --- a/src/strftime.c +++ b/src/strftime.c @@ -461,6 +461,9 @@ static CHAR_T const month_name[][10] = /* Solaris 2.5 tzset sometimes modifies the storage returned by localtime. Work around this bug by copying *tp before it might be munged. */ size_t + _strftime_copytm (CHAR_T *s, size_t maxsize, const CHAR_T *format, + const struct tm *tp extra_args_spec LOCALE_PARAM_DECL); + size_t my_strftime (CHAR_T *s, size_t maxsize, const CHAR_T *format, const struct tm *tp extra_args_spec) { -- cgit v1.2.1