used MALLOC macro when possible
This commit is contained in:
parent
e4c9ab4895
commit
ce194bdd5e
2 changed files with 3 additions and 17 deletions
|
@ -42,10 +42,7 @@ config_t *config_new()
|
||||||
{
|
{
|
||||||
config_t *config;
|
config_t *config;
|
||||||
|
|
||||||
config = (config_t *)malloc(sizeof(config_t));
|
MALLOC(config, sizeof(config_t));
|
||||||
if(config == NULL) {
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(config, 0, sizeof(config_t));
|
memset(config, 0, sizeof(config_t));
|
||||||
|
|
||||||
|
@ -123,11 +120,7 @@ int parseconfig(char *file, config_t *config)
|
||||||
}
|
}
|
||||||
if(!found) {
|
if(!found) {
|
||||||
/* start a new sync record */
|
/* start a new sync record */
|
||||||
sync = (sync_t *)malloc(sizeof(sync_t));
|
MALLOC(sync, sizeof(sync_t));
|
||||||
if(sync == NULL) {
|
|
||||||
ERR(NL, "could not allocate %d bytes\n", sizeof(sync_t));
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
sync->treename = strdup(section);
|
sync->treename = strdup(section);
|
||||||
sync->servers = NULL;
|
sync->servers = NULL;
|
||||||
pmc_syncs = list_add(pmc_syncs, sync);
|
pmc_syncs = list_add(pmc_syncs, sync);
|
||||||
|
@ -292,10 +285,7 @@ int parseconfig(char *file, config_t *config)
|
||||||
server_t *server;
|
server_t *server;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
if((server = (server_t *)malloc(sizeof(server_t))) == NULL) {
|
MALLOC(server, sizeof(server_t));
|
||||||
ERR(NL, "could not allocate %d bytes\n", sizeof(server_t));
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
server->server = server->path = NULL;
|
server->server = server->path = NULL;
|
||||||
server->protocol = NULL;
|
server->protocol = NULL;
|
||||||
|
|
||||||
|
|
|
@ -86,10 +86,6 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
/* init config data */
|
/* init config data */
|
||||||
config = config_new();
|
config = config_new();
|
||||||
if(config == NULL) {
|
|
||||||
ERR(NL, "could not allocate memory for pacman config data.\n");
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
config->op = PM_OP_MAIN;
|
config->op = PM_OP_MAIN;
|
||||||
config->debug |= PM_LOG_WARNING;
|
config->debug |= PM_LOG_WARNING;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue