gsasl  1.10.0
About: GNU SASL is an implementation of the Simple Authentication and Security Layer (SASL). Development version.
  Fossies Dox: gsasl-1.10.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

vasnprintf.c File Reference
#include <config.h>
#include <alloca.h>
#include "vasnprintf.h"
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <limits.h>
#include <float.h>
#include "printf-parse.h"
#include "xsize.h"
#include "attribute.h"
#include "verify.h"
Include dependency graph for vasnprintf.c:

Go to the source code of this file.


#define _GNU_SOURCE   1
#define VASNPRINTF   vasnprintf
#define FCHAR_T   char
#define DCHAR_T   char
#define TCHAR_T   char
#define DCHAR_IS_TCHAR   1
#define DIRECTIVE   char_directive
#define DIRECTIVES   char_directives
#define PRINTF_PARSE   printf_parse
#define DCHAR_CPY   memcpy
#define DCHAR_SET   memset
#define USE_SNPRINTF   1
#define SNPRINTF   _snprintf
#define USE_MSVC__SNPRINTF   1
#define IF_LINT(Code)   /* empty */
#define exp   expo
#define remainder   rem
#define local_strnlen_defined   1
#define local_wcslen   wcslen
#define local_wcrtomb(S, WC, PS)   wctomb ((S), (WC))
#define MAX_ROOM_NEEDED   max_room_needed
#define CLEANUP()
#define ENSURE_ALLOCATION(needed)
#define prec_ourselves   0
#define pad_ourselves   0
#define TCHARS_PER_DCHAR   (sizeof (DCHAR_T) / sizeof (TCHAR_T))
#define SNPRINTF_BUF(arg)


static size_t local_strnlen (const char *string, size_t maxlen)
static size_t max_room_needed (const arguments *ap, size_t arg_index, char conversion, arg_type type, int flags, size_t width, int has_precision, size_t precision, int pad_ourselves)
char * vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args)

Macro Definition Documentation


#define _GNU_SOURCE   1

Definition at line 57 of file vasnprintf.c.


#define CLEANUP ( )
if (d.dir != d.direct_alloc_dir) \
free (d.dir); \
if (a.arg != a.direct_alloc_arg) \
free (a.arg);


#define DCHAR_CPY   memcpy

Definition at line 151 of file vasnprintf.c.


#define DCHAR_IS_TCHAR   1

Definition at line 147 of file vasnprintf.c.


#define DCHAR_SET   memset

Definition at line 152 of file vasnprintf.c.


#define DCHAR_T   char

Definition at line 145 of file vasnprintf.c.


#define DIRECTIVE   char_directive

Definition at line 148 of file vasnprintf.c.


#define DIRECTIVES   char_directives

Definition at line 149 of file vasnprintf.c.


#define ENSURE_ALLOCATION (   needed)
if ((needed) > allocated) \
{ \
size_t memory_size; \
DCHAR_T *memory; \
allocated = (allocated > 0 ? xtimes (allocated, 2) : 12); \
if ((needed) > allocated) \
allocated = (needed); \
memory_size = xtimes (allocated, sizeof (DCHAR_T)); \
if (size_overflow_p (memory_size)) \
goto out_of_memory; \
if (result == resultbuf || result == NULL) \
memory = (DCHAR_T *) malloc (memory_size); \
else \
memory = (DCHAR_T *) realloc (result, memory_size); \
if (memory == NULL) \
goto out_of_memory; \
if (result == resultbuf && length > 0) \
DCHAR_CPY (memory, result, length); \
result = memory; \
#define NULL
#define DCHAR_T
Definition: vasnprintf.c:145
#define size_overflow_p(SIZE)
Definition: xsize.h:100
#define xtimes(N, ELSIZE)
Definition: xsize.h:96

◆ exp

#define exp   expo

Definition at line 218 of file vasnprintf.c.


#define FCHAR_T   char

Definition at line 144 of file vasnprintf.c.


#define IF_LINT (   Code)    /* empty */

Definition at line 212 of file vasnprintf.c.

◆ local_strnlen_defined

#define local_strnlen_defined   1

Definition at line 227 of file vasnprintf.c.

◆ local_wcrtomb

#define local_wcrtomb (   S,
)    wctomb ((S), (WC))

Definition at line 343 of file vasnprintf.c.

◆ local_wcslen

#define local_wcslen   wcslen

Definition at line 240 of file vasnprintf.c.


#define MAX_ROOM_NEEDED   max_room_needed

Definition at line 1610 of file vasnprintf.c.

◆ pad_ourselves

#define pad_ourselves   0

◆ prec_ourselves

#define prec_ourselves   0


#define PRINTF_PARSE   printf_parse

Definition at line 150 of file vasnprintf.c.

