libmpm

morphux C package management library
Log | Files | Refs | Submodules | README | LICENSE | git clone https://git.ne02ptzero.me/git/libmpm

commit f5d3cee70a8ae3f8350efa945279efcc5bec086f
parent 555ae66d544601fe6b4ec156e31acf6ad109b648
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Mon,  6 Mar 2017 19:31:09 +0100

Fix(Code style): package{c,h}

Diffstat:
Minc/package.h | 28++++++++++++++--------------
Msrc/package.c | 9++++++---
2 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/inc/package.h b/inc/package.h @@ -20,13 +20,13 @@ # include <morphux.h> # include <files.h> -enum { +typedef enum package_state_e { PACKAGE_STATE_USER_INSTALLED, PACKAGE_STATE_DEPENDENCY, PACKAGE_STATE_ORPHAN -}; +} package_state_t; -typedef struct s_category category_t; +typedef struct category_s category_t; # define PKG_TABLE "pkgs" # define PKG_COL_ID "id" @@ -42,17 +42,17 @@ typedef struct s_category category_t; # define PKG_COL_DOCS "docs" typedef struct s_package { - u64_t id; - char *name; - char *version; - category_t *categ; - char *desc; - u8_t state; - mlist_t *deps; - mlist_t *files; - mlist_t *binaries; - mlist_t *config; - mlist_t *docs; + u64_t id; + char *name; + char *version; + category_t *categ; + char *desc; + package_state_t state; + mlist_t *deps; + mlist_t *files; + mlist_t *binaries; + mlist_t *config; + mlist_t *docs; } package_t; int mpm_package_free(void *tmp); diff --git a/src/package.c b/src/package.c @@ -23,11 +23,13 @@ int mpm_package_free(void *tmp) { package_t *ptr = tmp; - if (ptr) { + if (ptr) + { free(ptr->name); free(ptr->version); free(ptr->desc); - if (ptr->categ != NULL) { + if (ptr->categ != NULL) + { ptr->categ->parent = NULL; mpm_category_free(ptr->categ); free(ptr->categ); @@ -43,7 +45,8 @@ int mpm_package_free(void *tmp) { * \param ptr Pointer to an allocated ptr */ void mpm_package_init(package_t *ptr) { - if (ptr) { + if (ptr) + { ptr->id = 0; ptr->state = PACKAGE_STATE_ORPHAN; ptr->name = NULL;