From 44adf33ca36d01b8d39d87b112fb6b346c0dfa86 Mon Sep 17 00:00:00 2001 From: William Douglas Date: Wed, 13 Feb 2019 09:48:26 -0800 Subject: [PATCH] Clarify function purpose with rename The is_tracked_bundle function doesn't not accurately portray its purpose, rename to is_installed_bundle as it is actually looking at the installed content directory. --- src/bundle.c | 14 +++++++------- src/manifest.c | 2 +- src/search.c | 6 +++--- src/swupd.h | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/bundle.c b/src/bundle.c index 8fde94ad..71134579 100644 --- a/src/bundle.c +++ b/src/bundle.c @@ -113,10 +113,10 @@ free_out: return ret; } -/* Finds out whether bundle_name is tracked bundle on +/* Finds out whether bundle_name is installed bundle on * current system. */ -bool is_tracked_bundle(const char *bundle_name) +bool is_installed_bundle(const char *bundle_name) { struct stat statb; char *filename = NULL; @@ -294,7 +294,7 @@ enum swupd_code show_bundle_reqd_by(const char *bundle_name, bool server) struct list *subs = NULL; struct list *reqd_by = NULL; - if (!server && !is_tracked_bundle(bundle_name)) { + if (!server && !is_installed_bundle(bundle_name)) { fprintf(stderr, "Error: Bundle \"%s\" does not seem to be installed\n", bundle_name); fprintf(stderr, " try passing --all to check uninstalled bundles\n"); ret = SWUPD_BUNDLE_NOT_TRACKED; @@ -537,7 +537,7 @@ enum swupd_code remove_bundles(char **bundles) goto out_free_curl; } - if (!is_tracked_bundle(bundle)) { + if (!is_installed_bundle(bundle)) { fprintf(stderr, "Warning: Bundle \"%s\" is not installed, skipping it...\n", bundle); ret = SWUPD_BUNDLE_NOT_TRACKED; bad++; @@ -717,7 +717,7 @@ int add_subscriptions(struct list *bundles, struct list **subs, struct manifest } free_manifest(manifest); - if (!find_all && is_tracked_bundle(bundle)) { + if (!find_all && is_installed_bundle(bundle)) { continue; } @@ -757,10 +757,10 @@ static enum swupd_code install_bundles(struct list *bundles, struct list **subs, char *bundle; bundle = iter->data; iter = iter->next; - if (is_tracked_bundle(bundle)) { + if (is_installed_bundle(bundle)) { fprintf(stderr, "Warning: Bundle \"%s\" is already installed, skipping it...\n", bundle); already_installed++; - /* track as installed since they tried to install it */ + /* track as installed since the user tried to install */ track_installed(bundle); } /* warn the user if the bundle to be installed is experimental */ diff --git a/src/manifest.c b/src/manifest.c index d54eeb8d..a20d5df1 100644 --- a/src/manifest.c +++ b/src/manifest.c @@ -537,7 +537,7 @@ static void set_untracked_manifest_files(struct manifest *manifest) { struct list *files; - if (!manifest || is_tracked_bundle(manifest->component)) { + if (!manifest || is_installed_bundle(manifest->component)) { return; } diff --git a/src/search.c b/src/search.c index 82ad93a8..657614b1 100644 --- a/src/search.c +++ b/src/search.c @@ -88,8 +88,8 @@ static void add_bundle_file_result(char *bundlename, char *filename, double scor ON_NULL_ABORT(bundle); results = list_append_data(results, bundle); strncpy(bundle->bundle_name, bundlename, BUNDLE_NAME_MAXLEN - 1); - /* record if the bundle is tracked on the system */ - bundle->is_tracked = is_tracked_bundle(bundlename); + /* record if the bundle is installed on the system */ + bundle->is_tracked = is_installed_bundle(bundlename); bundle->is_experimental = is_experimental; } @@ -216,7 +216,7 @@ static long calculate_size(char *bname, struct list *bundle_info, bool installed * * Otherwise only add the contentsize of bundles not already * installed on the system. */ - if (installed || !is_tracked_bundle(bname)) { + if (installed || !is_installed_bundle(bname)) { size += bi->topsize; bi->seen = true; } diff --git a/src/swupd.h b/src/swupd.h index f294bc47..fcecc0b9 100644 --- a/src/swupd.h +++ b/src/swupd.h @@ -364,7 +364,7 @@ struct list *free_bundle(struct list *item); extern void create_and_append_subscription(struct list **subs, const char *component); /* bundle.c */ -extern bool is_tracked_bundle(const char *bundle_name); +extern bool is_installed_bundle(const char *bundle_name); extern enum swupd_code remove_bundles(char **bundles); extern enum swupd_code show_bundle_reqd_by(const char *bundle_name, bool server); extern enum swupd_code show_included_bundles(char *bundle_name);