summaryrefslogtreecommitdiffstats
path: root/libopkg
diff options
context:
space:
mode:
authorgraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-11-24 23:22:20 (EST)
committer graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-11-24 23:22:20 (EST)
commitf2a37ae1c0b560a685f8a14643463b8f2a5fc8ce (patch)
treed954a285d95d287b10f95c3d3c59e384b842d98a /libopkg
parente74d3456b50efca2e50b9c18be5faa66ec1ac67a (diff)
Make a couple of functions static, and return void since they cannot fail.
git-svn-id: http://opkg.googlecode.com/svn/trunk@368 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'libopkg')
-rw-r--r--libopkg/pkg.c52
-rw-r--r--libopkg/pkg.h2
-rw-r--r--libopkg/pkg_hash.c1
3 files changed, 20 insertions, 35 deletions
diff --git a/libopkg/pkg.c b/libopkg/pkg.c
index bba04ff..4ce3fb0 100644
--- a/libopkg/pkg.c
+++ b/libopkg/pkg.c
@@ -75,17 +75,8 @@ static const enum_map_t pkg_state_status_map[] = {
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;
@@ -139,8 +130,16 @@ int pkg_init(pkg_t *pkg)
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)
@@ -449,35 +448,24 @@ int pkg_merge(pkg_t *oldpkg, pkg_t *newpkg, int set_status)
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;
diff --git a/libopkg/pkg.h b/libopkg/pkg.h
index 694bda9..328d479 100644
--- a/libopkg/pkg.h
+++ b/libopkg/pkg.h
@@ -188,11 +188,9 @@ struct pkg
};
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.
diff --git a/libopkg/pkg_hash.c b/libopkg/pkg_hash.c
index ace26bf..83415ab 100644
--- a/libopkg/pkg_hash.c
+++ b/libopkg/pkg_hash.c
@@ -609,7 +609,6 @@ static abstract_pkg_t * add_new_abstract_pkg_by_name(hash_table_t * hash, const
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);