aboutsummaryrefslogtreecommitdiffstats
path: root/src/strftime.c
diff options
context:
space:
mode:
authorDan Nicolaescu2010-11-15 22:44:51 -0800
committerDan Nicolaescu2010-11-15 22:44:51 -0800
commitd2762c86419d6d55bf59fd62ea1c9fa3525411c0 (patch)
treee1ba41021fe7ba2f29a79a51f23785f352547dc2 /src/strftime.c
parent0073e0313a029f5bba231a147f0d4f1bb029dd43 (diff)
downloademacs-d2762c86419d6d55bf59fd62ea1c9fa3525411c0.tar.gz
emacs-d2762c86419d6d55bf59fd62ea1c9fa3525411c0.zip
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 <stdlib.h>, 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.
Diffstat (limited to 'src/strftime.c')
-rw-r--r--src/strftime.c49
1 files changed, 9 insertions, 40 deletions
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" */
318# undef _NL_CURRENT 318# undef _NL_CURRENT
319# define _NL_CURRENT(category, item) \ 319# define _NL_CURRENT(category, item) \
320 (current->values[_NL_ITEM_INDEX (item)].string) 320 (current->values[_NL_ITEM_INDEX (item)].string)
321# define LOCALE_PARAM , loc
322# define LOCALE_ARG , loc 321# define LOCALE_ARG , loc
323# define LOCALE_PARAM_DECL __locale_t loc; 322# define LOCALE_PARAM_DECL , __locale_t loc
324# define LOCALE_PARAM_PROTO , __locale_t loc
325# define HELPER_LOCALE_ARG , current 323# define HELPER_LOCALE_ARG , current
326#else 324#else
327# define LOCALE_PARAM
328# define LOCALE_PARAM_PROTO
329# define LOCALE_ARG 325# define LOCALE_ARG
330# define LOCALE_PARAM_DECL 326# define LOCALE_PARAM_DECL
331# ifdef _LIBC 327# ifdef _LIBC
@@ -363,30 +359,16 @@ static const CHAR_T zeroes[16] = /* "0000000000000000" */
363 more reliable way to accept other sets of digits. */ 359 more reliable way to accept other sets of digits. */
364#define ISDIGIT(Ch) ((unsigned int) (Ch) - L_('0') <= 9) 360#define ISDIGIT(Ch) ((unsigned int) (Ch) - L_('0') <= 9)
365 361
366static CHAR_T *memcpy_lowcase (CHAR_T *dest, const CHAR_T *src,
367 size_t len LOCALE_PARAM_PROTO);
368
369static CHAR_T * 362static CHAR_T *
370memcpy_lowcase (dest, src, len LOCALE_PARAM) 363memcpy_lowcase (CHAR_T *dest, const CHAR_T *src, size_t len LOCALE_PARAM_DECL)
371 CHAR_T *dest;
372 const CHAR_T *src;
373 size_t len;
374 LOCALE_PARAM_DECL
375{ 364{
376 while (len-- > 0) 365 while (len-- > 0)
377 dest[len] = TOLOWER ((UCHAR_T) src[len], loc); 366 dest[len] = TOLOWER ((UCHAR_T) src[len], loc);
378 return dest; 367 return dest;
379} 368}
380 369
381static CHAR_T *memcpy_uppcase (CHAR_T *dest, const CHAR_T *src,
382 size_t len LOCALE_PARAM_PROTO);
383
384static CHAR_T * 370static CHAR_T *
385memcpy_uppcase (dest, src, len LOCALE_PARAM) 371memcpy_uppcase (CHAR_T *dest, const CHAR_T *src, size_t len LOCALE_PARAM_DECL)
386 CHAR_T *dest;
387 const CHAR_T *src;
388 size_t len;
389 LOCALE_PARAM_DECL
390{ 372{
391 while (len-- > 0) 373 while (len-- > 0)
392 dest[len] = TOUPPER ((UCHAR_T) src[len], loc); 374 dest[len] = TOUPPER ((UCHAR_T) src[len], loc);
@@ -437,9 +419,7 @@ static int iso_week_days (int, int);
437__inline__ 419__inline__
438#endif 420#endif
439static int 421static int
440iso_week_days (yday, wday) 422iso_week_days (int yday, int wday)
441 int yday;
442 int wday;
443{ 423{
444 /* Add enough to the first operand of % to make it nonnegative. */ 424 /* Add enough to the first operand of % to make it nonnegative. */
445 int big_enough_multiple_of_7 = (-YDAY_MINIMUM / 7 + 2) * 7; 425 int big_enough_multiple_of_7 = (-YDAY_MINIMUM / 7 + 2) * 7;
@@ -470,7 +450,7 @@ static CHAR_T const month_name[][10] =
470 450
471#ifdef my_strftime 451#ifdef my_strftime
472# define extra_args , ut, ns 452# define extra_args , ut, ns
473# define extra_args_spec int ut; int ns; 453# define extra_args_spec , int ut, int ns
474# define extra_args_spec_iso , int ut, int ns 454# define extra_args_spec_iso , int ut, int ns
475#else 455#else
476# ifdef COMPILE_WIDE 456# ifdef COMPILE_WIDE
@@ -517,13 +497,8 @@ static CHAR_T const month_name[][10] =
517 anywhere, so to determine how many characters would be 497 anywhere, so to determine how many characters would be
518 written, use NULL for S and (size_t) UINT_MAX for MAXSIZE. */ 498 written, use NULL for S and (size_t) UINT_MAX for MAXSIZE. */
519size_t 499size_t
520my_strftime (s, maxsize, format, tp extra_args LOCALE_PARAM) 500my_strftime (CHAR_T *s, size_t maxsize, const CHAR_T *format,
521 CHAR_T *s; 501 const struct tm *tp extra_args_spec LOCALE_PARAM_DECL)
522 size_t maxsize;
523 const CHAR_T *format;
524 const struct tm *tp;
525 extra_args_spec
526 LOCALE_PARAM_DECL
527{ 502{
528#if defined _LIBC && defined USE_IN_EXTENDED_LOCALE_MODEL 503#if defined _LIBC && defined USE_IN_EXTENDED_LOCALE_MODEL
529 struct locale_data *const current = loc->__locales[LC_TIME]; 504 struct locale_data *const current = loc->__locales[LC_TIME];
@@ -1474,16 +1449,10 @@ libc_hidden_def (my_strftime)
1474/* For Emacs we have a separate interface which corresponds to the normal 1449/* For Emacs we have a separate interface which corresponds to the normal
1475 strftime function plus the ut argument, but without the ns argument. */ 1450 strftime function plus the ut argument, but without the ns argument. */
1476size_t 1451size_t
1477emacs_strftimeu (s, maxsize, format, tp, ut) 1452emacs_strftimeu (char *s, size_t maxsize, const char *format,
1478 char *s; 1453 const struct tm *tp, int ut)
1479 size_t maxsize;
1480 const char *format;
1481 const struct tm *tp;
1482 int ut;
1483{ 1454{
1484 return my_strftime (s, maxsize, format, tp, ut, 0); 1455 return my_strftime (s, maxsize, format, tp, ut, 0);
1485} 1456}
1486#endif 1457#endif
1487 1458
1488/* arch-tag: 662bc9c4-f8e2-41b6-bf96-b8346d0ce0d8
1489 (do not change this comment) */