php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
php_ini_builder.h
Go to the documentation of this file.
1/*
2 +----------------------------------------------------------------------+
3 | Copyright (c) The PHP Group |
4 +----------------------------------------------------------------------+
5 | This source file is subject to version 3.01 of the PHP license, |
6 | that is bundled with this package in the file LICENSE, and is |
7 | available through the world-wide-web at the following url: |
8 | https://www.php.net/license/3_01.txt |
9 | If you did not receive a copy of the PHP license and are unable to |
10 | obtain it through the world-wide-web, please send a note to |
11 | license@php.net so we can mail you a copy immediately. |
12 +----------------------------------------------------------------------+
13 | Authors: Max Kellermann <max.kellermann@ionos.com> |
14 +----------------------------------------------------------------------+
15*/
16
17#ifndef PHP_INI_BUILDER_H
18#define PHP_INI_BUILDER_H
19
20#include "php.h"
21
27 char *value;
28 size_t length;
29};
30
32
33static inline void php_ini_builder_init(struct php_ini_builder *b)
34{
35 b->value = NULL;
36 b->length = 0;
37}
38
39static inline void php_ini_builder_deinit(struct php_ini_builder *b)
40{
41 free(b->value);
42}
43
47static inline char *php_ini_builder_finish(struct php_ini_builder *b)
48{
49 if (b->value != NULL) {
50 /* null-terminate the string */
51 b->value[b->length] = '\0';
52 }
53
54 return b->value;
55}
56
62static inline void php_ini_builder_realloc(struct php_ini_builder *b, size_t delta)
63{
64 /* reserve enough space for the null terminator */
65 b->value = realloc(b->value, b->length + delta + 1);
66}
67
74PHPAPI void php_ini_builder_prepend(struct php_ini_builder *b, const char *src, size_t length);
75
76#define php_ini_builder_prepend_literal(b, l) php_ini_builder_prepend(b, l, strlen(l))
77
81PHPAPI void php_ini_builder_unquoted(struct php_ini_builder *b, const char *name, size_t name_length, const char *value, size_t value_length);
82
86PHPAPI void php_ini_builder_quoted(struct php_ini_builder *b, const char *name, size_t name_length, const char *value, size_t value_length);
87
91PHPAPI void php_ini_builder_define(struct php_ini_builder *b, const char *arg);
92
94
95#endif
zval * arg
Definition ffi.c:3975
#define NULL
Definition gdcache.h:45
#define PHPAPI
Definition php.h:71
PHPAPI void php_ini_builder_define(struct php_ini_builder *b, const char *arg)
PHPAPI void php_ini_builder_quoted(struct php_ini_builder *b, const char *name, size_t name_length, const char *value, size_t value_length)
PHPAPI void php_ini_builder_unquoted(struct php_ini_builder *b, const char *name, size_t name_length, const char *value, size_t value_length)
PHPAPI void php_ini_builder_prepend(struct php_ini_builder *b, const char *src, size_t length)
#define END_EXTERN_C()
#define BEGIN_EXTERN_C()
zend_string * name
value