Displaying 3 results from an estimated 3 matches for "define_vector_empty".
2023 Feb 22
1
[libnbd PATCH v3 05/29] vector: (mostly) factor out DEFINE_VECTOR_EMPTY
On 2/22/23 09:17, Richard W.M. Jones wrote:
> On Tue, Feb 21, 2023 at 05:23:52PM +0100, Laszlo Ersek wrote:
>> This is doable, but I hope it's not expected that
>> DEFINE_POINTER_VECTOR_TYPE() *enforce* that the element type be a pointer :)
>
>
> You might ignore this for a first draft, but it is apparently possible
> to statically detect this (at least, if using
2023 Feb 22
2
[libnbd PATCH v3 05/29] vector: (mostly) factor out DEFINE_VECTOR_EMPTY
...some division of:
> >
> > DEFINE_VECTOR_TYPE (int_vector, int);
> > DEFINE_POINTER_VECTOR_TYPE (string_vector, char *, free);
> >
> > where under the hood, DEFINE_POINTER_VECTOR_TYPE(type, base, fn)
> > invokes both DEFINE_VECTOR_TYPE(type, base) and
> > DEFINE_VECTOR_EMPTY(type, fn), or whatever we name the second
> > function.
I quite like Eric's suggestion, but it's probably too much complexity
for this patch series.
> This is doable, but I hope it's not expected that
> DEFINE_POINTER_VECTOR_TYPE() *enforce* that the element type be a poin...
2023 Feb 15
1
[libnbd PATCH v3 05/29] vector: (mostly) factor out DEFINE_VECTOR_EMPTY
...> some cases than strictly necessary, but the extra work is harmless, and
> arguably beneficial for clarity / consistency.)
Agreed that the extra cleanup is not going to affect our hot path.
>
> Expose the "name##_empty" function definition with a new, separate macro:
> DEFINE_VECTOR_EMPTY(). The existent DEFINE_VECTOR_TYPE() macro permits
> such element types that are not pointers, or are pointers to const- and/or
> volatile-qualified objects. Whereas "name##_empty" requires that the
> elements be pointers to dynamically allocated, non-const, non-volatile
> obj...