mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 06:11:32 +02:00
MINOR: pools: force the name at creation time to be a const.
This is already the case as all names are constant so that's fine. If it would ever change, it's not very hard to just replace it in-situ via an strdup() and set a flag to mention that it's dynamically allocated. We just don't need this right now. One immediately visible effect is in "show pools detailed" where the names are no longer truncated.
This commit is contained in:
parent
ee5bc28865
commit
f51d58bd2e
@ -70,7 +70,7 @@ struct pool_cache_head {
|
||||
*/
|
||||
struct pool_registration {
|
||||
struct list list; /* link element */
|
||||
char name[12]; /* name of the pool */
|
||||
const char *name; /* name of the pool */
|
||||
unsigned int size; /* expected object size */
|
||||
unsigned int flags; /* MEM_F_* */
|
||||
unsigned int align; /* expected alignment; 0=unspecified */
|
||||
|
@ -123,8 +123,8 @@ unsigned long long pool_total_allocated(void);
|
||||
unsigned long long pool_total_used(void);
|
||||
void pool_flush(struct pool_head *pool);
|
||||
void pool_gc(struct pool_head *pool_ctx);
|
||||
struct pool_head *create_pool(char *name, unsigned int size, unsigned int flags);
|
||||
struct pool_head *create_pool_from_reg(char *name, struct pool_registration *reg);
|
||||
struct pool_head *create_pool(const char *name, unsigned int size, unsigned int flags);
|
||||
struct pool_head *create_pool_from_reg(const char *name, struct pool_registration *reg);
|
||||
void create_pool_callback(struct pool_head **ptr, char *name, unsigned int size);
|
||||
void *pool_destroy(struct pool_head *pool);
|
||||
void pool_destroy_all(void);
|
||||
|
@ -290,8 +290,9 @@ static int mem_should_fail(const struct pool_head *pool)
|
||||
* is available for a new creation. Two flags are supported :
|
||||
* - MEM_F_SHARED to indicate that the pool may be shared with other users
|
||||
* - MEM_F_EXACT to indicate that the size must not be rounded up
|
||||
* The name must be a stable pointer during all the program's life time.
|
||||
*/
|
||||
struct pool_head *create_pool(char *name, unsigned int size, unsigned int flags)
|
||||
struct pool_head *create_pool(const char *name, unsigned int size, unsigned int flags)
|
||||
{
|
||||
struct pool_registration *reg;
|
||||
struct pool_head *pool;
|
||||
@ -300,7 +301,7 @@ struct pool_head *create_pool(char *name, unsigned int size, unsigned int flags)
|
||||
if (!reg)
|
||||
return NULL;
|
||||
|
||||
strlcpy2(reg->name, name, sizeof(reg->name));
|
||||
reg->name = name;
|
||||
reg->size = size;
|
||||
reg->flags = flags;
|
||||
reg->align = 0;
|
||||
@ -314,7 +315,7 @@ struct pool_head *create_pool(char *name, unsigned int size, unsigned int flags)
|
||||
/* create a pool from a pool registration. All configuration is taken from
|
||||
* there.
|
||||
*/
|
||||
struct pool_head *create_pool_from_reg(char *name, struct pool_registration *reg)
|
||||
struct pool_head *create_pool_from_reg(const char *name, struct pool_registration *reg)
|
||||
{
|
||||
unsigned int extra_mark, extra_caller, extra;
|
||||
unsigned int flags = reg->flags;
|
||||
|
Loading…
x
Reference in New Issue
Block a user