Coverage Report

Created: 2026-10-17 07:09

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/lighttpd1.4/src/array.h
Line
Count
Source
1
#ifndef ARRAY_H
2
#define ARRAY_H
3
#include "first.h"
4
5
#include "buffer.h"
6
7
struct data_unset; /* declaration */
8
9
struct data_methods {
10
  struct data_unset *(*copy)(const struct data_unset *src); \
11
  void (*free)(struct data_unset *p); \
12
  void (*insert_dup)(struct data_unset *dst, struct data_unset *src);
13
};
14
15
typedef enum { TYPE_STRING, TYPE_ARRAY, TYPE_INTEGER, TYPE_CONFIG, TYPE_OTHER } data_type_t;
16
#define DATA_UNSET \
17
  buffer key; \
18
  const struct data_methods *fn; /* function table */ \
19
  data_type_t type
20
21
typedef struct data_unset {
22
  DATA_UNSET;
23
} data_unset;
24
25
typedef struct {
26
  data_unset **data;
27
  data_unset **sorted;
28
29
  uint32_t used; /* <= INT32_MAX */
30
  uint32_t size;
31
} array;
32
33
typedef struct {
34
  DATA_UNSET;
35
  int ext; /*(fits in space due to alignment in 64-bit; extends 32-bit)*/
36
  buffer value;
37
} data_string;
38
39
__attribute_returns_nonnull__
40
data_string *array_data_string_init(void);
41
42
typedef struct {
43
  DATA_UNSET;
44
45
  array value;
46
} data_array;
47
48
__attribute_returns_nonnull__
49
data_array *array_data_array_init(void);
50
51
typedef struct {
52
  DATA_UNSET;
53
54
  int value;
55
} data_integer;
56
57
__attribute_returns_nonnull__
58
data_integer *array_data_integer_init(void);
59
60
__attribute_returns_nonnull__
61
array *array_init(uint32_t n);
62
63
__attribute_cold__
64
void array_copy_array(array *dst, const array *src);
65
66
__attribute_cold__
67
void array_free_data(array *a);
68
69
void array_free(array *a);
70
71
__attribute_hot__
72
void array_reset_data_strings(array *a);
73
74
__attribute_cold__
75
__attribute_nonnull__()
76
void array_insert_unique(array *a, data_unset *entry);
77
78
__attribute_cold__
79
data_unset *array_pop(array *a); /* only works on "simple" lists with autogenerated keys */
80
81
__attribute_cold__
82
__attribute_pure__
83
int array_is_vlist(const array *a);
84
85
__attribute_cold__
86
__attribute_pure__
87
int array_is_kvany(const array *a);
88
89
__attribute_cold__
90
__attribute_pure__
91
int array_is_kvarray(const array *a);
92
93
__attribute_cold__
94
__attribute_pure__
95
int array_is_kvstring(const array *a);
96
97
__attribute_pure__
98
data_unset *array_get_element_klen_ext(const array *a, int ext, const char *key, uint32_t klen);
99
100
__attribute_pure__
101
const data_unset *array_get_element_klen(const array *a, const char *key, uint32_t klen);
102
103
__attribute_cold__
104
__attribute_pure__
105
data_unset *array_get_data_unset(const array *a, const char *key, uint32_t klen);
106
107
__attribute_cold__
108
data_unset *array_extract_element_klen(array *a, const char *key, uint32_t klen); /* removes found entry from array */
109
110
__attribute_returns_nonnull__
111
int * array_get_int_ptr(array *a, const char *k, uint32_t klen);
112
113
__attribute_returns_nonnull__
114
buffer * array_get_buf_ptr_ext(array *a, int ext, const char *k, uint32_t klen);
115
116
__attribute_returns_nonnull__
117
buffer * array_get_buf_ptr(array *a, const char *k, uint32_t klen);
118
119
void array_insert_value(array *a, const char *v, uint32_t vlen);
120
121
static inline void array_set_key_value(array * const a, const char * const k, const uint32_t klen, const char * const v, const uint32_t vlen);
122
123
0
static inline void array_set_key_value(array * const a, const char * const k, const uint32_t klen, const char * const v, const uint32_t vlen) {
124
0
    buffer_copy_string_len(array_get_buf_ptr(a, k, klen), v, vlen);
125
0
}
Unexecuted instantiation: fuzz_request.c:array_set_key_value
Unexecuted instantiation: request.c:array_set_key_value
Unexecuted instantiation: array.c:array_set_key_value
Unexecuted instantiation: http_header.c:array_set_key_value
126
127
__attribute_cold__
128
__attribute_nonnull__()
129
void array_replace(array *a, data_unset *entry);
130
131
__attribute_pure__
132
data_unset * array_match_key_prefix_klen (const array * const a, const char * const s, const uint32_t slen);
133
134
__attribute_pure__
135
data_unset * array_match_key_prefix_nc_klen (const array * const a, const char * const s, const uint32_t slen);
136
137
__attribute_pure__
138
data_unset * array_match_key_prefix (const array * const a, const buffer * const b);
139
140
__attribute_pure__
141
data_unset * array_match_key_prefix_nc (const array * const a, const buffer * const b);
142
143
__attribute_pure__
144
const buffer * array_match_value_prefix (const array * const a, const buffer * const b);
145
146
__attribute_pure__
147
const buffer * array_match_value_prefix_nc (const array * const a, const buffer * const b);
148
149
__attribute_pure__
150
data_unset * array_match_key_suffix (const array * const a, const buffer * const b);
151
152
__attribute_pure__
153
data_unset * array_match_key_suffix_nc (const array * const a, const buffer * const b);
154
155
__attribute_pure__
156
const buffer * array_match_value_suffix (const array * const a, const buffer * const b);
157
158
__attribute_pure__
159
const buffer * array_match_value_suffix_nc (const array * const a, const buffer * const b);
160
161
__attribute_pure__
162
data_unset * array_match_path_or_ext (const array * const a, const buffer * const b);
163
164
#endif