Asterisk - The Open Source Telephony Project GIT-master-f36a736
stringfields.h
Go to the documentation of this file.
1/*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 2006, Digium, Inc.
5 *
6 * Kevin P. Fleming <kpfleming@digium.com>
7 *
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
13 *
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
17 */
18
19/*! \file
20 \page Stringfields String Fields
21 \brief String fields in structures
22
23 This file contains objects and macros used to manage string
24 fields in structures without requiring them to be allocated
25 as fixed-size buffers or requiring individual allocations for
26 for each field.
27
28 Using this functionality is quite simple. An example structure
29 with three fields is defined like this:
30
31 \code
32 struct sample_fields {
33 int x1;
34 AST_DECLARE_STRING_FIELDS(
35 AST_STRING_FIELD(foo);
36 AST_STRING_FIELD(bar);
37 AST_STRING_FIELD(blah);
38 );
39 long x2;
40 };
41 \endcode
42
43 When an instance of this structure is allocated (either statically or
44 dynamically), the fields and the pool of storage for them must be
45 initialized:
46
47 \code
48 struct sample_fields *x;
49
50 x = ast_calloc(1, sizeof(*x));
51 if (x == NULL || ast_string_field_init(x, 252)) {
52 if (x)
53 ast_free(x);
54 x = NULL;
55 ... handle error
56 }
57 \endcode
58
59 Fields will default to pointing to an empty string, and will revert to
60 that when ast_string_field_set() is called with a NULL argument.
61 A string field will \b never contain NULL.
62
63 ast_string_field_init(x, 0) will reset fields to the
64 initial value while keeping the pool allocated.
65
66 Reading the fields is much like using 'const char * const' fields in the
67 structure: you cannot write to the field or to the memory it points to.
68
69 Writing to the fields must be done using the wrapper macros listed below;
70 and assignments are always by value (i.e. strings are copied):
71 * ast_string_field_set() stores a simple value;
72 * ast_string_field_build() builds the string using a printf-style format;
73 * ast_string_field_build_va() is the varargs version of the above;
74 * variants of these function allow passing a pointer to the field
75 as an argument.
76
77 \code
78 ast_string_field_set(x, foo, "infinite loop");
79 ast_string_field_set(x, foo, NULL); // set to an empty string
80 ast_string_field_ptr_set(x, &x->bar, "right way");
81
82 ast_string_field_build(x, blah, "%d %s", zipcode, city);
83 ast_string_field_ptr_build(x, &x->blah, "%d %s", zipcode, city);
84
85 ast_string_field_build_va(x, bar, fmt, args)
86 ast_string_field_ptr_build_va(x, &x->bar, fmt, args)
87 \endcode
88
89 When the structure instance is no longer needed, the fields
90 and their storage pool must be freed:
91
92 \code
93 ast_string_field_free_memory(x);
94 ast_free(x);
95 \endcode
96
97 A new feature "Extended String Fields" has been added in 13.9.0.
98
99 An extended field is one that is declared outside the AST_DECLARE_STRING_FIELDS
100 block but still inside the parent structure. It's most useful for extending
101 structures where adding a new string field to an existing AST_DECLARE_STRING_FIELDS
102 block would break ABI compatibility.
103
104 Example:
105
106 \code
107 struct original_structure_version {
108 AST_DECLARE_STRING_FIELDS(
109 AST_STRING_FIELD(foo);
110 AST_STRING_FIELD(bar);
111 );
112 int x1;
113 int x2;
114 };
115 \endcode
116
117 Adding "blah" to the existing string fields breaks ABI compatibility because it changes
118 the offsets of x1 and x2.
119
120 \code
121 struct new_structure_version {
122 AST_DECLARE_STRING_FIELDS(
123 AST_STRING_FIELD(foo);
124 AST_STRING_FIELD(bar);
125 AST_STRING_FIELD(blah);
126 );
127 int x1;
128 int x2;
129 };
130 \endcode
131
132 However, adding "blah" as an extended string field to the end of the structure doesn't break
133 ABI compatibility but still allows the use of the existing pool.
134
135 \code
136 struct new_structure_version {
137 AST_DECLARE_STRING_FIELDS(
138 AST_STRING_FIELD(foo);
139 AST_STRING_FIELD(bar);
140 );
141 int x1;
142 int x2;
143 AST_STRING_FIELD_EXTENDED(blah);
144 };
145 \endcode
146
147 The only additional step required is to call ast_string_field_init_extended so the
148 pool knows about the new field. It must be called AFTER ast_string_field_init or
149 ast_calloc_with_stringfields. Although ast_calloc_with_stringfields is used in the
150 sample below, it's not necessary for extended string fields.
151
152 \code
153
154 struct new_structure_version *x = ast_calloc_with_stringfields(1, struct new_structure_version, 252);
155 if (!x) {
156 return;
157 }
158
159 ast_string_field_init_extended(x, blah);
160 \endcode
161
162 The new field can now be treated just like any other string field and it's storage will
163 be released with the rest of the string fields.
164
165 \code
166 ast_string_field_set(x, foo, "infinite loop");
167 ast_stringfield_free_memory(x);
168 ast_free(x);
169 \endcode
170
171 This completes the API description.
172*/
173
174#ifndef _ASTERISK_STRINGFIELDS_H
175#define _ASTERISK_STRINGFIELDS_H
176
177#include "asterisk/inline_api.h"
178#include "asterisk/vector.h"
179
180/*!
181 \internal
182 \brief An opaque type for managed string fields in structures
183
184 Don't declare instances of this type directly; use the AST_STRING_FIELD()
185 macro instead.
186
187 In addition to the string itself, the amount of space allocated for the
188 field is stored in the two bytes immediately preceding it.
189*/
190typedef const char * ast_string_field;
191
192/* the type of storage used to track how many bytes were allocated for a field */
193
195
196/*!
197 \internal
198 \brief A constant empty string used for fields that have no other value
199*/
200extern const char *__ast_string_field_empty;
201
202/*!
203 \internal
204 \brief Structure used to hold a pool of space for string fields
205 \note base is aligned so base+used can stay aligned by incrementing used with
206 aligned numbers only
207*/
209 struct ast_string_field_pool *prev; /*!< pointer to the previous pool, if any */
210 size_t size; /*!< the total size of the pool */
211 size_t used; /*!< the space used in the pool */
212 size_t active; /*!< the amount of space actively in use by fields */
213 char base[0] __attribute__((aligned(__alignof__(ast_string_field_allocation)))); /*!< storage space for the fields */
214};
215
216/*!
217 \internal
218 \brief The definition for the string field vector used for compare and copy
219 \since 13.9.0
220*/
222
223/*!
224 \internal
225 \brief Structure used to manage the storage for a set of string fields.
226*/
228 ast_string_field last_alloc; /*!< the last field allocated */
229 struct ast_string_field_pool *embedded_pool; /*!< pointer to the embedded pool, if any */
230 struct ast_string_field_vector string_fields; /*!< field vector for compare and copy */
231};
232
233/*!
234 \internal
235 \brief Attempt to 'grow' an already allocated field to a larger size
236 \param mgr Pointer to the pool manager structure
237 \param pool_head Pointer to the current pool
238 \param needed Amount of space needed for this field
239 \param ptr Pointer to a field within the structure
240 \retval zero on success
241 \retval non-zero on failure
242
243 This function will attempt to increase the amount of space allocated to
244 an existing field to the amount requested; this is only possible if the
245 field was the last field allocated from the current storage pool and
246 the pool has enough space available. If so, the additional space will be
247 allocated to this field and the field's address will not be changed.
248*/
250 struct ast_string_field_pool **pool_head, size_t needed,
251 const ast_string_field *ptr);
252
253/*!
254 \internal
255 \brief Allocate space for a field
256 \param mgr Pointer to the pool manager structure
257 \param pool_head Pointer to the current pool
258 \param needed Amount of space needed for this field
259 \param file, lineno, func
260 \retval NULL on failure
261 \return an address for the field on success.
262
263 This function will allocate the requested amount of space from
264 the field pool. If the requested amount of space is not available,
265 an additional pool will be allocated.
266*/
268 struct ast_string_field_pool **pool_head, size_t needed,
269 const char *file, int lineno, const char *func);
270
271/*!
272 \internal
273 \brief Set a field to a complex (built) value
274 \param mgr Pointer to the pool manager structure
275 \param pool_head Pointer to the current pool
276 \param ptr Pointer to a field within the structure
277 \param format printf-style format string
278 \param file, lineno, func
279*/
280void __ast_string_field_ptr_build(const char *file, int lineno, const char *func,
281 struct ast_string_field_mgr *mgr, struct ast_string_field_pool **pool_head,
282 ast_string_field *ptr, const char *format, ...) __attribute__((format(printf, 7, 8)));
283
284/*!
285 \internal
286 \brief Set a field to a complex (built) value
287 \param mgr Pointer to the pool manager structure
288 \param pool_head Pointer to the current pool
289 \param ptr Pointer to a field within the structure
290 \param format printf-style format string
291 \param ap va_list of the args for the format_string
292 \param file, lineno, func
293*/
295 struct ast_string_field_pool **pool_head,
296 ast_string_field *ptr, const char *format, va_list ap,
297 const char *file, int lineno, const char *func) __attribute__((format(printf, 4, 0)));
298
299/*!
300 \brief Declare a string field
301 \param name The field name
302*/
303#define AST_STRING_FIELD(name) const ast_string_field name
304
305/*!
306 \brief Declare an extended string field
307 \since 13.9.0
308
309 \param name The field name
310*/
311#define AST_STRING_FIELD_EXTENDED(name) AST_STRING_FIELD(name)
312
314 /*!
315 * Reset all string fields and free all extra pools that may have been created
316 * The allocation or structure can be reused as is.
317 */
319 /*!
320 * Reset all string fields and free all pools.
321 * If the pointer was returned by ast_calloc_with_stringfields, it can NOT be reused
322 * and should be immediately freed. Otherwise, you must call ast_string_field_init
323 * again if you want to reuse it.
324 */
326};
327
328/*!
329 \brief Declare the fields needed in a structure
330 \param field_list The list of fields to declare, using AST_STRING_FIELD() for each one.
331 Internally, string fields are stored as a pointer to the head of the pool,
332 followed by individual string fields, and then a struct ast_string_field_mgr
333 which describes the space allocated.
334 We split the two variables so they can be used as markers around the
335 field_list, and this allows us to determine how many entries are in
336 the field, and play with them.
337 In particular, for writing to the fields, we rely on __field_mgr_pool to be
338 a non-const pointer, so we know it has the same size as ast_string_field,
339 and we can use it to locate the fields.
340*/
341#define AST_DECLARE_STRING_FIELDS(field_list) \
342 struct ast_string_field_pool *__field_mgr_pool; \
343 field_list \
344 struct ast_string_field_mgr __field_mgr
345
346/*!
347 \brief Initialize a field pool and fields
348 \param x Pointer to a structure containing fields
349 \param size Amount of storage to allocate.
350 Use AST_STRINGFIELD_RESET to reset fields to the default value,
351 and release all but the most recent pool.
352 AST_STRINGFIELD_DESTROY (used internally) means free all pools which is
353 equivalent to calling ast_string_field_free_memory.
354
355 \retval zero on success
356 \retval non-zero on failure
357*/
358
359#define ast_string_field_init(x, size) \
360({ \
361 int __res__ = -1; \
362 if (((void *)(x)) != (void *)NULL) { \
363 __res__ = __ast_string_field_init(&(x)->__field_mgr, &(x)->__field_mgr_pool, size, __FILE__, __LINE__, __PRETTY_FUNCTION__); \
364 } \
365 __res__ ; \
366})
367
368/*!
369 * \brief free all memory - to be called before destroying the object
370 *
371 * \param x
372 *
373 */
374#define ast_string_field_free_memory(x) \
375({ \
376 int __res__ = -1; \
377 if (((void *)(x)) != (void *)NULL) { \
378 __res__ = __ast_string_field_free_memory(&(x)->__field_mgr, &(x)->__field_mgr_pool, \
379 AST_STRINGFIELD_DESTROY, __FILE__, __LINE__, __PRETTY_FUNCTION__); \
380 } \
381 __res__; \
382})
383
385 struct ast_string_field_pool **pool_head, enum ast_stringfield_cleanup_type cleanup_type,
386 const char *file, int lineno, const char *func);
387
388/*!
389 * \brief Initialize an extended string field
390 * \since 13.9.0
391 *
392 * \param x Pointer to a structure containing the field
393 * \param field The extended field to initialize
394 * \retval zero on success
395 * \retval non-zero on error
396 *
397 * \note
398 * This macro must be called on ALL fields defined with AST_STRING_FIELD_EXTENDED after
399 * ast_string_field_init has been called.
400 */
401#define ast_string_field_init_extended(x, field) \
402({ \
403 int __res__ = -1; \
404 if (((void *)(x)) != (void *)NULL) { \
405 ast_string_field *non_const = (ast_string_field *)&(x)->field; \
406 *non_const = __ast_string_field_empty; \
407 __res__ = AST_VECTOR_APPEND(&(x)->__field_mgr.string_fields, non_const); \
408 } \
409 __res__; \
410})
411
412/*!
413 * \internal
414 * \brief internal version of ast_string_field_init
415 */
416int __ast_string_field_init(struct ast_string_field_mgr *mgr, struct ast_string_field_pool **pool_head,
417 int needed, const char *file, int lineno, const char *func);
418
419/*!
420 * \brief Allocate a structure with embedded stringfields in a single allocation
421 * \param n Current implementation only allows 1 structure to be allocated
422 * \param type The type of structure to allocate
423 * \param size The number of bytes of space (minimum) to allocate for stringfields to use
424 * in each structure
425 *
426 * This function will allocate memory for one or more structures that use stringfields, and
427 * also allocate space for the stringfields and initialize the stringfield management
428 * structure embedded in the outer structure.
429 *
430 * \since 1.8
431 */
432#define ast_calloc_with_stringfields(n, type, size) \
433 __ast_calloc_with_stringfields(n, sizeof(type), offsetof(type, __field_mgr), \
434 offsetof(type, __field_mgr_pool), size, __FILE__, __LINE__, __PRETTY_FUNCTION__)
435
436/*!
437 * \internal
438 * \brief internal version of ast_calloc_with_stringfields
439 */
440void *__ast_calloc_with_stringfields(unsigned int num_structs,
441 size_t struct_size, size_t field_mgr_offset, size_t field_mgr_pool_offset, size_t pool_size,
442 const char *file, int lineno, const char *func);
443
444/*!
445 \internal
446 \brief Release a field's allocation from a pool
447 \param pool_head Pointer to the current pool
448 \param ptr Field to be released
449
450 This function will search the pool list to find the pool that contains
451 the allocation for the specified field, then remove the field's allocation
452 from that pool's 'active' count. If the pool's active count reaches zero,
453 and it is not the current pool, then it will be freed.
454 */
456 const ast_string_field ptr);
457
458/*!
459 \brief Macro to provide access to the allocation field that lives immediately in front of a string field
460 \param x Pointer to the string field
461
462 Note that x must be a pointer to a byte-sized type -- normally (char *) -- or this calculation
463 would break horribly
464*/
465#define AST_STRING_FIELD_ALLOCATION(x) *((ast_string_field_allocation *) (x - __alignof__(ast_string_field_allocation)))
466
467/*!
468 \brief Set a field to a simple string value
469 \param x Pointer to a structure containing fields
470 \param ptr Pointer to a field within the structure
471 \param data String value to be copied into the field
472 \retval zero on success
473 \retval non-zero on error
474*/
475#define ast_string_field_ptr_set(x, ptr, data) \
476({ \
477 int __res__ = -1; \
478 if (((void *)(x)) != (void *)NULL) { \
479 __res__ = ast_string_field_ptr_set_by_fields((x)->__field_mgr_pool, (x)->__field_mgr, ptr, data); \
480 } \
481 __res__; \
482})
483
484#define __ast_string_field_ptr_set_by_fields(field_mgr_pool, field_mgr, ptr, data, file, lineno, func) \
485({ \
486 int __res__ = 0; \
487 const char *__d__ = (data); \
488 ast_string_field *__p__ = (ast_string_field *) (ptr); \
489 ast_string_field target = *__p__; \
490 if (__d__ == NULL || *__d__ == '\0') { \
491 __ast_string_field_release_active(field_mgr_pool, *__p__); \
492 *__p__ = __ast_string_field_empty; \
493 } else { \
494 size_t __dlen__ = strlen(__d__) + 1; \
495 if ((__dlen__ <= AST_STRING_FIELD_ALLOCATION(*__p__)) || \
496 (!__ast_string_field_ptr_grow(&field_mgr, &field_mgr_pool, __dlen__, __p__)) || \
497 (target = __ast_string_field_alloc_space(&field_mgr, &field_mgr_pool, __dlen__, file, lineno, func))) { \
498 if (target != *__p__) { \
499 __ast_string_field_release_active(field_mgr_pool, *__p__); \
500 *__p__ = target; \
501 } \
502 memcpy(* (void **) __p__, __d__, __dlen__); \
503 } else { \
504 __res__ = -1; \
505 } \
506 } \
507 __res__; \
508})
509
510#define ast_string_field_ptr_set_by_fields(field_mgr_pool, field_mgr, ptr, data) \
511 __ast_string_field_ptr_set_by_fields(field_mgr_pool, field_mgr, ptr, data, __FILE__, __LINE__, __PRETTY_FUNCTION__)
512
513/*!
514 \brief Set a field to a simple string value
515 \param x Pointer to a structure containing fields
516 \param field Name of the field to set
517 \param data String value to be copied into the field
518 \retval zero on success
519 \retval non-zero on error
520*/
521#define ast_string_field_set(x, field, data) \
522({ \
523 int __res__ = -1; \
524 if (((void *)(x)) != (void *)NULL) { \
525 __res__ = ast_string_field_ptr_set(x, &(x)->field, data); \
526 } \
527 __res__; \
528})
529
530/*!
531 \brief Set a field to a complex (built) value
532 \param x Pointer to a structure containing fields
533 \param ptr Pointer to a field within the structure
534 \param fmt printf-style format string
535 \param args Arguments for format string
536*/
537#define ast_string_field_ptr_build(x, ptr, fmt, args...) \
538({ \
539 int __res__ = -1; \
540 if (((void *)(x)) != (void *)NULL) { \
541 __ast_string_field_ptr_build(__FILE__, __LINE__, __PRETTY_FUNCTION__, \
542 &(x)->__field_mgr, &(x)->__field_mgr_pool, (ast_string_field *) ptr, fmt, args); \
543 __res__ = 0; \
544 } \
545 __res__; \
546})
547
548/*!
549 \brief Set a field to a complex (built) value
550 \param x Pointer to a structure containing fields
551 \param field Name of the field to set
552 \param fmt printf-style format string
553 \param args Arguments for format string
554*/
555#define ast_string_field_build(x, field, fmt, args...) \
556({ \
557 int __res__ = -1; \
558 if (((void *)(x)) != (void *)NULL) { \
559 __ast_string_field_ptr_build(__FILE__, __LINE__, __PRETTY_FUNCTION__, \
560 &(x)->__field_mgr, &(x)->__field_mgr_pool, (ast_string_field *) &(x)->field, fmt, args); \
561 __res__ = 0; \
562 } \
563 __res__; \
564})
565
566/*!
567 \brief Set a field to a complex (built) value with prebuilt va_lists.
568 \param x Pointer to a structure containing fields
569 \param ptr Pointer to a field within the structure
570 \param fmt printf-style format string
571 \param args Arguments for format string in va_list format
572*/
573#define ast_string_field_ptr_build_va(x, ptr, fmt, args) \
574({ \
575 int __res__ = -1; \
576 if (((void *)(x)) != (void *)NULL) { \
577 __ast_string_field_ptr_build_va(&(x)->__field_mgr, &(x)->__field_mgr_pool, (ast_string_field *) ptr, fmt, args, \
578 __FILE__, __LINE__, __PRETTY_FUNCTION__); \
579 __res__ = 0; \
580 } \
581 __res__; \
582})
583
584/*!
585 \brief Set a field to a complex (built) value
586 \param x Pointer to a structure containing fields
587 \param field Name of the field to set
588 \param fmt printf-style format string
589 \param args Arguments for format string in va_list format
590*/
591#define ast_string_field_build_va(x, field, fmt, args) \
592({ \
593 int __res__ = -1; \
594 if (((void *)(x)) != (void *)NULL) { \
595 __ast_string_field_ptr_build_va(&(x)->__field_mgr, &(x)->__field_mgr_pool, (ast_string_field *) &(x)->field, fmt, args, \
596 __FILE__, __LINE__, __PRETTY_FUNCTION__); \
597 __res__ = 0; \
598 } \
599 __res__; \
600})
601
602/*!
603 \brief Compare the string fields in two instances of the same structure
604 \since 12
605 \param instance1 The first instance of the structure to be compared
606 \param instance2 The second instance of the structure to be compared
607 \retval zero if all string fields are equal (does not compare non-string field data)
608 \retval non-zero if the values of the string fields differ
609*/
610#define ast_string_fields_cmp(instance1, instance2) \
611({ \
612 int __res__ = -1; \
613 if (((void *)(instance1)) != (void *)NULL && ((void *)(instance2)) != (void *)NULL) { \
614 __res__ = __ast_string_fields_cmp(&(instance1)->__field_mgr.string_fields, \
615 &(instance2)->__field_mgr.string_fields); \
616 } \
617 __res__; \
618})
619
621
622/*!
623 \brief Copy all string fields from one instance to another of the same structure
624 \since 12
625 \param copy The instance of the structure to be copied into
626 \param orig The instance of the structure to be copied from
627 \retval zero on success
628 \retval non-zero on error
629*/
630#define ast_string_fields_copy(copy, orig) \
631({ \
632 int __res__ = -1; \
633 if (((void *)(copy)) != (void *)NULL && ((void *)(orig)) != (void *)NULL) { \
634 __res__ = __ast_string_fields_copy(((copy)->__field_mgr_pool), \
635 (struct ast_string_field_mgr *)&((copy)->__field_mgr), \
636 (struct ast_string_field_mgr *)&((orig)->__field_mgr), \
637 __FILE__, __LINE__, __PRETTY_FUNCTION__); \
638 } \
639 __res__; \
640})
641
643 struct ast_string_field_mgr *copy_mgr, struct ast_string_field_mgr *orig_mgr,
644 const char *file, int lineno, const char *func);
645
646#endif /* _ASTERISK_STRINGFIELDS_H */
Inlinable API function macro.
void __ast_string_field_ptr_build_va(struct ast_string_field_mgr *mgr, struct ast_string_field_pool **pool_head, ast_string_field *ptr, const char *format, va_list ap, const char *file, int lineno, const char *func)
Definition: stringfields.c:286
int __ast_string_fields_cmp(struct ast_string_field_vector *left, struct ast_string_field_vector *right)
Definition: stringfields.c:424
void __ast_string_field_release_active(struct ast_string_field_pool *pool_head, const ast_string_field ptr)
Definition: stringfields.c:261
int __ast_string_fields_copy(struct ast_string_field_pool *copy_pool, struct ast_string_field_mgr *copy_mgr, struct ast_string_field_mgr *orig_mgr, const char *file, int lineno, const char *func)
Definition: stringfields.c:441
void __ast_string_field_ptr_build(const char *file, int lineno, const char *func, struct ast_string_field_mgr *mgr, struct ast_string_field_pool **pool_head, ast_string_field *ptr, const char *format,...)
Definition: stringfields.c:369
int __ast_string_field_init(struct ast_string_field_mgr *mgr, struct ast_string_field_pool **pool_head, int needed, const char *file, int lineno, const char *func)
Internal initialization function.
Definition: stringfields.c:171
uint16_t ast_string_field_allocation
Definition: stringfields.h:194
ast_stringfield_cleanup_type
Definition: stringfields.h:313
@ AST_STRINGFIELD_DESTROY
Definition: stringfields.h:325
@ AST_STRINGFIELD_RESET
Definition: stringfields.h:318
const char * __ast_string_field_empty
Definition: stringfields.c:43
int __ast_string_field_free_memory(struct ast_string_field_mgr *mgr, struct ast_string_field_pool **pool_head, enum ast_stringfield_cleanup_type cleanup_type, const char *file, int lineno, const char *func)
Internal cleanup function.
Definition: stringfields.c:103
const char * ast_string_field
Definition: stringfields.h:190
void * __ast_calloc_with_stringfields(unsigned int num_structs, size_t struct_size, size_t field_mgr_offset, size_t field_mgr_pool_offset, size_t pool_size, const char *file, int lineno, const char *func)
Definition: stringfields.c:380
ast_string_field __ast_string_field_alloc_space(struct ast_string_field_mgr *mgr, struct ast_string_field_pool **pool_head, size_t needed, const char *file, int lineno, const char *func)
Definition: stringfields.c:202
int __ast_string_field_ptr_grow(struct ast_string_field_mgr *mgr, struct ast_string_field_pool **pool_head, size_t needed, const ast_string_field *ptr)
Definition: stringfields.c:240
struct ast_string_field_vector string_fields
Definition: stringfields.h:230
struct ast_string_field_pool * embedded_pool
Definition: stringfields.h:229
ast_string_field last_alloc
Definition: stringfields.h:228
struct ast_string_field_pool * prev
Definition: stringfields.h:209
Vector container support.
#define AST_VECTOR(name, type)
Define a vector structure.
Definition: vector.h:44