Re: [PATCH 4/7] Add a memory pool library

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ramkumar Ramachandra wrote:

> Add a memory pool library implemented using cpp macros.

Hmm, like talloc[1].  How do they compare?

[...]
> + *   pre              : Prefix for generated functions (ex: string_).
> + *   obj_t            : Type for treap data structure (ex: char).
> + *   intial_capacity  : The initial size of the memory pool (ex: 4096).
> + *
> + */
> +#define obj_pool_gen(pre, obj_t, initial_capacity)                         \
> +static struct {                                                            \
> +    uint32_t size;                                                         \
> +    uint32_t capacity;                                                     \
> +    obj_t *base;                                                           \
> +} pre##_pool = { 0, 0, NULL};                                              \
> +static uint32_t pre##_alloc(uint32_t count)                                \
[...]

This makes functions with names like string_alloc(), which would then
be un-greppable.  It might be nice (though certainly not necessary) to
provide an overview in Documentation/technical/ so there is no need to
find the definition of each function.

Jonathan

[1] http://ccan.ozlabs.org/info/talloc.html
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]