summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2006-02-14 19:48:13 +0100
committerAurelien Foret <aurelien@archlinux.org>2006-02-14 19:48:13 +0100
commitce194bdd5ed1ed625dfb6384be7650899e211c3a (patch)
tree385f714da549481c12f869217dcef8dd69df3a6a
parente4c9ab48959f3312afff074015e062f5791374a7 (diff)
downloadpacman-ce194bdd5ed1ed625dfb6384be7650899e211c3a.tar.gz
pacman-ce194bdd5ed1ed625dfb6384be7650899e211c3a.tar.xz
used MALLOC macro when possible
-rw-r--r--src/pacman/conf.c16
-rw-r--r--src/pacman/pacman.c4
2 files changed, 3 insertions, 17 deletions
diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index 1ab2daef..70d953e1 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -42,10 +42,7 @@ config_t *config_new()
{
config_t *config;
- config = (config_t *)malloc(sizeof(config_t));
- if(config == NULL) {
- return(NULL);
- }
+ MALLOC(config, sizeof(config_t));
memset(config, 0, sizeof(config_t));
@@ -123,11 +120,7 @@ int parseconfig(char *file, config_t *config)
}
if(!found) {
/* start a new sync record */
- sync = (sync_t *)malloc(sizeof(sync_t));
- if(sync == NULL) {
- ERR(NL, "could not allocate %d bytes\n", sizeof(sync_t));
- return(1);
- }
+ MALLOC(sync, sizeof(sync_t));
sync->treename = strdup(section);
sync->servers = NULL;
pmc_syncs = list_add(pmc_syncs, sync);
@@ -292,10 +285,7 @@ int parseconfig(char *file, config_t *config)
server_t *server;
char *p;
- if((server = (server_t *)malloc(sizeof(server_t))) == NULL) {
- ERR(NL, "could not allocate %d bytes\n", sizeof(server_t));
- return(1);
- }
+ MALLOC(server, sizeof(server_t));
server->server = server->path = NULL;
server->protocol = NULL;
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 8930d064..75ce1bca 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -86,10 +86,6 @@ int main(int argc, char *argv[])
/* init config data */
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->debug |= PM_LOG_WARNING;