mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-11 00:09:42 +00:00
CLEANUP: spoe: use pool_zalloc() instead of pool_alloc+memset
Two places used to alloc then zero the area, let's have the allocator do it.
This commit is contained in:
parent
1bbec3883a
commit
c9ef9bc9a5
@ -1965,10 +1965,9 @@ spoe_create_appctx(struct spoe_config *conf)
|
|||||||
if ((appctx = appctx_new(&spoe_applet, tid_bit)) == NULL)
|
if ((appctx = appctx_new(&spoe_applet, tid_bit)) == NULL)
|
||||||
goto out_error;
|
goto out_error;
|
||||||
|
|
||||||
appctx->ctx.spoe.ptr = pool_alloc(pool_head_spoe_appctx);
|
appctx->ctx.spoe.ptr = pool_zalloc(pool_head_spoe_appctx);
|
||||||
if (SPOE_APPCTX(appctx) == NULL)
|
if (SPOE_APPCTX(appctx) == NULL)
|
||||||
goto out_free_appctx;
|
goto out_free_appctx;
|
||||||
memset(appctx->ctx.spoe.ptr, 0, pool_head_spoe_appctx->size);
|
|
||||||
|
|
||||||
appctx->st0 = SPOE_APPCTX_ST_CONNECT;
|
appctx->st0 = SPOE_APPCTX_ST_CONNECT;
|
||||||
if ((SPOE_APPCTX(appctx)->task = task_new(tid_bit)) == NULL)
|
if ((SPOE_APPCTX(appctx)->task = task_new(tid_bit)) == NULL)
|
||||||
@ -2870,11 +2869,10 @@ spoe_create_context(struct stream *s, struct filter *filter)
|
|||||||
struct spoe_config *conf = FLT_CONF(filter);
|
struct spoe_config *conf = FLT_CONF(filter);
|
||||||
struct spoe_context *ctx;
|
struct spoe_context *ctx;
|
||||||
|
|
||||||
ctx = pool_alloc(pool_head_spoe_ctx);
|
ctx = pool_zalloc(pool_head_spoe_ctx);
|
||||||
if (ctx == NULL) {
|
if (ctx == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memset(ctx, 0, sizeof(*ctx));
|
|
||||||
ctx->filter = filter;
|
ctx->filter = filter;
|
||||||
ctx->state = SPOE_CTX_ST_NONE;
|
ctx->state = SPOE_CTX_ST_NONE;
|
||||||
ctx->status_code = SPOE_CTX_ERR_NONE;
|
ctx->status_code = SPOE_CTX_ERR_NONE;
|
||||||
|
Loading…
Reference in New Issue
Block a user