Style cleanups in clean cache code
[pacman-ng.git] / lib / libalpm / group.c
blob398c258877c76c431da04aa3674819ccec8d24e7
1 /*
2 * group.c
4 * Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
5 * Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "config.h"
23 #include <stdlib.h>
24 #include <stdio.h>
25 #include <string.h>
27 /* libalpm */
28 #include "group.h"
29 #include "alpm_list.h"
30 #include "util.h"
31 #include "log.h"
32 #include "alpm.h"
34 pmgrp_t *_alpm_grp_new(const char *name)
36 pmgrp_t* grp;
38 ALPM_LOG_FUNC;
40 CALLOC(grp, 1, sizeof(pmgrp_t), RET_ERR(PM_ERR_MEMORY, NULL));
41 STRDUP(grp->name, name, RET_ERR(PM_ERR_MEMORY, NULL));
43 return(grp);
46 void _alpm_grp_free(pmgrp_t *grp)
48 ALPM_LOG_FUNC;
50 if(grp == NULL) {
51 return;
54 FREE(grp->name);
55 /* do NOT free the contents of the list, just the nodes */
56 alpm_list_free(grp->packages);
57 FREE(grp);
60 const char SYMEXPORT *alpm_grp_get_name(const pmgrp_t *grp)
62 ALPM_LOG_FUNC;
64 /* Sanity checks */
65 ASSERT(grp != NULL, return(NULL));
67 return grp->name;
70 alpm_list_t SYMEXPORT *alpm_grp_get_pkgs(const pmgrp_t *grp)
72 ALPM_LOG_FUNC;
74 /* Sanity checks */
75 ASSERT(grp != NULL, return(NULL));
77 return grp->packages;
79 /* vim: set ts=2 sw=2 noet: */