i = 0;
list_for_each_entry(name, &global_51degrees.property_names, list)
++i;
- _51d_property_list = calloc(i, sizeof(char *));
+ _51d_property_list = calloc(i, sizeof(*_51d_property_list));
i = 0;
list_for_each_entry(name, &global_51degrees.property_names, list)
if (empty && !min_arg)
goto end_parse;
- arg = *argp = calloc(nbarg + 1, sizeof(*arg));
+ arg = *argp = calloc(nbarg + 1, sizeof(**argp));
/* Note: empty arguments after a comma always exist. */
while (pos < nbarg) {
/* default compression options */
if (defproxy.comp != NULL) {
- curproxy->comp = calloc(1, sizeof(struct comp));
+ curproxy->comp = calloc(1, sizeof(*curproxy->comp));
curproxy->comp->algos = defproxy.comp->algos;
curproxy->comp->types = defproxy.comp->types;
}
b_reset(&check->bi); check->bi.size = global.tune.chksize;
b_reset(&check->bo); check->bo.size = global.tune.chksize;
- check->bi.area = calloc(check->bi.size, sizeof(char));
- check->bo.area = calloc(check->bo.size, sizeof(char));
+ check->bi.area = calloc(check->bi.size, sizeof(*check->bi.area));
+ check->bo.area = calloc(check->bo.size, sizeof(*check->bo.area));
if (!check->bi.area || !check->bo.area)
return "out of memory while allocating check buffer";
}
check->curpid = NULL;
- check->envp = calloc((EXTCHK_SIZE + 1), sizeof(char *));
+ check->envp = calloc((EXTCHK_SIZE + 1), sizeof(*check->envp));
if (!check->envp) {
ha_alert("Failed to allocate memory for environment variables. Aborting\n");
goto err;
}
- check->argv = calloc(6, sizeof(char *));
+ check->argv = calloc(6, sizeof(*check->argv));
if (!check->argv) {
ha_alert("Starting [%s:%s] check: out of memory.\n", px->id, s->id);
goto err;
int p;
struct poller *bp;
- if ((fdtab = calloc(global.maxsock, sizeof(struct fdtab))) == NULL)
+ if ((fdtab = calloc(global.maxsock, sizeof(*fdtab))) == NULL)
goto fail_tab;
if ((polled_mask = calloc(global.maxsock, sizeof(*polled_mask))) == NULL)
goto fail_polledmask;
- if ((fdinfo = calloc(global.maxsock, sizeof(struct fdinfo))) == NULL)
+ if ((fdinfo = calloc(global.maxsock, sizeof(*fdinfo))) == NULL)
goto fail_info;
update_list.first = update_list.last = -1;
old_argc++;
/* 1 for haproxy -sf, 2 for -x /socket */
- next_argv = calloc(old_argc + 1 + 2 + mworker_child_nb() + nb_oldpids + 1, sizeof(char *));
+ next_argv = calloc(old_argc + 1 + 2 + mworker_child_nb() + nb_oldpids + 1,
+ sizeof(*next_argv));
if (next_argv == NULL)
goto alloc_error;
{
char **newargv, **retargv;
- newargv = calloc(argc + 2, sizeof(char *));
+ newargv = calloc(argc + 2, sizeof(*newargv));
if (newargv == NULL) {
ha_warning("Cannot allocate memory\n");
return NULL;
}
/* Memory for arguments. */
- rule->arg.hlua_rule->args = calloc(fcn->nargs + 1, sizeof(char *));
+ rule->arg.hlua_rule->args = calloc(fcn->nargs + 1,
+ sizeof(*rule->arg.hlua_rule->args));
if (!rule->arg.hlua_rule->args) {
memprintf(err, "out of memory error");
return ACT_RET_PRS_ERR;
srv->lb_tree = (srv->flags & SRV_F_BACKUP) ? &p->lbprm.chash.bck : &p->lbprm.chash.act;
srv->lb_nodes_tot = srv->uweight * BE_WEIGHT_SCALE;
srv->lb_nodes_now = 0;
- srv->lb_nodes = calloc(srv->lb_nodes_tot, sizeof(struct tree_occ));
+ srv->lb_nodes = calloc(srv->lb_nodes_tot,
+ sizeof(*srv->lb_nodes));
for (node = 0; node < srv->lb_nodes_tot; node++) {
srv->lb_nodes[node].server = srv;
srv->lb_nodes[node].node.key = full_hash(srv->puid * SRV_EWGHT_RANGE + node);
if (!act)
act = 1;
- p->lbprm.map.srv = calloc(act, sizeof(struct server *));
+ p->lbprm.map.srv = calloc(act, sizeof(*p->lbprm.map.srv));
/* recounts servers and their weights */
recount_servers(p);
update_backend_weight(p);
}
/* Allocate cert structure */
- ckch = calloc(1, sizeof(struct cert_key_and_chain));
+ ckch = calloc(1, sizeof(*ckch));
if (!ckch) {
ha_alert("Proxy '%s': Failed to read CA certificate file '%s' at [%s:%d]. Chain allocation failure\n",
px->id, bind_conf->ca_sign_file, bind_conf->file, bind_conf->line);
len = len >> 1;
if (!*binstr) {
- *binstr = calloc(len, sizeof(char));
+ *binstr = calloc(len, sizeof(**binstr));
if (!*binstr) {
memprintf(err, "out of memory while loading string pattern");
return 0;
return NULL;
if (!u->userlist)
- u->userlist = calloc(1, sizeof(struct userlist));
+ u->userlist = calloc(1, sizeof(*u->userlist));
if (!u->userlist)
return NULL;