From: graham.gower Date: Fri, 6 Nov 2009 00:50:12 +0000 (+0000) Subject: Remove some bogus error checking and return void instead of int. X-Git-Url: https://git.librecmc.org/?p=oweals%2Fopkg-lede.git;a=commitdiff_plain;h=a6502c7951410e25df67c621165581ebd99fbb0f;hp=ef04881ebc73c33de134a10b3cb8bb69f8008752 Remove some bogus error checking and return void instead of int. git-svn-id: http://opkg.googlecode.com/svn/trunk@266 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358 --- diff --git a/libopkg/args.c b/libopkg/args.c index b7aafcd..f1f7952 100644 --- a/libopkg/args.c +++ b/libopkg/args.c @@ -50,11 +50,8 @@ enum long_args_opt char *conf_file_dir; -int args_init(args_t *args) +void args_init(args_t *args) { - if (!args) { - return EFAULT; - } memset(args, 0, sizeof(args_t)); args->dest = ARGS_DEFAULT_DEST; @@ -85,8 +82,6 @@ int args_init(args_t *args) args->multiple_providers = 0; args->nocheckfordirorfile = 0; args->noreadfeedsfile = 0; - - return 0; } void args_deinit(args_t *args) diff --git a/libopkg/args.h b/libopkg/args.h index e8bb78b..7992844 100644 --- a/libopkg/args.h +++ b/libopkg/args.h @@ -70,7 +70,7 @@ typedef struct args args_t; #define ARGS_DEFAULT_VERBOSITY 1 #define ARGS_DEFAULT_AUTOREMOVE 0 -int args_init(args_t *args); +void args_init(args_t *args); void args_deinit(args_t *args); int args_parse(args_t *args, int argc, char *argv[]); void args_usage(char *complaint); diff --git a/libopkg/opkg.c b/libopkg/opkg.c index d7948e9..785d588 100644 --- a/libopkg/opkg.c +++ b/libopkg/opkg.c @@ -190,13 +190,7 @@ opkg_new () opkg = xcalloc(1, sizeof (opkg_t)); opkg->args = xcalloc(1, sizeof (args_t)); - err = args_init (opkg->args); - if (err) - { - free (opkg->args); - free (opkg); - return NULL; - } + args_init (opkg->args); opkg->conf = xcalloc(1, sizeof (opkg_conf_t)); err = opkg_conf_init (opkg->conf, opkg->args); diff --git a/libopkg/opkg_conf.c b/libopkg/opkg_conf.c index b6ca4a8..ce68ae1 100644 --- a/libopkg/opkg_conf.c +++ b/libopkg/opkg_conf.c @@ -50,7 +50,7 @@ static int set_and_load_pkg_src_list(opkg_conf_t *conf, static int set_and_load_pkg_dest_list(opkg_conf_t *conf, nv_pair_list_t *nv_pair_list, char * lists_dir); -int opkg_init_options_array(const opkg_conf_t *conf, opkg_option_t **options) +void opkg_init_options_array(const opkg_conf_t *conf, opkg_option_t **options) { opkg_option_t tmp[] = { { "cache", OPKG_OPT_TYPE_STRING, &conf->cache}, @@ -99,7 +99,6 @@ int opkg_init_options_array(const opkg_conf_t *conf, opkg_option_t **options) *options = xcalloc(1, sizeof(tmp)); memcpy(*options, tmp, sizeof(tmp)); - return 0; }; static void opkg_conf_override_string(char **conf_str, char *arg_str) @@ -520,8 +519,7 @@ static int opkg_conf_parse_file(opkg_conf_t *conf, const char *filename, #define regmatch_size 12 regmatch_t regmatch[regmatch_size]; - if (opkg_init_options_array(conf, &options)<0) - return ENOMEM; + opkg_init_options_array(conf, &options); if (file == NULL) { fprintf(stderr, "%s: failed to open %s: %s\n", diff --git a/libopkg/opkg_conf.h b/libopkg/opkg_conf.h index a219c6c..b19e5dd 100644 --- a/libopkg/opkg_conf.h +++ b/libopkg/opkg_conf.h @@ -130,6 +130,6 @@ int opkg_conf_write_status_files(opkg_conf_t *conf); char *root_filename_alloc(opkg_conf_t *conf, char *filename); -int opkg_init_options_array(const opkg_conf_t *conf, opkg_option_t **options); +void opkg_init_options_array(const opkg_conf_t *conf, opkg_option_t **options); #endif