dhcpd-pools  3.0
ISC dhcpd lease usage analyser
Macros | Functions
nstrftime.c File Reference
#include <config.h>
#include "strftime.h"
#include "time-internal.h"
#include <ctype.h>
#include <time.h>
#include <limits.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
Include dependency graph for nstrftime.c:

Macros

#define MULTIBYTE_IS_FORMAT_SAFE   1
 
#define DO_MULTIBYTE   (! MULTIBYTE_IS_FORMAT_SAFE)
 
#define FALLTHROUGH   ((void) 0)
 
#define CHAR_T   char
 
#define UCHAR_T   unsigned char
 
#define L_(Str)   Str
 
#define NLW(Sym)   Sym
 
#define MEMCPY(d, s, n)   memcpy (d, s, n)
 
#define STRLEN(s)   strlen (s)
 
#define SHR(a, b)
 
#define INT_STRLEN_BOUND(t)   ((sizeof (t) * CHAR_BIT - 1) * 146 / 485 + 2)
 
#define TM_YEAR_BASE   1900
 
#define __isleap(year)   ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
 
#define FPRINTFTIME   0
 
#define STREAM_OR_CHAR_T   CHAR_T
 
#define STRFTIME_ARG(x)   x,
 
#define memset_space(P, Len)   (memset (P, ' ', Len), (P) += (Len))
 
#define memset_zero(P, Len)   (memset (P, '0', Len), (P) += (Len))
 
#define advance(P, N)   ((P) += (N))
 
#define add(n, f)
 
#define add1(C)   add (1, *p = C)
 
#define cpy(n, s)
 
#define LOCALE_PARAM
 
#define LOCALE_ARG
 
#define HELPER_LOCALE_ARG
 
#define TOUPPER(Ch, L)   toupper (Ch)
 
#define TOLOWER(Ch, L)   tolower (Ch)
 
#define ISDIGIT(Ch)   ((unsigned int) (Ch) - L_('0') <= 9)
 
#define tm_diff   ftime_tm_diff
 
#define ISO_WEEK_START_WDAY   1 /* Monday */
 
#define ISO_WEEK1_WDAY   4 /* Thursday */
 
#define YDAY_MINIMUM   (-366)
 
#define my_strftime   strftime
 
#define nl_get_alt_digit   _nl_get_alt_digit
 
#define extra_args
 
#define extra_args_spec
 
#define tz   1
 
#define ns   0
 
#define DO_NUMBER(d, v)
 
#define DO_SIGNED_NUMBER(d, negative, v)
 
#define DO_TZ_OFFSET(d, mask, v)
 
#define DO_NUMBER_SPACEPAD(d, v)
 

Functions

static CHAR_Tmemcpy_lowcase (CHAR_T *dest, const CHAR_T *src, size_t len LOCALE_PARAM)
 
static CHAR_Tmemcpy_uppcase (CHAR_T *dest, const CHAR_T *src, size_t len LOCALE_PARAM)
 
static int tm_diff (const struct tm *, const struct tm *)
 
static int iso_week_days (int, int)
 
static size_t __strftime_internal (STREAM_OR_CHAR_T *, STRFTIME_ARG(size_t) const CHAR_T *, const struct tm *, bool, bool *extra_args_spec LOCALE_PARAM)
 
size_t my_strftime (STREAM_OR_CHAR_T *s, STRFTIME_ARG(size_t maxsize) const CHAR_T *format, const struct tm *tp extra_args_spec LOCALE_PARAM)
 
static size_t __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG(size_t maxsize) const CHAR_T *format, const struct tm *tp, bool upcase, bool *tzset_called extra_args_spec LOCALE_PARAM)
 

Macro Definition Documentation

◆ __isleap

#define __isleap (   year)    ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))

Referenced by __strftime_internal().

◆ add

#define add (   n,
 
)
Value:
do \
{ \
size_t _n = (n); \
size_t _w = (width < 0 ? 0 : width); \
size_t _incr = _n < _w ? _w : _n; \
if (_incr >= maxsize - i) \
return 0; \
if (p) \
{ \
if (digits == 0 && _n < _w) \
{ \
size_t _delta = width - _n; \
if (pad == L_('0')) \
memset_zero (p, _delta); \
memset_space (p, _delta); \
} \
f; \
advance (p, _n); \
} \
i += _incr; \
} while (0)
#define L_(Str)
Definition: nstrftime.c:92
#define memset_space(P, Len)
Definition: nstrftime.c:159

