comparison lib/nstrftime.c @ 40194:33c4cac699fe

nstrftime: tweak arg order * lib/nstrftime.c (__strftime_internal): Interchange arg order. All callers changed. Suggested by TAMUKI Shoichi in: https://lists.gnu.org/r/bug-gnulib/2019-02/msg00052.html
author Paul Eggert <eggert@cs.ucla.edu>
date Sat, 23 Feb 2019 15:07:47 -0800
parents 45dce2bf6e8a
children f5325ca01c16
comparison
equal deleted inserted replaced
40193:5fd32d128129 40194:33c4cac699fe
416 # define ns 0 416 # define ns 0
417 #endif 417 #endif
418 418
419 static size_t __strftime_internal (STREAM_OR_CHAR_T *, STRFTIME_ARG (size_t) 419 static size_t __strftime_internal (STREAM_OR_CHAR_T *, STRFTIME_ARG (size_t)
420 const CHAR_T *, const struct tm *, 420 const CHAR_T *, const struct tm *,
421 int, bool, bool * 421 bool, int, bool *
422 extra_args_spec LOCALE_PARAM); 422 extra_args_spec LOCALE_PARAM);
423 423
424 /* Write information from TP into S according to the format 424 /* Write information from TP into S according to the format
425 string FORMAT, writing no more that MAXSIZE characters 425 string FORMAT, writing no more that MAXSIZE characters
426 (including the terminating '\0') and returning number of 426 (including the terminating '\0') and returning number of
431 my_strftime (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) 431 my_strftime (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
432 const CHAR_T *format, 432 const CHAR_T *format,
433 const struct tm *tp extra_args_spec LOCALE_PARAM) 433 const struct tm *tp extra_args_spec LOCALE_PARAM)
434 { 434 {
435 bool tzset_called = false; 435 bool tzset_called = false;
436 return __strftime_internal (s, STRFTIME_ARG (maxsize) format, tp, 0, 436 return __strftime_internal (s, STRFTIME_ARG (maxsize) format, tp, false,
437 false, &tzset_called extra_args LOCALE_ARG); 437 0, &tzset_called extra_args LOCALE_ARG);
438 } 438 }
439 #if defined _LIBC && ! FPRINTFTIME 439 #if defined _LIBC && ! FPRINTFTIME
440 libc_hidden_def (my_strftime) 440 libc_hidden_def (my_strftime)
441 #endif 441 #endif
442 442
444 UPCASE indicate that the result should be converted to upper case, 444 UPCASE indicate that the result should be converted to upper case,
445 and *TZSET_CALLED indicates whether tzset has been called here. */ 445 and *TZSET_CALLED indicates whether tzset has been called here. */
446 static size_t 446 static size_t
447 __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) 447 __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
448 const CHAR_T *format, 448 const CHAR_T *format,
449 const struct tm *tp, int yr_spec, 449 const struct tm *tp, bool upcase,
450 bool upcase, bool *tzset_called 450 int yr_spec, bool *tzset_called
451 extra_args_spec LOCALE_PARAM) 451 extra_args_spec LOCALE_PARAM)
452 { 452 {
453 #if defined _LIBC && defined USE_IN_EXTENDED_LOCALE_MODEL 453 #if defined _LIBC && defined USE_IN_EXTENDED_LOCALE_MODEL
454 struct __locale_data *const current = loc->__locales[LC_TIME]; 454 struct __locale_data *const current = loc->__locales[LC_TIME];
455 #endif 455 #endif
862 #endif 862 #endif
863 863
864 subformat: 864 subformat:
865 { 865 {
866 size_t len = __strftime_internal (NULL, STRFTIME_ARG ((size_t) -1) 866 size_t len = __strftime_internal (NULL, STRFTIME_ARG ((size_t) -1)
867 subfmt, tp, yr_spec, 867 subfmt, tp, to_uppcase,
868 to_uppcase, tzset_called 868 yr_spec, tzset_called
869 extra_args LOCALE_ARG); 869 extra_args LOCALE_ARG);
870 add (len, __strftime_internal (p, 870 add (len, __strftime_internal (p,
871 STRFTIME_ARG (maxsize - i) 871 STRFTIME_ARG (maxsize - i)
872 subfmt, tp, yr_spec, 872 subfmt, tp, to_uppcase,
873 to_uppcase, tzset_called 873 yr_spec, tzset_called
874 extra_args LOCALE_ARG)); 874 extra_args LOCALE_ARG));
875 } 875 }
876 break; 876 break;
877 877
878 #if !(defined _NL_CURRENT && HAVE_STRUCT_ERA_ENTRY) 878 #if !(defined _NL_CURRENT && HAVE_STRUCT_ERA_ENTRY)