chiark / gitweb /
make sure disorder-normalize gets the right config file
[disorder] / lib / vector.h
index 6cadaf1ec7a9cba8b22283acaa7d65e87e39c2ea..bb944a29c72a008c15ec191af81563ce0b492004 100644 (file)
 #define VECTOR_TYPE(NAME,ETYPE,REALLOC)                                \
                                                                \
 struct NAME {                                                  \
+  /** @brief Pointer to elements */                            \
   ETYPE *vec;                                                  \
-  int nvec, nslots;                                            \
+  /** @brief Number of elements */                             \
+  int nvec;                                                    \
+  /** @brief Number of slots */                                        \
+  int nslots;                                                  \
 };                                                             \
                                                                \
 static inline void NAME##_init(struct NAME *v) {               \
@@ -76,6 +80,8 @@ VECTOR_TYPE(vector, char *, xrealloc);
 VECTOR_TYPE(dynstr, char, xrealloc_noptr);
 /** @brief A dynamic unicode string */
 VECTOR_TYPE(dynstr_ucs4, uint32_t, xrealloc_noptr);
+/** @brief A dynamic array of pointers to unicode string */
+VECTOR_TYPE(vector32, uint32_t *, xrealloc);
 
 /** @brief Append many strings to a @ref vector */
 void vector_append_many(struct vector *v, char **vec, int nvec);