dynarray-skeleton.gl.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
  2. /* Type-safe arrays which grow dynamically.
  3. Copyright (C) 2017-2021 Free Software Foundation, Inc.
  4. This file is part of the GNU C Library.
  5. The GNU C Library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with the GNU C Library; if not, see
  15. <https://www.gnu.org/licenses/>. */
  16. /* Pre-processor macros which act as parameters:
  17. DYNARRAY_STRUCT
  18. The struct tag of dynamic array to be defined.
  19. DYNARRAY_ELEMENT
  20. The type name of the element type. Elements are copied
  21. as if by memcpy, and can change address as the dynamic
  22. array grows.
  23. DYNARRAY_PREFIX
  24. The prefix of the functions which are defined.
  25. The following parameters are optional:
  26. DYNARRAY_ELEMENT_FREE
  27. DYNARRAY_ELEMENT_FREE (E) is evaluated to deallocate the
  28. contents of elements. E is of type DYNARRAY_ELEMENT *.
  29. DYNARRAY_ELEMENT_INIT
  30. DYNARRAY_ELEMENT_INIT (E) is evaluated to initialize a new
  31. element. E is of type DYNARRAY_ELEMENT *.
  32. If DYNARRAY_ELEMENT_FREE but not DYNARRAY_ELEMENT_INIT is
  33. defined, new elements are automatically zero-initialized.
  34. Otherwise, new elements have undefined contents.
  35. DYNARRAY_INITIAL_SIZE
  36. The size of the statically allocated array (default:
  37. at least 2, more elements if they fit into 128 bytes).
  38. Must be a preprocessor constant. If DYNARRAY_INITIAL_SIZE is 0,
  39. there is no statically allocated array at, and all non-empty
  40. arrays are heap-allocated.
  41. DYNARRAY_FINAL_TYPE
  42. The name of the type which holds the final array. If not
  43. defined, is PREFIX##finalize not provided. DYNARRAY_FINAL_TYPE
  44. must be a struct type, with members of type DYNARRAY_ELEMENT and
  45. size_t at the start (in this order).
  46. These macros are undefined after this header file has been
  47. included.
  48. The following types are provided (their members are private to the
  49. dynarray implementation):
  50. struct DYNARRAY_STRUCT
  51. The following functions are provided:
  52. void DYNARRAY_PREFIX##init (struct DYNARRAY_STRUCT *);
  53. void DYNARRAY_PREFIX##free (struct DYNARRAY_STRUCT *);
  54. bool DYNARRAY_PREFIX##has_failed (const struct DYNARRAY_STRUCT *);
  55. void DYNARRAY_PREFIX##mark_failed (struct DYNARRAY_STRUCT *);
  56. size_t DYNARRAY_PREFIX##size (const struct DYNARRAY_STRUCT *);
  57. DYNARRAY_ELEMENT *DYNARRAY_PREFIX##begin (const struct DYNARRAY_STRUCT *);
  58. DYNARRAY_ELEMENT *DYNARRAY_PREFIX##end (const struct DYNARRAY_STRUCT *);
  59. DYNARRAY_ELEMENT *DYNARRAY_PREFIX##at (struct DYNARRAY_STRUCT *, size_t);
  60. void DYNARRAY_PREFIX##add (struct DYNARRAY_STRUCT *, DYNARRAY_ELEMENT);
  61. DYNARRAY_ELEMENT *DYNARRAY_PREFIX##emplace (struct DYNARRAY_STRUCT *);
  62. bool DYNARRAY_PREFIX##resize (struct DYNARRAY_STRUCT *, size_t);
  63. void DYNARRAY_PREFIX##remove_last (struct DYNARRAY_STRUCT *);
  64. void DYNARRAY_PREFIX##clear (struct DYNARRAY_STRUCT *);
  65. The following functions are provided are provided if the
  66. prerequisites are met:
  67. bool DYNARRAY_PREFIX##finalize (struct DYNARRAY_STRUCT *,
  68. DYNARRAY_FINAL_TYPE *);
  69. (if DYNARRAY_FINAL_TYPE is defined)
  70. DYNARRAY_ELEMENT *DYNARRAY_PREFIX##finalize (struct DYNARRAY_STRUCT *,
  71. size_t *);
  72. (if DYNARRAY_FINAL_TYPE is not defined)
  73. */
  74. #include <malloc/dynarray.gl.h>
  75. #include <errno.h>
  76. #include <stdlib.h>
  77. #include <string.h>
  78. #ifndef DYNARRAY_STRUCT
  79. # error "DYNARRAY_STRUCT must be defined"
  80. #endif
  81. #ifndef DYNARRAY_ELEMENT
  82. # error "DYNARRAY_ELEMENT must be defined"
  83. #endif
  84. #ifndef DYNARRAY_PREFIX
  85. # error "DYNARRAY_PREFIX must be defined"
  86. #endif
  87. #ifdef DYNARRAY_INITIAL_SIZE
  88. # if DYNARRAY_INITIAL_SIZE < 0
  89. # error "DYNARRAY_INITIAL_SIZE must be non-negative"
  90. # endif
  91. # if DYNARRAY_INITIAL_SIZE > 0
  92. # define DYNARRAY_HAVE_SCRATCH 1
  93. # else
  94. # define DYNARRAY_HAVE_SCRATCH 0
  95. # endif
  96. #else
  97. /* Provide a reasonable default which limits the size of
  98. DYNARRAY_STRUCT. */
  99. # define DYNARRAY_INITIAL_SIZE \
  100. (sizeof (DYNARRAY_ELEMENT) > 64 ? 2 : 128 / sizeof (DYNARRAY_ELEMENT))
  101. # define DYNARRAY_HAVE_SCRATCH 1
  102. #endif
  103. /* Public type definitions. */
  104. /* All fields of this struct are private to the implementation. */
  105. struct DYNARRAY_STRUCT
  106. {
  107. union
  108. {
  109. struct dynarray_header dynarray_abstract;
  110. struct
  111. {
  112. /* These fields must match struct dynarray_header. */
  113. size_t used;
  114. size_t allocated;
  115. DYNARRAY_ELEMENT *array;
  116. } dynarray_header;
  117. } u;
  118. #if DYNARRAY_HAVE_SCRATCH
  119. /* Initial inline allocation. */
  120. DYNARRAY_ELEMENT scratch[DYNARRAY_INITIAL_SIZE];
  121. #endif
  122. };
  123. /* Internal use only: Helper macros. */
  124. /* Ensure macro-expansion of DYNARRAY_PREFIX. */
  125. #define DYNARRAY_CONCAT0(prefix, name) prefix##name
  126. #define DYNARRAY_CONCAT1(prefix, name) DYNARRAY_CONCAT0(prefix, name)
  127. #define DYNARRAY_NAME(name) DYNARRAY_CONCAT1(DYNARRAY_PREFIX, name)
  128. /* Use DYNARRAY_FREE instead of DYNARRAY_NAME (free),
  129. so that Gnulib does not change 'free' to 'rpl_free'. */
  130. #define DYNARRAY_FREE DYNARRAY_CONCAT1 (DYNARRAY_NAME (f), ree)
  131. /* Address of the scratch buffer if any. */
  132. #if DYNARRAY_HAVE_SCRATCH
  133. # define DYNARRAY_SCRATCH(list) (list)->scratch
  134. #else
  135. # define DYNARRAY_SCRATCH(list) NULL
  136. #endif
  137. /* Internal use only: Helper functions. */
  138. /* Internal function. Call DYNARRAY_ELEMENT_FREE with the array
  139. elements. Name mangling needed due to the DYNARRAY_ELEMENT_FREE
  140. macro expansion. */
  141. static inline void
  142. DYNARRAY_NAME (free__elements__) (DYNARRAY_ELEMENT *__dynarray_array,
  143. size_t __dynarray_used)
  144. {
  145. #ifdef DYNARRAY_ELEMENT_FREE
  146. for (size_t __dynarray_i = 0; __dynarray_i < __dynarray_used; ++__dynarray_i)
  147. DYNARRAY_ELEMENT_FREE (&__dynarray_array[__dynarray_i]);
  148. #endif /* DYNARRAY_ELEMENT_FREE */
  149. }
  150. /* Internal function. Free the non-scratch array allocation. */
  151. static inline void
  152. DYNARRAY_NAME (free__array__) (struct DYNARRAY_STRUCT *list)
  153. {
  154. #if DYNARRAY_HAVE_SCRATCH
  155. if (list->u.dynarray_header.array != list->scratch)
  156. free (list->u.dynarray_header.array);
  157. #else
  158. free (list->u.dynarray_header.array);
  159. #endif
  160. }
  161. /* Public functions. */
  162. /* Initialize a dynamic array object. This must be called before any
  163. use of the object. */
  164. _GL_ATTRIBUTE_NONNULL ((1))
  165. static void
  166. DYNARRAY_NAME (init) (struct DYNARRAY_STRUCT *list)
  167. {
  168. list->u.dynarray_header.used = 0;
  169. list->u.dynarray_header.allocated = DYNARRAY_INITIAL_SIZE;
  170. list->u.dynarray_header.array = DYNARRAY_SCRATCH (list);
  171. }
  172. /* Deallocate the dynamic array and its elements. */
  173. _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_NONNULL ((1))
  174. static void
  175. DYNARRAY_FREE (struct DYNARRAY_STRUCT *list)
  176. {
  177. DYNARRAY_NAME (free__elements__)
  178. (list->u.dynarray_header.array, list->u.dynarray_header.used);
  179. DYNARRAY_NAME (free__array__) (list);
  180. DYNARRAY_NAME (init) (list);
  181. }
  182. /* Return true if the dynamic array is in an error state. */
  183. _GL_ATTRIBUTE_NONNULL ((1))
  184. static inline bool
  185. DYNARRAY_NAME (has_failed) (const struct DYNARRAY_STRUCT *list)
  186. {
  187. return list->u.dynarray_header.allocated == __dynarray_error_marker ();
  188. }
  189. /* Mark the dynamic array as failed. All elements are deallocated as
  190. a side effect. */
  191. _GL_ATTRIBUTE_NONNULL ((1))
  192. static void
  193. DYNARRAY_NAME (mark_failed) (struct DYNARRAY_STRUCT *list)
  194. {
  195. DYNARRAY_NAME (free__elements__)
  196. (list->u.dynarray_header.array, list->u.dynarray_header.used);
  197. DYNARRAY_NAME (free__array__) (list);
  198. list->u.dynarray_header.array = DYNARRAY_SCRATCH (list);
  199. list->u.dynarray_header.used = 0;
  200. list->u.dynarray_header.allocated = __dynarray_error_marker ();
  201. }
  202. /* Return the number of elements which have been added to the dynamic
  203. array. */
  204. _GL_ATTRIBUTE_NONNULL ((1))
  205. static inline size_t
  206. DYNARRAY_NAME (size) (const struct DYNARRAY_STRUCT *list)
  207. {
  208. return list->u.dynarray_header.used;
  209. }
  210. /* Return a pointer to the array element at INDEX. Terminate the
  211. process if INDEX is out of bounds. */
  212. _GL_ATTRIBUTE_NONNULL ((1))
  213. static inline DYNARRAY_ELEMENT *
  214. DYNARRAY_NAME (at) (struct DYNARRAY_STRUCT *list, size_t index)
  215. {
  216. if (_GL_UNLIKELY (index >= DYNARRAY_NAME (size) (list)))
  217. __libc_dynarray_at_failure (DYNARRAY_NAME (size) (list), index);
  218. return list->u.dynarray_header.array + index;
  219. }
  220. /* Return a pointer to the first array element, if any. For a
  221. zero-length array, the pointer can be NULL even though the dynamic
  222. array has not entered the failure state. */
  223. _GL_ATTRIBUTE_NONNULL ((1))
  224. static inline DYNARRAY_ELEMENT *
  225. DYNARRAY_NAME (begin) (struct DYNARRAY_STRUCT *list)
  226. {
  227. return list->u.dynarray_header.array;
  228. }
  229. /* Return a pointer one element past the last array element. For a
  230. zero-length array, the pointer can be NULL even though the dynamic
  231. array has not entered the failure state. */
  232. _GL_ATTRIBUTE_NONNULL ((1))
  233. static inline DYNARRAY_ELEMENT *
  234. DYNARRAY_NAME (end) (struct DYNARRAY_STRUCT *list)
  235. {
  236. return list->u.dynarray_header.array + list->u.dynarray_header.used;
  237. }
  238. /* Internal function. Slow path for the add function below. */
  239. static void
  240. DYNARRAY_NAME (add__) (struct DYNARRAY_STRUCT *list, DYNARRAY_ELEMENT item)
  241. {
  242. if (_GL_UNLIKELY
  243. (!__libc_dynarray_emplace_enlarge (&list->u.dynarray_abstract,
  244. DYNARRAY_SCRATCH (list),
  245. sizeof (DYNARRAY_ELEMENT))))
  246. {
  247. DYNARRAY_NAME (mark_failed) (list);
  248. return;
  249. }
  250. /* Copy the new element and increase the array length. */
  251. list->u.dynarray_header.array[list->u.dynarray_header.used++] = item;
  252. }
  253. /* Add ITEM at the end of the array, enlarging it by one element.
  254. Mark *LIST as failed if the dynamic array allocation size cannot be
  255. increased. */
  256. _GL_ATTRIBUTE_NONNULL ((1))
  257. static inline void
  258. DYNARRAY_NAME (add) (struct DYNARRAY_STRUCT *list, DYNARRAY_ELEMENT item)
  259. {
  260. /* Do nothing in case of previous error. */
  261. if (DYNARRAY_NAME (has_failed) (list))
  262. return;
  263. /* Enlarge the array if necessary. */
  264. if (_GL_UNLIKELY (list->u.dynarray_header.used
  265. == list->u.dynarray_header.allocated))
  266. {
  267. DYNARRAY_NAME (add__) (list, item);
  268. return;
  269. }
  270. /* Copy the new element and increase the array length. */
  271. list->u.dynarray_header.array[list->u.dynarray_header.used++] = item;
  272. }
  273. /* Internal function. Building block for the emplace functions below.
  274. Assumes space for one more element in *LIST. */
  275. static inline DYNARRAY_ELEMENT *
  276. DYNARRAY_NAME (emplace__tail__) (struct DYNARRAY_STRUCT *list)
  277. {
  278. DYNARRAY_ELEMENT *result
  279. = &list->u.dynarray_header.array[list->u.dynarray_header.used];
  280. ++list->u.dynarray_header.used;
  281. #if defined (DYNARRAY_ELEMENT_INIT)
  282. DYNARRAY_ELEMENT_INIT (result);
  283. #elif defined (DYNARRAY_ELEMENT_FREE)
  284. memset (result, 0, sizeof (*result));
  285. #endif
  286. return result;
  287. }
  288. /* Internal function. Slow path for the emplace function below. */
  289. static DYNARRAY_ELEMENT *
  290. DYNARRAY_NAME (emplace__) (struct DYNARRAY_STRUCT *list)
  291. {
  292. if (_GL_UNLIKELY
  293. (!__libc_dynarray_emplace_enlarge (&list->u.dynarray_abstract,
  294. DYNARRAY_SCRATCH (list),
  295. sizeof (DYNARRAY_ELEMENT))))
  296. {
  297. DYNARRAY_NAME (mark_failed) (list);
  298. return NULL;
  299. }
  300. return DYNARRAY_NAME (emplace__tail__) (list);
  301. }
  302. /* Allocate a place for a new element in *LIST and return a pointer to
  303. it. The pointer can be NULL if the dynamic array cannot be
  304. enlarged due to a memory allocation failure. */
  305. _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_NODISCARD
  306. _GL_ATTRIBUTE_NONNULL ((1))
  307. static
  308. /* Avoid inlining with the larger initialization code. */
  309. #if !(defined (DYNARRAY_ELEMENT_INIT) || defined (DYNARRAY_ELEMENT_FREE))
  310. inline
  311. #endif
  312. DYNARRAY_ELEMENT *
  313. DYNARRAY_NAME (emplace) (struct DYNARRAY_STRUCT *list)
  314. {
  315. /* Do nothing in case of previous error. */
  316. if (DYNARRAY_NAME (has_failed) (list))
  317. return NULL;
  318. /* Enlarge the array if necessary. */
  319. if (_GL_UNLIKELY (list->u.dynarray_header.used
  320. == list->u.dynarray_header.allocated))
  321. return (DYNARRAY_NAME (emplace__) (list));
  322. return DYNARRAY_NAME (emplace__tail__) (list);
  323. }
  324. /* Change the size of *LIST to SIZE. If SIZE is larger than the
  325. existing size, new elements are added (which can be initialized).
  326. Otherwise, the list is truncated, and elements are freed. Return
  327. false on memory allocation failure (and mark *LIST as failed). */
  328. _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_NONNULL ((1))
  329. static bool
  330. DYNARRAY_NAME (resize) (struct DYNARRAY_STRUCT *list, size_t size)
  331. {
  332. if (size > list->u.dynarray_header.used)
  333. {
  334. bool ok;
  335. #if defined (DYNARRAY_ELEMENT_INIT)
  336. /* The new elements have to be initialized. */
  337. size_t old_size = list->u.dynarray_header.used;
  338. ok = __libc_dynarray_resize (&list->u.dynarray_abstract,
  339. size, DYNARRAY_SCRATCH (list),
  340. sizeof (DYNARRAY_ELEMENT));
  341. if (ok)
  342. for (size_t i = old_size; i < size; ++i)
  343. {
  344. DYNARRAY_ELEMENT_INIT (&list->u.dynarray_header.array[i]);
  345. }
  346. #elif defined (DYNARRAY_ELEMENT_FREE)
  347. /* Zero initialization is needed so that the elements can be
  348. safely freed. */
  349. ok = __libc_dynarray_resize_clear
  350. (&list->u.dynarray_abstract, size,
  351. DYNARRAY_SCRATCH (list), sizeof (DYNARRAY_ELEMENT));
  352. #else
  353. ok = __libc_dynarray_resize (&list->u.dynarray_abstract,
  354. size, DYNARRAY_SCRATCH (list),
  355. sizeof (DYNARRAY_ELEMENT));
  356. #endif
  357. if (_GL_UNLIKELY (!ok))
  358. DYNARRAY_NAME (mark_failed) (list);
  359. return ok;
  360. }
  361. else
  362. {
  363. /* The list has shrunk in size. Free the removed elements. */
  364. DYNARRAY_NAME (free__elements__)
  365. (list->u.dynarray_header.array + size,
  366. list->u.dynarray_header.used - size);
  367. list->u.dynarray_header.used = size;
  368. return true;
  369. }
  370. }
  371. /* Remove the last element of LIST if it is present. */
  372. _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_NONNULL ((1))
  373. static void
  374. DYNARRAY_NAME (remove_last) (struct DYNARRAY_STRUCT *list)
  375. {
  376. /* used > 0 implies that the array is the non-failed state. */
  377. if (list->u.dynarray_header.used > 0)
  378. {
  379. size_t new_length = list->u.dynarray_header.used - 1;
  380. #ifdef DYNARRAY_ELEMENT_FREE
  381. DYNARRAY_ELEMENT_FREE (&list->u.dynarray_header.array[new_length]);
  382. #endif
  383. list->u.dynarray_header.used = new_length;
  384. }
  385. }
  386. /* Remove all elements from the list. The elements are freed, but the
  387. list itself is not. */
  388. _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_NONNULL ((1))
  389. static void
  390. DYNARRAY_NAME (clear) (struct DYNARRAY_STRUCT *list)
  391. {
  392. /* free__elements__ does nothing if the list is in the failed
  393. state. */
  394. DYNARRAY_NAME (free__elements__)
  395. (list->u.dynarray_header.array, list->u.dynarray_header.used);
  396. list->u.dynarray_header.used = 0;
  397. }
  398. #ifdef DYNARRAY_FINAL_TYPE
  399. /* Transfer the dynamic array to a permanent location at *RESULT.
  400. Returns true on success on false on allocation failure. In either
  401. case, *LIST is re-initialized and can be reused. A NULL pointer is
  402. stored in *RESULT if LIST refers to an empty list. On success, the
  403. pointer in *RESULT is heap-allocated and must be deallocated using
  404. free. */
  405. _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_NODISCARD
  406. _GL_ATTRIBUTE_NONNULL ((1, 2))
  407. static bool
  408. DYNARRAY_NAME (finalize) (struct DYNARRAY_STRUCT *list,
  409. DYNARRAY_FINAL_TYPE *result)
  410. {
  411. struct dynarray_finalize_result res;
  412. if (__libc_dynarray_finalize (&list->u.dynarray_abstract,
  413. DYNARRAY_SCRATCH (list),
  414. sizeof (DYNARRAY_ELEMENT), &res))
  415. {
  416. /* On success, the result owns all the data. */
  417. DYNARRAY_NAME (init) (list);
  418. *result = (DYNARRAY_FINAL_TYPE) { res.array, res.length };
  419. return true;
  420. }
  421. else
  422. {
  423. /* On error, we need to free all data. */
  424. DYNARRAY_FREE (list);
  425. errno = ENOMEM;
  426. return false;
  427. }
  428. }
  429. #else /* !DYNARRAY_FINAL_TYPE */
  430. /* Transfer the dynamic array to a heap-allocated array and return a
  431. pointer to it. The pointer is NULL if memory allocation fails, or
  432. if the array is empty, so this function should be used only for
  433. arrays which are known not be empty (usually because they always
  434. have a sentinel at the end). If LENGTHP is not NULL, the array
  435. length is written to *LENGTHP. *LIST is re-initialized and can be
  436. reused. */
  437. _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_NODISCARD
  438. _GL_ATTRIBUTE_NONNULL ((1))
  439. static DYNARRAY_ELEMENT *
  440. DYNARRAY_NAME (finalize) (struct DYNARRAY_STRUCT *list, size_t *lengthp)
  441. {
  442. struct dynarray_finalize_result res;
  443. if (__libc_dynarray_finalize (&list->u.dynarray_abstract,
  444. DYNARRAY_SCRATCH (list),
  445. sizeof (DYNARRAY_ELEMENT), &res))
  446. {
  447. /* On success, the result owns all the data. */
  448. DYNARRAY_NAME (init) (list);
  449. if (lengthp != NULL)
  450. *lengthp = res.length;
  451. return res.array;
  452. }
  453. else
  454. {
  455. /* On error, we need to free all data. */
  456. DYNARRAY_FREE (list);
  457. errno = ENOMEM;
  458. return NULL;
  459. }
  460. }
  461. #endif /* !DYNARRAY_FINAL_TYPE */
  462. /* Undo macro definitions. */
  463. #undef DYNARRAY_CONCAT0
  464. #undef DYNARRAY_CONCAT1
  465. #undef DYNARRAY_NAME
  466. #undef DYNARRAY_SCRATCH
  467. #undef DYNARRAY_HAVE_SCRATCH
  468. #undef DYNARRAY_STRUCT
  469. #undef DYNARRAY_ELEMENT
  470. #undef DYNARRAY_PREFIX
  471. #undef DYNARRAY_ELEMENT_FREE
  472. #undef DYNARRAY_ELEMENT_INIT
  473. #undef DYNARRAY_INITIAL_SIZE
  474. #undef DYNARRAY_FINAL_TYPE