diff options
author | Timo Teräs <timo.teras@iki.fi> | 2020-10-05 14:24:08 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2020-10-09 16:09:19 +0300 |
commit | b2af872fff8af2dcde8500f84843c8fa4d554579 (patch) | |
tree | a193819ae91e6b6394a02febaa14627c870a2b8d /src/apk.c | |
parent | 010497cb5ae50713f0ed4e4c4bf3b860bf751da7 (diff) | |
download | apk-tools-b2af872fff8af2dcde8500f84843c8fa4d554579.tar.gz apk-tools-b2af872fff8af2dcde8500f84843c8fa4d554579.tar.bz2 apk-tools-b2af872fff8af2dcde8500f84843c8fa4d554579.tar.xz apk-tools-b2af872fff8af2dcde8500f84843c8fa4d554579.zip |
db: convert repository list to a string array
Diffstat (limited to 'src/apk.c')
-rw-r--r-- | src/apk.c | 17 |
1 files changed, 2 insertions, 15 deletions
@@ -63,16 +63,6 @@ static void version(void) ); } -static struct apk_repository_list *apk_repository_new(const char *url) -{ - struct apk_repository_list *r = calloc(1, sizeof(struct apk_repository_list)); - if (r) { - r->url = url; - list_init(&r->list); - } - return r; -} - #define GLOBAL_OPTIONS(OPT) \ OPT(OPT_GLOBAL_allow_untrusted, "allow-untrusted") \ OPT(OPT_GLOBAL_arch, APK_OPT_ARG "arch") \ @@ -118,8 +108,6 @@ APK_OPT_GROUP(optiondesc_global, "Global", GLOBAL_OPTIONS); static int option_parse_global(void *ctx, struct apk_db_options *dbopts, int opt, const char *optarg) { - struct apk_repository_list *repo; - switch (opt) { case OPT_GLOBAL_help: return -EINVAL; @@ -133,8 +121,7 @@ static int option_parse_global(void *ctx, struct apk_db_options *dbopts, int opt dbopts->repositories_file = optarg; break; case OPT_GLOBAL_repository: - repo = apk_repository_new(optarg); - if (repo) list_add(&repo->list, &dbopts->repository_list); + *apk_string_array_add(&dbopts->repository_list) = (char*) optarg; break; case OPT_GLOBAL_quiet: apk_verbosity--; @@ -471,7 +458,7 @@ int main(int argc, char **argv) apk_argv[argc+1] = NULL; memset(&dbopts, 0, sizeof(dbopts)); - list_init(&dbopts.repository_list); + apk_string_array_init(&dbopts.repository_list); apk_string_array_init(&dbopts.private_keys); umask(0); setup_terminal(); |