Referenced by __strftime_internal().

◆ add1

#define add1 (   C)    add (1, *p = C)

Referenced by __strftime_internal().

◆ advance

#define advance (   P,
 
)    ((P) += (N))

◆ CHAR_T

#define CHAR_T   char

◆ cpy

#define cpy (   n,
 
)
Value:
add ((n), \
if (to_lowcase) \
memcpy_lowcase (p, (s), _n LOCALE_ARG); \
else if (to_uppcase) \
memcpy_uppcase (p, (s), _n LOCALE_ARG); \
MEMCPY ((void *) p, (void const *) (s), _n))
#define LOCALE_ARG
Definition: nstrftime.c:263
#define add(n, f)
Definition: nstrftime.c:169
static CHAR_T * memcpy_uppcase(CHAR_T *dest, const CHAR_T *src, size_t len LOCALE_PARAM)
Definition: nstrftime.c:330
static CHAR_T * memcpy_lowcase(CHAR_T *dest, const CHAR_T *src, size_t len LOCALE_PARAM)
Definition: nstrftime.c:319
#define MEMCPY(d, s, n)
Definition: nstrftime.c:95

Referenced by __strftime_internal().

◆ DO_MULTIBYTE

#define DO_MULTIBYTE   (! MULTIBYTE_IS_FORMAT_SAFE)

◆ DO_NUMBER

#define DO_NUMBER (   d,
 
)
Value:
do \
{ \
digits = d; \
number_value = v; \
goto do_number; \
} \
while (0)

Referenced by __strftime_internal().

◆ DO_NUMBER_SPACEPAD

#define DO_NUMBER_SPACEPAD (   d,
 
)
Value:
do \
{ \
digits = d; \
number_value = v; \
goto do_number_spacepad; \
} \
while (0)

Referenced by __strftime_internal().

◆ DO_SIGNED_NUMBER

#define DO_SIGNED_NUMBER (   d,
  negative,
 
)
Value:
do \
{ \
digits = d; \
negative_number = negative; \
u_number_value = v; \
goto do_signed_number; \
} \
while (0)

Referenced by __strftime_internal().

◆ DO_TZ_OFFSET

#define DO_TZ_OFFSET (   d,
  mask,
 
)
Value:
do \
{ \
digits = d; \
tz_colon_mask = mask; \
u_number_value = v; \
goto do_tz_offset; \
} \
while (0)

Referenced by __strftime_internal().

◆ extra_args

#define extra_args

Referenced by __strftime_internal(), and my_strftime().

◆ extra_args_spec

#define extra_args_spec

◆ FALLTHROUGH

#define FALLTHROUGH   ((void) 0)

Referenced by __strftime_internal().

◆ FPRINTFTIME

#define FPRINTFTIME   0

◆ HELPER_LOCALE_ARG

#define HELPER_LOCALE_ARG

Referenced by __strftime_internal().

◆ INT_STRLEN_BOUND

#define INT_STRLEN_BOUND (   t)    ((sizeof (t) * CHAR_BIT - 1) * 146 / 485 + 2)

Referenced by __strftime_internal().

◆ ISDIGIT

#define ISDIGIT (   Ch)    ((unsigned int) (Ch) - L_('0') <= 9)

Referenced by __strftime_internal().

◆ ISO_WEEK1_WDAY

#define ISO_WEEK1_WDAY   4 /* Thursday */

Referenced by iso_week_days().

◆ ISO_WEEK_START_WDAY

#define ISO_WEEK_START_WDAY   1 /* Monday */

Referenced by iso_week_days().

◆ L_

#define L_ (   Str)    Str

Referenced by __strftime_internal().

◆ LOCALE_ARG

#define LOCALE_ARG

Referenced by __strftime_internal(), and my_strftime().

◆ LOCALE_PARAM

#define LOCALE_PARAM

