[PATCH v2] lib/slab: introduce sl_allocz() function and use it in Babel
Andreas Rammhold
andreas at rammhold.de
Mon Nov 23 11:30:43 CET 2020
On 11:07 23.11.20, Toke Høiland-Jørgensen wrote:
> +void *
> +sl_allocz(slab *s)
> +{
> + void *obj = sl_alloc(s);
> + memset(obj, 0, s->size);
> + return obj;
> +}
> +
This is the same function name and (almost same) implementation as
further down in this patch. Did you forget to remove it?
> void
> sl_free(slab *s, void *oo)
> {
> @@ -278,6 +286,22 @@ no_partial:
> goto okay;
> }
>
> +/**
> + * sl_allocz - allocate an object from Slab and zero it
> + * @s: slab
> + *
> + * sl_allocz() allocates space for a single object from the
> + * Slab and returns a pointer to the object after zeroing out
> + * the object memory.
> + */
> +void *
> +sl_allocz(slab *s)
> +{
> + void *obj = sl_alloc(s);
> + memset(obj, 0, s->data_size);
> + return obj;
> +}
> +
^ second copy of the function but it is using s->data_size instead.
More information about the Bird-users
mailing list