#define dalloc_add(d, obj, type) dalloc_add_talloc_chunk((d), talloc((d), type), (obj), sizeof(type));
extern void *dalloc_get(const DALLOC_CTX *d, ...);
extern void *dalloc_value_for_key(const DALLOC_CTX *d, ...);
-
+extern int dalloc_size(DALLOC_CTX *d);
#endif /* DALLOC_H */
return 0;
}
+/* Get number of elements, returns 0 if the structure is empty or not initialized */
+int dalloc_size(DALLOC_CTX *d)
+{
+ if (!d || !d->dd_talloc_array)
+ return 0;
+ return talloc_array_length(d->dd_talloc_array);
+}
+
void *dalloc_get(const DALLOC_CTX *d, ...)
{
EC_INIT;