summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Woodward2018-07-20 23:47:09 -0400
committerJason Woodward2018-07-20 23:47:09 -0400
commit240ed615b6b24b0e2e8e5a94bbdefdd1625b91d4 (patch)
tree1b0922d1a895ce1fe161e72f4c00bedcc9a5e96c
parent7e282ae03acaaceda486a04610df2e23165de53d (diff)
downloadslapt-get-240ed615b6b24b0e2e8e5a94bbdefdd1625b91d4.tar.gz
more boolization
-rw-r--r--src/action.c16
-rw-r--r--src/configuration.c2
-rw-r--r--src/curl.c2
-rw-r--r--src/package.c4
4 files changed, 12 insertions, 12 deletions
diff --git a/src/action.c b/src/action.c
index aab279f..eea7daa 100644
--- a/src/action.c
+++ b/src/action.c
@@ -33,7 +33,7 @@ void slapt_pkg_action_install(const slapt_rc_config *global_config,
installed_pkgs = slapt_get_installed_pkgs();
avail_pkgs = slapt_get_available_pkgs();
- if (avail_pkgs == NULL || avail_pkgs->pkg_count == 0)
+ if (avail_pkgs == NULL || !avail_pkgs->pkg_count)
exit(EXIT_FAILURE);
printf(gettext("Done\n"));
@@ -86,7 +86,7 @@ void slapt_pkg_action_install(const slapt_rc_config *global_config,
slapt_add_install_to_transaction(tran, pkg);
/* if there are conflicts, we schedule the conflicts for removal */
- if (conflicts->pkg_count > 0 && global_config->ignore_dep != true) {
+ if (conflicts->pkg_count && !global_config->ignore_dep) {
slapt_pkg_list_t_foreach (conflict, conflicts) {
/* make sure to remove the conflict's dependencies as well */
slapt_pkg_list_t *conflict_deps = slapt_is_required_by(global_config,
@@ -121,7 +121,7 @@ void slapt_pkg_action_install(const slapt_rc_config *global_config,
installed_pkgs, pkg) == 0) {
slapt_pkg_list_t *conflicts = slapt_is_conflicted(tran, avail_pkgs,
installed_pkgs, pkg);
- if (conflicts->pkg_count > 0 && global_config->ignore_dep != true) {
+ if (conflicts->pkg_count && !global_config->ignore_dep) {
slapt_pkg_list_t_foreach (conflict, conflicts) {
/* make sure to remove the conflict's dependencies as well */
slapt_pkg_list_t *conflict_deps = slapt_is_required_by(global_config,
@@ -471,7 +471,7 @@ void slapt_pkg_action_upgrade_all(const slapt_rc_config *global_config)
if (avail_pkgs == NULL || installed_pkgs == NULL)
exit(EXIT_FAILURE);
- if (avail_pkgs->pkg_count == 0)
+ if (!avail_pkgs->pkg_count)
exit(EXIT_FAILURE);
printf(gettext("Done\n"));
@@ -531,8 +531,8 @@ void slapt_pkg_action_upgrade_all(const slapt_rc_config *global_config)
slapt_pkg_list_t *conflicts = slapt_is_conflicted(tran, avail_pkgs, installed_pkgs, slapt_upgrade_pkg);
/* add install if all deps are good and it doesn't have conflicts */
- if (
- (slapt_add_deps_to_trans(global_config, tran, avail_pkgs, installed_pkgs, slapt_upgrade_pkg) == 0) && (conflicts->pkg_count == 0 && global_config->ignore_dep != true)) {
+ int rc = slapt_add_deps_to_trans(global_config, tran, avail_pkgs, installed_pkgs, slapt_upgrade_pkg);
+ if (!rc && !conflicts->pkg_count && !global_config->ignore_dep) {
slapt_add_install_to_transaction(tran, slapt_upgrade_pkg);
} else {
/* otherwise exclude */
@@ -559,7 +559,7 @@ void slapt_pkg_action_upgrade_all(const slapt_rc_config *global_config)
if (
(slapt_add_deps_to_trans(global_config, tran, avail_pkgs,
installed_pkgs, slapt_upgrade_pkg) == 0) &&
- (conflicts->pkg_count == 0 && global_config->ignore_dep != true)) {
+ (!conflicts->pkg_count && !global_config->ignore_dep)) {
slapt_add_upgrade_to_transaction(tran, installed_pkg,
slapt_upgrade_pkg);
} else {
@@ -645,7 +645,7 @@ void slapt_pkg_action_upgrade_all(const slapt_rc_config *global_config)
if (
(slapt_add_deps_to_trans(global_config, tran, avail_pkgs,
installed_pkgs, update_pkg) == 0) &&
- (global_config->ignore_dep || (conflicts->pkg_count == 0))) {
+ (global_config->ignore_dep || !conflicts->pkg_count)) {
if (cmp_r == 0)
slapt_add_reinstall_to_transaction(tran, installed_pkg, update_pkg);
else
diff --git a/src/configuration.c b/src/configuration.c
index a5aca20..094f814 100644
--- a/src/configuration.c
+++ b/src/configuration.c
@@ -126,7 +126,7 @@ slapt_rc_config *slapt_read_rc_config(const char *file_name)
file_name);
return NULL;
}
- if (global_config->sources->count == 0) {
+ if (!global_config->sources->count) {
fprintf(stderr, gettext("SOURCE directive not set within %s.\n"), file_name);
return NULL;
}
diff --git a/src/curl.c b/src/curl.c
index 02c19c3..5cad37d 100644
--- a/src/curl.c
+++ b/src/curl.c
@@ -61,7 +61,7 @@ int slapt_download_data(FILE *fh, const char *url, size_t bytes, long *filetime,
headers = curl_slist_append(headers, "Pragma: "); /* override no-cache */
- if (global_config->dl_stats != true) {
+ if (!global_config->dl_stats) {
if (global_config->progress_cb == NULL) {
curl_easy_setopt(ch, CURLOPT_PROGRESSFUNCTION, slapt_progress_callback);
} else {
diff --git a/src/package.c b/src/package.c
index f5d61da..6f92e8b 100644
--- a/src/package.c
+++ b/src/package.c
@@ -867,7 +867,7 @@ bool slapt_is_excluded(const slapt_rc_config *global_config,
return false;
/* maybe EXCLUDE= isn't defined in our rc? */
- if (global_config->exclude_list->count == 0)
+ if (!global_config->exclude_list->count)
return false;
slapt_list_t_foreach (exclude, global_config->exclude_list) {
@@ -3297,7 +3297,7 @@ char *slapt_get_pkg_filelist(const slapt_pkg_info_t *pkg)
size_t pls = 1;
/* this only handles installed packages at the moment */
- if (pkg->installed != true)
+ if (!pkg->installed)
return filelist;
pkg_log_dirname = slapt_gen_package_log_dir_name();