php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
spprintf.c File Reference
#include "php.h"
#include <stddef.h>
#include <stdio.h>
#include <ctype.h>
#include <sys/types.h>
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <inttypes.h>
#include <locale.h>
#include "snprintf.h"
#include "zend_smart_str.h"
#include "zend_smart_string.h"

Go to the source code of this file.

Macros

#define _GNU_SOURCE
 
#define LCONV_DECIMAL_POINT   (*lconv->decimal_point)
 
#define NUL   '\0'
 
#define INT_NULL   ((int *)0)
 
#define S_NULL   "(null)"
 
#define S_NULL_LEN   6
 
#define FLOAT_DIGITS   6
 
#define EXPONENT_LENGTH   10
 
#define INS_CHAR(xbuf, ch, is_char)
 
#define INS_STRING(xbuf, str, len, is_char)
 
#define PAD_CHAR(xbuf, ch, count, is_char)
 
#define NUM_BUF_SIZE   ZEND_DOUBLE_MAX_LENGTH
 
#define NUM(c)
 
#define STR_TO_DEC(str, num)
 
#define FIX_PRECISION(adjust, precision, s, s_len)
 

Functions

PHPAPI void php_printf_to_smart_string (smart_string *buf, const char *format, va_list ap)
 
PHPAPI void php_printf_to_smart_str (smart_str *buf, const char *format, va_list ap)
 

Macro Definition Documentation

◆ _GNU_SOURCE

#define _GNU_SOURCE

Definition at line 76 of file spprintf.c.

◆ EXPONENT_LENGTH

#define EXPONENT_LENGTH   10

Definition at line 107 of file spprintf.c.

◆ FIX_PRECISION

#define FIX_PRECISION ( adjust,
precision,
s,
s_len )
Value:
do { \
if (adjust) \
while (s_len < (size_t)precision) { \
*--s = '0'; \
s_len++; \
} \
} while (0)
char s[4]
Definition cdf.c:77

Definition at line 168 of file spprintf.c.

◆ FLOAT_DIGITS

#define FLOAT_DIGITS   6

Definition at line 106 of file spprintf.c.

◆ INS_CHAR

#define INS_CHAR ( xbuf,
ch,
is_char )
Value:
do { \
if ((is_char)) { \
smart_string_appendc((smart_string *)(xbuf), (ch)); \
} else { \
smart_str_appendc((smart_str *)(xbuf), (ch)); \
} \
} while (0);
zend_long ch
Definition ffi.c:4580

Definition at line 114 of file spprintf.c.

◆ INS_STRING

#define INS_STRING ( xbuf,
str,
len,
is_char )
Value:
do { \
if ((is_char)) { \
smart_string_appendl((smart_string *)(xbuf), (str), (len)); \
} else { \
smart_str_appendl((smart_str *)(xbuf), (str), (len)); \
} \
} while (0);
size_t len
Definition apprentice.c:174

Definition at line 122 of file spprintf.c.

◆ INT_NULL

#define INT_NULL   ((int *)0)

Definition at line 101 of file spprintf.c.

◆ LCONV_DECIMAL_POINT

#define LCONV_DECIMAL_POINT   (*lconv->decimal_point)

Definition at line 95 of file spprintf.c.

◆ NUL

#define NUL   '\0'

Definition at line 100 of file spprintf.c.

◆ NUM

#define NUM ( c)
Value:
(c - '0')

Definition at line 148 of file spprintf.c.

◆ NUM_BUF_SIZE

#define NUM_BUF_SIZE   ZEND_DOUBLE_MAX_LENGTH

Definition at line 146 of file spprintf.c.

◆ PAD_CHAR

#define PAD_CHAR ( xbuf,
ch,
count,
is_char )
Value:
do { \
if ((is_char)) { \
smart_string_alloc(((smart_string *)(xbuf)), (count), 0); \
memset(((smart_string *)(xbuf))->c + ((smart_string *)(xbuf))->len, (ch), (count)); \
((smart_string *)(xbuf))->len += (count); \
} else { \
smart_str_alloc(((smart_str *)(xbuf)), (count), 0); \
memset(ZSTR_VAL(((smart_str *)(xbuf))->s) + ZSTR_LEN(((smart_str *)(xbuf))->s), (ch), (count)); \
ZSTR_LEN(((smart_str *)(xbuf))->s) += (count); \
} \
} while (0);
count(Countable|array $value, int $mode=COUNT_NORMAL)
#define ZSTR_VAL(zstr)
Definition zend_string.h:68
#define ZSTR_LEN(zstr)
Definition zend_string.h:69

Definition at line 130 of file spprintf.c.

◆ S_NULL

#define S_NULL   "(null)"

Definition at line 103 of file spprintf.c.

◆ S_NULL_LEN

#define S_NULL_LEN   6

Definition at line 104 of file spprintf.c.

◆ STR_TO_DEC

#define STR_TO_DEC ( str,
num )
Value:
do { \
num = NUM(*str++); \
while (isdigit((int)*str)) { \
num *= 10; \
num += NUM(*str++); \
if (num >= INT_MAX / 10) { \
while (isdigit((int)*str++)); \
break; \
} \
} \
} while (0)
#define INT_MAX
Definition php.h:237
#define NUM(c)
Definition snprintf.c:435

Definition at line 150 of file spprintf.c.

Function Documentation

◆ php_printf_to_smart_str()

PHPAPI void php_printf_to_smart_str ( smart_str * buf,
const char * format,
va_list ap )

Definition at line 782 of file spprintf.c.

◆ php_printf_to_smart_string()

PHPAPI void php_printf_to_smart_string ( smart_string * buf,
const char * format,
va_list ap )

Definition at line 776 of file spprintf.c.