Referenced by memcpy_lowcase().

◆ MEMCPY

#define MEMCPY (   d,
  s,
 
)    memcpy (d, s, n)

◆ memset_space

#define memset_space (   P,
  Len 
)    (memset (P, ' ', Len), (P) += (Len))

Referenced by __strftime_internal().

◆ memset_zero

#define memset_zero (   P,
  Len 
)    (memset (P, '0', Len), (P) += (Len))

Referenced by __strftime_internal().

◆ MULTIBYTE_IS_FORMAT_SAFE

#define MULTIBYTE_IS_FORMAT_SAFE   1

◆ my_strftime

#define my_strftime   strftime

Referenced by my_strftime().

◆ nl_get_alt_digit

#define nl_get_alt_digit   _nl_get_alt_digit

Referenced by __strftime_internal().

◆ NLW

#define NLW (   Sym)    Sym

Referenced by __strftime_internal().

◆ ns

#define ns   0

Referenced by __strftime_internal().

◆ SHR

#define SHR (   a,
 
)
Value:
(-1 >> 1 == -1 \
? (a) >> (b) \
: (a) / (1 << (b)) - ((a) % (1 << (b)) < 0))

Referenced by tm_diff().

◆ STREAM_OR_CHAR_T

#define STREAM_OR_CHAR_T   CHAR_T

Referenced by __strftime_internal().

◆ STRFTIME_ARG

#define STRFTIME_ARG (   x)    x,

Referenced by __strftime_internal(), and my_strftime().

◆ STRLEN

#define STRLEN (   s)    strlen (s)

Referenced by __strftime_internal().

◆ tm_diff

#define tm_diff   ftime_tm_diff

Referenced by __strftime_internal().

◆ TM_YEAR_BASE

#define TM_YEAR_BASE   1900

Referenced by __strftime_internal(), and tm_diff().

◆ TOLOWER

#define TOLOWER (   Ch,
 
)    tolower (Ch)

Referenced by memcpy_lowcase().

◆ TOUPPER

#define TOUPPER (   Ch,
 
)    toupper (Ch)

Referenced by memcpy_uppcase().

◆ tz

#define tz   1

Referenced by __strftime_internal(), tzalloc(), and tzset().

◆ UCHAR_T

#define UCHAR_T   unsigned char

Referenced by memcpy_lowcase(), and memcpy_uppcase().

◆ YDAY_MINIMUM

#define YDAY_MINIMUM   (-366)

Referenced by iso_week_days().

Function Documentation

◆ __strftime_internal() [1/2]

static size_t __strftime_internal ( STREAM_OR_CHAR_T ,
STRFTIME_ARG(size_t) const CHAR_T ,
const struct tm *  ,
bool  ,
bool *extra_args_spec  LOCALE_PARAM 
)
static

Referenced by __strftime_internal(), and my_strftime().

◆ __strftime_internal() [2/2]

static size_t __strftime_internal ( STREAM_OR_CHAR_T s,
STRFTIME_ARG(size_t maxsize) const CHAR_T format,
const struct tm *  tp,
bool  upcase,
bool *tzset_called extra_args_spec  LOCALE_PARAM 
)
static
Here is the call graph for this function:

◆ iso_week_days()

static int iso_week_days ( int  yday,
int  wday 
)
static

Referenced by __strftime_internal().

◆ memcpy_lowcase()

static CHAR_T * memcpy_lowcase ( CHAR_T dest,
const CHAR_T src,
size_t len  LOCALE_PARAM 
)
static
Here is the call graph for this function:

◆ memcpy_uppcase()

static CHAR_T * memcpy_uppcase ( CHAR_T dest,
const CHAR_T src,
size_t len  LOCALE_PARAM 
)
static

Referenced by memcpy_lowcase().

◆ my_strftime()

size_t my_strftime ( STREAM_OR_CHAR_T s,
STRFTIME_ARG(size_t maxsize) const CHAR_T format,
const struct tm *tp extra_args_spec  LOCALE_PARAM 
)
Here is the call graph for this function:

◆ tm_diff()

static int tm_diff ( const struct tm *  a,
const struct tm *  b 
)
static