◆ remainder

#define remainder   rem

Definition at line 220 of file vasnprintf.c.


#define SNPRINTF   _snprintf

Definition at line 194 of file vasnprintf.c.


#define SNPRINTF_BUF (   arg)
switch (prefix_count) \
{ \
case 0: \
retcount = SNPRINTF ((TCHAR_T *) (result + length), \
maxlen, buf, \
arg, &count); \
break; \
case 1: \
retcount = SNPRINTF ((TCHAR_T *) (result + length), \
maxlen, buf, \
prefixes[0], arg, &count); \
break; \
case 2: \
retcount = SNPRINTF ((TCHAR_T *) (result + length), \
maxlen, buf, \
prefixes[0], prefixes[1], arg, \
&count); \
break; \
default: \
abort (); \
#define TCHAR_T
Definition: vasnprintf.c:146
#define SNPRINTF
Definition: vasnprintf.c:194
char buf[4]
Definition: mbrtowc-impl.h:39


#define TCHAR_T   char

Definition at line 146 of file vasnprintf.c.


#define TCHARS_PER_DCHAR   (sizeof (DCHAR_T) / sizeof (TCHAR_T))


#define USE_MSVC__SNPRINTF   1

Definition at line 195 of file vasnprintf.c.


#define USE_SNPRINTF   1

Definition at line 181 of file vasnprintf.c.


#define VASNPRINTF   vasnprintf

Definition at line 143 of file vasnprintf.c.

Function Documentation

◆ local_strnlen()

static size_t local_strnlen ( const char *  string,
size_t  maxlen 

Definition at line 229 of file vasnprintf.c.

References memchr(), and size_t().

Referenced by max_room_needed().

◆ max_room_needed()

static size_t max_room_needed ( const arguments ap,
size_t  arg_index,
char  conversion,
arg_type  type,
int  flags,
size_t  width,
int  has_precision,
size_t  precision,
int  pad_ourselves 

◆ vasnprintf()

char* vasnprintf ( char *  resultbuf,
size_t lengthp,
const char *  format,
va_list  args 

Definition at line 1852 of file vasnprintf.c.

References argument::a, argument::a_char, argument::a_count_int_pointer, argument::a_count_longint_pointer, argument::a_count_longlongint_pointer, argument::a_count_schar_pointer, argument::a_count_short_pointer, argument::a_double, argument::a_int, argument::a_longdouble, argument::a_longint, argument::a_longlongint, argument::a_pointer, argument::a_schar, argument::a_short, argument::a_string, argument::a_uchar, argument::a_uint, argument::a_ulongint, argument::a_ulonglongint, argument::a_ushort, alloca, arguments::arg, ARG_NONE, BEGIN_LONG_DOUBLE_ROUNDING, buf, CLEANUP, DCHAR_CPY, DCHAR_IS_TCHAR, DCHAR_SET, DCHAR_T, DECL_LONG_DOUBLE_ROUNDING, DIRECTIVE, DIRECTIVES, EILSEQ, END_LONG_DOUBLE_ROUNDING, ENSURE_ALLOCATION, EOVERFLOW, FALLTHROUGH, FCHAR_T, FLAG_ALT, FLAG_GROUP, FLAG_LEFT, FLAG_SHOWSIGN, FLAG_SPACE, FLAG_ZERO, IF_LINT, local_wcrtomb, local_wcslen, locale_charset(), MAX_ROOM_NEEDED, mbstate_t, mbtowc(), NULL, p, pad_ourselves, prec_ourselves, PRINTF_FETCHARGS, PRINTF_PARSE, rc, size_overflow_p, SNPRINTF, SNPRINTF_BUF, TCHAR_T, TCHARS_PER_DCHAR, tmp, argument::type, TYPE_CHAR, TYPE_COUNT_INT_POINTER, TYPE_COUNT_LONGINT_POINTER, TYPE_COUNT_LONGLONGINT_POINTER, TYPE_COUNT_SCHAR_POINTER, TYPE_COUNT_SHORT_POINTER, TYPE_DOUBLE, TYPE_INT, TYPE_LONGDOUBLE, TYPE_LONGINT, TYPE_LONGLONGINT, TYPE_POINTER, TYPE_SCHAR, TYPE_SHORT, TYPE_STRING, TYPE_UCHAR, TYPE_UINT, TYPE_ULONGINT, TYPE_ULONGLONGINT, TYPE_USHORT, u16_strlen(), u16_strmblen(), u32_strlen(), u32_strmblen(), u8_strlen(), u8_strmblen(), uint16_t, uint32_t, uint8_t, verify, wchar_t, wint_t, xmax(), xsum(), xsum3(), xsum4(), and xtimes.

Referenced by asnprintf(), snprintf(), and vasprintf().