static int verrevcmp(const char *val, const char *ref);
-pkg_t *pkg_new(void)
-{
- pkg_t *pkg;
-
- pkg = xcalloc(1, sizeof(pkg_t));
- pkg_init(pkg);
-
- return pkg;
-}
-
-int pkg_init(pkg_t *pkg)
+static void
+pkg_init(pkg_t *pkg)
{
pkg->name = NULL;
pkg->epoch = 0;
pkg->installed_files_ref_cnt = 0;
pkg->essential = 0;
pkg->provided_by_hand = 0;
+}
- return 0;
+pkg_t *pkg_new(void)
+{
+ pkg_t *pkg;
+
+ pkg = xcalloc(1, sizeof(pkg_t));
+ pkg_init(pkg);
+
+ return pkg;
}
void compound_depend_deinit (compound_depend_t *depends)
return 0;
}
+static void
+abstract_pkg_init(abstract_pkg_t *ab_pkg)
+{
+ ab_pkg->provided_by = abstract_pkg_vec_alloc();
+ ab_pkg->dependencies_checked = 0;
+ ab_pkg->state_status = SS_NOT_INSTALLED;
+}
+
abstract_pkg_t *abstract_pkg_new(void)
{
abstract_pkg_t * ab_pkg;
ab_pkg = xcalloc(1, sizeof(abstract_pkg_t));
-
- if (ab_pkg == NULL) {
- fprintf(stderr, "%s: out of memory\n", __FUNCTION__);
- return NULL;
- }
-
- if ( abstract_pkg_init(ab_pkg) < 0 )
- return NULL;
+ abstract_pkg_init(ab_pkg);
return ab_pkg;
}
-int abstract_pkg_init(abstract_pkg_t *ab_pkg)
-{
- ab_pkg->provided_by = abstract_pkg_vec_alloc();
- if (ab_pkg->provided_by==NULL){
- return -1;
- }
- ab_pkg->dependencies_checked = 0;
- ab_pkg->state_status = SS_NOT_INSTALLED;
-
- return 0;
-}
-
void set_flags_from_control(opkg_conf_t *conf, pkg_t *pkg){
char *file_name;
FILE *fp;
};
pkg_t *pkg_new(void);
-int pkg_init(pkg_t *pkg);
void pkg_deinit(pkg_t *pkg);
int pkg_init_from_file(opkg_conf_t *conf, pkg_t *pkg, const char *filename);
abstract_pkg_t *abstract_pkg_new(void);
-int abstract_pkg_init(abstract_pkg_t *ab_pkg);
/*
* merges fields from newpkg into oldpkg.
abstract_pkg_t * ab_pkg;
ab_pkg = abstract_pkg_new();
- if (ab_pkg == NULL) { return NULL; }
ab_pkg->name = xstrdup(pkg_name);
hash_table_insert(hash, pkg_name, ab_pkg);