summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Woodward2018-07-20 23:16:37 -0400
committerJason Woodward2018-07-20 23:27:49 -0400
commit7e282ae03acaaceda486a04610df2e23165de53d (patch)
treed3a98a2cb1d1080258ca14d8f808fc54d230814e
parentcaceb0ac9e1b45d1623b0de6c5bcca6862614726 (diff)
downloadslapt-get-7e282ae03acaaceda486a04610df2e23165de53d.tar.gz
clang-format
-rw-r--r--.clang-format42
-rw-r--r--src/action.c37
-rw-r--r--src/common.c4
-rw-r--r--src/configuration.c6
-rw-r--r--src/curl.c13
-rw-r--r--src/main.c4
-rw-r--r--src/package.c161
-rw-r--r--src/package.h2
-rw-r--r--src/transaction.c94
9 files changed, 192 insertions, 171 deletions
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..6a555de
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,42 @@
+´╗┐Language: Cpp
+IndentWidth: 4
+AllowShortFunctionsOnASingleLine: None
+KeepEmptyLinesAtTheStartOfBlocks: false
+ColumnLimit: 0
+UseTab: Never
+TabWidth: 4
+# BreakBeforeBraces: Linux
+BreakBeforeBraces: Custom
+BraceWrapping:
+ AfterClass: true
+ AfterControlStatement: false
+ AfterEnum: false
+ AfterFunction: true
+ AfterNamespace: false
+ AfterObjCDeclaration: true
+ AfterStruct: false
+ AfterUnion: false
+ AfterExternBlock: true
+ BeforeCatch: true
+ BeforeElse: false
+ IndentBraces: false
+ SplitEmptyFunction: false
+ SplitEmptyRecord: false
+ SplitEmptyNamespace: false
+PointerBindsToType: false
+SortIncludes: false
+ForEachMacros: [
+'slapt_list_t_foreach',
+'slapt_source_list_t_foreach',
+'slapt_pkg_list_t_foreach',
+'slapt_pkg_upgrade_list_t_foreach',
+'slapt_pkg_err_list_t_foreach',
+'slapt_queue_t_foreach'
+]
+SpaceBeforeParens: ControlStatements
+SpaceBeforeAssignmentOperators: true
+AlignAfterOpenBracket: true
+AlignConsecutiveAssignments: false
+SpaceBeforeRangeBasedForLoopColon: true
+# SpacesBeforeTrailingComments: true
+SpacesInParentheses: false
diff --git a/src/action.c b/src/action.c
index cb73df2..aab279f 100644
--- a/src/action.c
+++ b/src/action.c
@@ -44,7 +44,7 @@ void slapt_pkg_action_install(const slapt_rc_config *global_config,
exit(EXIT_FAILURE);
}
- slapt_list_t_foreach(arg, action_args) {
+ slapt_list_t_foreach (arg, action_args) {
slapt_pkg_info_t *pkg = NULL;
slapt_pkg_info_t *installed_pkg = NULL;
@@ -82,19 +82,18 @@ 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);
- /* this comes first so we can pick up that we are installed the package when
- * checking conflicts */
+ /* this comes first so we can pick up that we are installed the package when checking conflicts */
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) {
- slapt_pkg_list_t_foreach(conflict, conflicts) {
+ 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,
avail_pkgs, installed_pkgs,
tran->install_pkgs, tran->remove_pkgs,
conflict);
- slapt_pkg_list_t_foreach(conflict_dep, conflict_deps) {
+ slapt_pkg_list_t_foreach (conflict_dep, conflict_deps) {
if (slapt_get_exact_pkg(installed_pkgs, conflict_dep->name, conflict_dep->version) != NULL) {
slapt_add_remove_to_transaction(tran, conflict_dep);
}
@@ -123,13 +122,13 @@ void slapt_pkg_action_install(const slapt_rc_config *global_config,
slapt_pkg_list_t *conflicts = slapt_is_conflicted(tran, avail_pkgs,
installed_pkgs, pkg);
if (conflicts->pkg_count > 0 && global_config->ignore_dep != true) {
- slapt_pkg_list_t_foreach(conflict, conflicts) {
+ 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,
avail_pkgs, installed_pkgs,
tran->install_pkgs, tran->remove_pkgs,
conflict);
- slapt_pkg_list_t_foreach(conflict_dep, conflict_deps) {
+ slapt_pkg_list_t_foreach (conflict_dep, conflict_deps) {
if (slapt_get_exact_pkg(installed_pkgs, conflict_dep->name, conflict_dep->version) != NULL) {
slapt_add_remove_to_transaction(tran, conflict_dep);
}
@@ -182,7 +181,7 @@ void slapt_pkg_action_list(const int show)
installed_pkgs = slapt_get_installed_pkgs();
if (show == LIST || show == AVAILABLE) {
- slapt_pkg_list_t_foreach(pkg, pkgs) {
+ slapt_pkg_list_t_foreach (pkg, pkgs) {
bool installed = false;
char *short_description = slapt_gen_short_pkg_description(pkg);
@@ -202,7 +201,7 @@ void slapt_pkg_action_list(const int show)
}
}
if (show == LIST || show == INSTALLED) {
- slapt_pkg_list_t_foreach(pkg, installed_pkgs) {
+ slapt_pkg_list_t_foreach (pkg, installed_pkgs) {
char *short_description = NULL;
if (show == LIST) {
@@ -245,7 +244,7 @@ void slapt_pkg_action_remove(const slapt_rc_config *global_config,
exit(EXIT_FAILURE);
}
- slapt_list_t_foreach(arg, action_args) {
+ slapt_list_t_foreach (arg, action_args) {
slapt_pkg_list_t *deps = NULL;
slapt_pkg_info_t *pkg = NULL;
@@ -280,7 +279,7 @@ void slapt_pkg_action_remove(const slapt_rc_config *global_config,
tran->install_pkgs, tran->remove_pkgs,
pkg);
- slapt_pkg_list_t_foreach(dep, deps) {
+ slapt_pkg_list_t_foreach (dep, deps) {
if (slapt_get_exact_pkg(installed_pkgs, dep->name, dep->version) != NULL) {
slapt_add_remove_to_transaction(tran, dep);
}
@@ -294,7 +293,7 @@ void slapt_pkg_action_remove(const slapt_rc_config *global_config,
if (global_config->remove_obsolete) {
slapt_pkg_list_t *obsolete = slapt_get_obsolete_pkgs(global_config, avail_pkgs, installed_pkgs);
- slapt_pkg_list_t_foreach(pkg, obsolete) {
+ slapt_pkg_list_t_foreach (pkg, obsolete) {
if (slapt_is_excluded(global_config, pkg)) {
slapt_add_exclude_to_transaction(tran, pkg);
} else {
@@ -330,7 +329,7 @@ void slapt_pkg_action_search(const char *pattern)
matches = slapt_search_pkg_list(pkgs, pattern);
i_matches = slapt_search_pkg_list(installed_pkgs, pattern);
- slapt_pkg_list_t_foreach(pkg, matches) {
+ slapt_pkg_list_t_foreach (pkg, matches) {
char *short_description = slapt_gen_short_pkg_description(pkg);
printf("%s-%s [inst=%s]: %s\n",
@@ -343,7 +342,7 @@ void slapt_pkg_action_search(const char *pattern)
free(short_description);
}
- slapt_pkg_list_t_foreach(installed_pkg, i_matches) {
+ slapt_pkg_list_t_foreach (installed_pkg, i_matches) {
char *short_description = NULL;
if (slapt_get_exact_pkg(matches, installed_pkg->name, installed_pkg->version) != NULL) {
@@ -507,7 +506,7 @@ void slapt_pkg_action_upgrade_all(const slapt_rc_config *global_config)
}
/* loop through SLAPT_SLACK_BASE_SET_REGEX packages */
- slapt_pkg_list_t_foreach(pkg, matches) {
+ slapt_pkg_list_t_foreach (pkg, matches) {
slapt_pkg_info_t *installed_pkg = NULL;
slapt_pkg_info_t *newer_avail_pkg = NULL;
slapt_pkg_info_t *slapt_upgrade_pkg = NULL;
@@ -581,7 +580,7 @@ void slapt_pkg_action_upgrade_all(const slapt_rc_config *global_config)
if (global_config->remove_obsolete) {
slapt_pkg_list_t *obsolete = slapt_get_obsolete_pkgs(global_config, avail_pkgs, installed_pkgs);
- slapt_pkg_list_t_foreach(obsolete_pkg, obsolete) {
+ slapt_pkg_list_t_foreach (obsolete_pkg, obsolete) {
if (slapt_is_excluded(global_config, obsolete_pkg)) {
slapt_add_exclude_to_transaction(tran, obsolete_pkg);
} else {
@@ -603,7 +602,7 @@ void slapt_pkg_action_upgrade_all(const slapt_rc_config *global_config)
}
}
- slapt_pkg_list_t_foreach(installed_pkg, installed_pkgs) {
+ slapt_pkg_list_t_foreach (installed_pkg, installed_pkgs) {
slapt_pkg_info_t *update_pkg = NULL;
slapt_pkg_info_t *newer_installed_pkg = NULL;
@@ -628,7 +627,7 @@ void slapt_pkg_action_upgrade_all(const slapt_rc_config *global_config)
if (
/* either it's greater, or we want to reinstall */
cmp_r < 0 || (global_config->re_install) ||
- /*
+ /*
* or this is a dist upgrade and the versions are the save
* except for the arch
*/
@@ -719,7 +718,7 @@ void slapt_pkg_action_add_keys(const slapt_rc_config *global_config)
{
int rc = 0;
bool compressed = false;
- slapt_source_list_t_foreach(source, global_config->sources) {
+ slapt_source_list_t_foreach (source, global_config->sources) {
FILE *gpg_key = NULL;
const char *source_url = source->url;
printf(gettext("Retrieving GPG key [%s]..."), source_url);
diff --git a/src/common.c b/src/common.c
index dff01db..b920f54 100644
--- a/src/common.c
+++ b/src/common.c
@@ -453,7 +453,7 @@ void slapt_remove_list_item(slapt_list_t *list, const char *item)
const char *slapt_search_list(slapt_list_t *list, const char *needle)
{
- slapt_list_t_foreach(i, list) {
+ slapt_list_t_foreach (i, list) {
if (strcmp(i, needle) == 0)
return i;
}
@@ -463,7 +463,7 @@ const char *slapt_search_list(slapt_list_t *list, const char *needle)
void slapt_free_list(slapt_list_t *list)
{
- slapt_list_t_foreach(i, list) {
+ slapt_list_t_foreach (i, list) {
free(i);
}
free(list->items);
diff --git a/src/configuration.c b/src/configuration.c
index 3d91ae0..a5aca20 100644
--- a/src/configuration.c
+++ b/src/configuration.c
@@ -251,7 +251,7 @@ void slapt_remove_source(slapt_source_list_t *list, const char *s)
void slapt_free_source_list(slapt_source_list_t *list)
{
- slapt_source_list_t_foreach(source, list) {
+ slapt_source_list_t_foreach (source, list) {
slapt_free_source(source);
}
free(list->src);
@@ -390,7 +390,7 @@ int slapt_write_rc_config(const slapt_rc_config *global_config, const char *loca
fprintf(rc, "%s%s\n", SLAPT_WORKINGDIR_TOKEN, global_config->working_dir);
fprintf(rc, "%s", SLAPT_EXCLUDE_TOKEN);
- slapt_list_t_foreach(exclude, global_config->exclude_list) {
+ slapt_list_t_foreach (exclude, global_config->exclude_list) {
if (i + 1 == global_config->exclude_list->count) {
fprintf(rc, "%s", exclude);
} else {
@@ -400,7 +400,7 @@ int slapt_write_rc_config(const slapt_rc_config *global_config, const char *loca
}
fprintf(rc, "\n");
- slapt_source_list_t_foreach(src, global_config->sources) {
+ slapt_source_list_t_foreach (src, global_config->sources) {
SLAPT_PRIORITY_T priority = src->priority;
const char *token = SLAPT_SOURCE_TOKEN;
diff --git a/src/curl.c b/src/curl.c
index 9a74e20..02c19c3 100644
--- a/src/curl.c
+++ b/src/curl.c
@@ -86,10 +86,10 @@ int slapt_download_data(FILE *fh, const char *url, size_t bytes, long *filetime,
curl_easy_getinfo(ch, CURLINFO_FILETIME, filetime);
/*
- * need to use curl_easy_cleanup() so that we don't
- * have tons of open connections, getting rejected
- * by ftp servers for being naughty.
- */
+ need to use curl_easy_cleanup() so that we don't
+ have tons of open connections, getting rejected
+ by ftp servers for being naughty.
+ */
curl_easy_cleanup(ch);
/* can't do a curl_free() after curl_easy_cleanup() */
/* curl_free(ch); */
@@ -264,10 +264,7 @@ const char *slapt_download_pkg(const slapt_rc_config *global_config,
} else if (dl_return == CURLE_HTTP_RANGE_ERROR ||
dl_return == CURLE_FTP_BAD_DOWNLOAD_RESUME ||
dl_return == CURLE_PARTIAL_FILE) {
- /*
- * this is for errors trying to resume. unlink the file and
- * try again.
- */
+ /* this is for errors trying to resume. unlink the file and try again. */
printf("\r");
fclose(fh);
diff --git a/src/main.c b/src/main.c
index d98f957..a2b1c3a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -339,7 +339,7 @@ int main(int argc, char *argv[])
matches = slapt_search_pkg_list(avail_pkgs, search);
free(search);
- slapt_pkg_list_t_foreach(match, matches) {
+ slapt_pkg_list_t_foreach (match, matches) {
if (!slapt_is_excluded(global_config, match)) {
slapt_add_pkg_to_pkg_list(set_pkgs, match);
}
@@ -351,7 +351,7 @@ int main(int argc, char *argv[])
paa = slapt_init_list();
- slapt_pkg_list_t_foreach(set_pkg, set_pkgs) {
+ slapt_pkg_list_t_foreach (set_pkg, set_pkgs) {
slapt_add_list_item(paa, set_pkg->name);
}
diff --git a/src/package.c b/src/package.c
index 9e199ba..f5d61da 100644
--- a/src/package.c
+++ b/src/package.c
@@ -69,8 +69,8 @@ slapt_pkg_list_t *slapt_get_available_pkgs(void)
list = slapt_parse_packages_txt(pkg_list_fh);
fclose(pkg_list_fh);
- /* this is pointless to do if we wrote the data sorted, but this
- ensures upgrades from older, presorting slapt-gets still work
+ /* this is pointless to do if we wrote the data sorted, but this
+ ensures upgrades from older, presorting slapt-gets still work
as expected. */
qsort(list->pkgs, list->pkg_count, sizeof(list->pkgs[0]), pkg_compare);
@@ -520,9 +520,9 @@ slapt_pkg_list_t *slapt_get_installed_pkgs(void)
strcat(pkg_f_name, file->d_name);
/*
- open the package log file so that we can mmap it and parse out the
- package attributes.
- */
+ open the package log file so that we can mmap it and parse out the
+ package attributes.
+ */
pkg_f = slapt_open_file(pkg_f_name, "r");
if (pkg_f == NULL)
exit(EXIT_FAILURE);
@@ -591,7 +591,6 @@ slapt_pkg_list_t *slapt_get_installed_pkgs(void)
}
/* Ignore the location for installed packages */
-
if (strstr(pkg_data, "PACKAGE DESCRIPTION") != NULL) {
char *desc_p = strstr(pkg_data, "PACKAGE DESCRIPTION");
char *nl = strchr(desc_p, '\n');
@@ -680,7 +679,7 @@ slapt_pkg_info_t *slapt_get_newest_pkg(slapt_pkg_list_t *pkg_list,
const char *pkg_name)
{
slapt_pkg_info_t *found = NULL;
- slapt_pkg_list_t_foreach(pkg, pkg_list) {
+ slapt_pkg_list_t_foreach (pkg, pkg_list) {
if (strcmp(pkg->name, pkg_name) != 0)
continue;
if ((found == NULL) || (slapt_cmp_pkgs(found, pkg) < 0))
@@ -722,7 +721,7 @@ slapt_pkg_info_t *slapt_get_exact_pkg(slapt_pkg_list_t *list,
}
} else {
- slapt_pkg_list_t_foreach(pkg, list) {
+ slapt_pkg_list_t_foreach (pkg, list) {
if ((strcmp(name, pkg->name) == 0) && (strcmp(version, pkg->version) == 0)) {
return pkg;
}
@@ -851,7 +850,7 @@ void slapt_free_pkg(slapt_pkg_info_t *pkg)
void slapt_free_pkg_list(slapt_pkg_list_t *list)
{
if (list->free_pkgs) {
- slapt_pkg_list_t_foreach(pkg, list) {
+ slapt_pkg_list_t_foreach (pkg, list) {
slapt_free_pkg(pkg);
}
}
@@ -860,7 +859,7 @@ void slapt_free_pkg_list(slapt_pkg_list_t *list)
}
bool slapt_is_excluded(const slapt_rc_config *global_config,
- slapt_pkg_info_t *pkg)
+ slapt_pkg_info_t *pkg)
{
int name_reg_ret = -1, version_reg_ret = -1, location_reg_ret = -1;
@@ -871,7 +870,7 @@ bool slapt_is_excluded(const slapt_rc_config *global_config,
if (global_config->exclude_list->count == 0)
return false;
- slapt_list_t_foreach(exclude, global_config->exclude_list) {
+ slapt_list_t_foreach (exclude, global_config->exclude_list) {
slapt_regex_t *exclude_reg = NULL;
/* return if its an exact match */
@@ -879,7 +878,7 @@ bool slapt_is_excluded(const slapt_rc_config *global_config,
return true;
/*
- this regex has to be init'd and free'd within the loop b/c the regex is pulled
+ this regex has to be init'd and free'd within the loop b/c the regex is pulled
from the exclude list
*/
if ((exclude_reg = slapt_init_regex(exclude)) == NULL) {
@@ -943,7 +942,7 @@ void slapt_get_md5sums(slapt_pkg_list_t *pkgs, FILE *checksum_file)
version = slapt_regex_extract_match(md5sum_regex, getline_buffer, 4);
/* see if we can match up name, version, and location */
- slapt_pkg_list_t_foreach(pkg, pkgs) {
+ slapt_pkg_list_t_foreach (pkg, pkgs) {
if (
(strcmp(pkg->name, name) == 0) &&
(slapt_cmp_pkg_versions(pkg->version, version) == 0) &&
@@ -1014,10 +1013,10 @@ int slapt_cmp_pkg_versions(const char *a, const char *b)
while (position < a_parts->count && position < b_parts->count) {
if (strcasecmp(a_parts->parts[position], b_parts->parts[position]) != 0) {
/*
- * if the integer value of the version part is the same
- * and the # of version parts is the same (fixes 3.8.1p1-i486-1
- * to 3.8p1-i486-1)
- */
+ if the integer value of the version part is the same
+ and the # of version parts is the same (fixes 3.8.1p1-i486-1
+ to 3.8p1-i486-1)
+ */
if ((atoi(a_parts->parts[position]) == atoi(b_parts->parts[position])) &&
(a_parts->count == b_parts->count)) {
if (strverscmp(a_parts->parts[position], b_parts->parts[position]) < 0) {
@@ -1048,10 +1047,10 @@ int slapt_cmp_pkg_versions(const char *a, const char *b)
}
/*
- * if we got this far, we know that some or all of the version
- * parts are equal in both packages. If pkg-a has 3 version parts
- * and pkg-b has 2, then we assume pkg-a to be greater.
- */
+ if we got this far, we know that some or all of the version
+ parts are equal in both packages. If pkg-a has 3 version parts
+ and pkg-b has 2, then we assume pkg-a to be greater.
+ */
if (a_parts->count != b_parts->count) {
if (a_parts->count > b_parts->count) {
slapt_free_pkg_version_parts(a_parts);
@@ -1068,9 +1067,9 @@ int slapt_cmp_pkg_versions(const char *a, const char *b)
slapt_free_pkg_version_parts(b_parts);
/*
- * Now we check to see that the version follows the standard slackware
- * convention. If it does, we will compare the build portions.
- */
+ Now we check to see that the version follows the standard slackware
+ convention. If it does, we will compare the build portions.
+ */
/* make sure the packages have at least two separators */
if ((index(a, '-') != rindex(a, '-')) && (index(b, '-') != rindex(b, '-'))) {
char *a_build, *b_build;
@@ -1107,9 +1106,9 @@ int slapt_cmp_pkg_versions(const char *a, const char *b)
}
/*
- * If both have the same # of version parts, non-standard version convention,
- * then we fall back on strverscmp.
- */
+ If both have the same # of version parts, non-standard version convention,
+ then we fall back on strverscmp.
+ */
if (strchr(a, '-') == NULL && strchr(b, '-') == NULL)
return strverscmp(a, b);
@@ -1192,7 +1191,7 @@ static struct slapt_pkg_version_parts *break_down_pkg_version(const char *versio
void slapt_write_pkg_data(const char *source_url, FILE *d_file,
slapt_pkg_list_t *pkgs)
{
- slapt_pkg_list_t_foreach(pkg, pkgs) {
+ slapt_pkg_list_t_foreach (pkg, pkgs) {
fprintf(d_file, "PACKAGE NAME: %s-%s%s\n", pkg->name, pkg->version, pkg->file_ext);
if (pkg->mirror != NULL && strlen(pkg->mirror) > 0) {
fprintf(d_file, "PACKAGE MIRROR: %s\n", pkg->mirror);
@@ -1240,7 +1239,7 @@ slapt_pkg_list_t *slapt_search_pkg_list(slapt_pkg_list_t *list,
if ((search_regex = slapt_init_regex(pattern)) == NULL)
return matches;
- slapt_pkg_list_t_foreach(pkg, list) {
+ slapt_pkg_list_t_foreach (pkg, list) {
if (strcmp(pkg->name, pattern) == 0) {
slapt_add_pkg_to_pkg_list(matches, pkg);
continue;
@@ -1283,10 +1282,7 @@ int slapt_get_pkg_dependencies(const slapt_rc_config *global_config,
uint32_t i = 0;
slapt_list_t *dep_parts = NULL;
- /*
- * don't go any further if the required member is empty
- * or disable_dep_check is set
- */
+ /* don't go any further if the required member is empty or disable_dep_check is set */
if (global_config->disable_dep_check ||
strcmp(pkg->required, "") == 0 ||
strcmp(pkg->required, " ") == 0 ||
@@ -1304,7 +1300,7 @@ int slapt_get_pkg_dependencies(const slapt_rc_config *global_config,
/* parse dep line */
dep_parts = slapt_parse_delimited_list(pkg->required, ',');
- slapt_list_t_foreach(part, dep_parts) {
+ slapt_list_t_foreach (part, dep_parts) {
slapt_pkg_info_t *tmp_pkg = NULL;
if (strchr(part, '|') != NULL) {
@@ -1361,9 +1357,9 @@ int slapt_get_pkg_dependencies(const slapt_rc_config *global_config,
}
/*
- * now put the pkg we found at the end...
- * note no resizing is necessary, we just moved the location
- */
+ now put the pkg we found at the end...
+ note no resizing is necessary, we just moved the location
+ */
if (tmp != NULL)
deps->pkgs[deps->pkg_count - 1] = tmp;
}
@@ -1387,9 +1383,7 @@ slapt_pkg_list_t *slapt_get_pkg_conflicts(slapt_pkg_list_t *avail_pkgs,
conflicts = slapt_init_pkg_list();
- /*
- * don't go any further if the required member is empty
- */
+ /* don't go any further if the required member is empty */
if (strcmp(pkg->conflicts, "") == 0 ||
strcmp(pkg->conflicts, " ") == 0 ||
strcmp(pkg->conflicts, " ") == 0)
@@ -1497,9 +1491,9 @@ static slapt_pkg_info_t *parse_meta_entry(slapt_pkg_list_t *avail_pkgs,
slapt_free_regex(parse_dep_regex);
/*
- * check the newest version of tmp_pkg_name (in newest_installed_pkg)
- * before we try looping through installed_pkgs
- */
+ check the newest version of tmp_pkg_name (in newest_installed_pkg)
+ before we try looping through installed_pkgs
+ */
if (newest_installed_pkg != NULL) {
/* if condition is "=",">=", or "=<" and versions are the same */
if ((strchr(tmp_pkg_cond, '=') != NULL) &&
@@ -1528,7 +1522,7 @@ static slapt_pkg_info_t *parse_meta_entry(slapt_pkg_list_t *avail_pkgs,
}
}
- slapt_pkg_list_t_foreach(installed_pkg, installed_pkgs) {
+ slapt_pkg_list_t_foreach (installed_pkg, installed_pkgs) {
if (strcmp(tmp_pkg_name, installed_pkg->name) != 0)
continue;
@@ -1560,9 +1554,9 @@ static slapt_pkg_info_t *parse_meta_entry(slapt_pkg_list_t *avail_pkgs,
}
/*
- * check the newest version of tmp_pkg_name (in newest_avail_pkg)
- * before we try looping through avail_pkgs
- */
+ check the newest version of tmp_pkg_name (in newest_avail_pkg)
+ before we try looping through avail_pkgs
+ */
if (newest_avail_pkg != NULL) {
/* if condition is "=",">=", or "=<" and versions are the same */
if ((strchr(tmp_pkg_cond, '=') != NULL) &&
@@ -1592,7 +1586,7 @@ static slapt_pkg_info_t *parse_meta_entry(slapt_pkg_list_t *avail_pkgs,
}
/* loop through avail_pkgs */
- slapt_pkg_list_t_foreach(avail_pkg, avail_pkgs) {
+ slapt_pkg_list_t_foreach (avail_pkg, avail_pkgs) {
if (strcmp(tmp_pkg_name, avail_pkg->name) != 0)
continue;
@@ -1638,9 +1632,7 @@ slapt_pkg_list_t *slapt_is_required_by(const slapt_rc_config *global_config,
{
slapt_pkg_list_t *required_by_list = slapt_init_pkg_list();
- /*
- * don't go any further if disable_dep_check is set
- */
+ /* don't go any further if disable_dep_check is set */
if (global_config->disable_dep_check)
return required_by_list;
@@ -1705,7 +1697,7 @@ static void required_by(slapt_pkg_list_t *avail,
free(pkg_name);
free(reg);
- slapt_pkg_list_t_foreach(avail_pkg, avail) {
+ slapt_pkg_list_t_foreach (avail_pkg, avail) {
slapt_list_t *dep_list = NULL;
if (strcmp(avail_pkg->required, "") == 0)
@@ -1723,7 +1715,7 @@ static void required_by(slapt_pkg_list_t *avail,
/* check for the offending dependency entry and see if we have an alternative */
dep_list = slapt_parse_delimited_list(avail_pkg->required, ',');
- slapt_list_t_foreach(part, dep_list) {
+ slapt_list_t_foreach (part, dep_list) {
slapt_list_t *satisfies = NULL;
bool has_alternative = false, found = false;
@@ -1744,7 +1736,7 @@ static void required_by(slapt_pkg_list_t *avail,
/* we need to find out if we have something else that satisfies the dependency */
satisfies = slapt_parse_delimited_list(part, '|');
- slapt_list_t_foreach(satisfies_part, satisfies) {
+ slapt_list_t_foreach (satisfies_part, satisfies) {
slapt_pkg_info_t *tmp_pkg = parse_meta_entry(avail, installed_pkgs, satisfies_part);
if (tmp_pkg == NULL)
continue;
@@ -1824,7 +1816,7 @@ slapt_pkg_info_t *slapt_get_pkg_by_details(slapt_pkg_list_t *list,
}
} else {
- slapt_pkg_list_t_foreach(pkg, list) {
+ slapt_pkg_list_t_foreach (pkg, list) {
if (strcmp(pkg->name, name) == 0) {
if (version != NULL) {
if (strcmp(pkg->version, version) == 0) {
@@ -1852,7 +1844,7 @@ int slapt_update_pkg_cache(const slapt_rc_config *global_config)
new_pkgs->free_pkgs = true;
/* go through each package source and download the meta data */
- slapt_source_list_t_foreach(source, global_config->sources) {
+ slapt_source_list_t_foreach (source, global_config->sources) {
bool compressed = false;
slapt_pkg_list_t *available_pkgs = NULL;
slapt_pkg_list_t *patch_pkgs = NULL;
@@ -1939,7 +1931,7 @@ int slapt_update_pkg_cache(const slapt_rc_config *global_config)
slapt_get_md5sums(available_pkgs, tmp_checksum_f);
- slapt_pkg_list_t_foreach(p, available_pkgs) {
+ slapt_pkg_list_t_foreach (p, available_pkgs) {
int mirror_len = -1;
/* honor the mirror if it was set in the PACKAGES.TXT */
@@ -1959,7 +1951,7 @@ int slapt_update_pkg_cache(const slapt_rc_config *global_config)
if (patch_pkgs) {
slapt_get_md5sums(patch_pkgs, tmp_checksum_f);
- slapt_pkg_list_t_foreach(patch_pkg, patch_pkgs) {
+ slapt_pkg_list_t_foreach (patch_pkg, patch_pkgs) {
int mirror_len = -1;
/* honor the mirror if it was set in the PACKAGES.TXT */
@@ -2180,7 +2172,7 @@ slapt_code_t slapt_verify_downloaded_pkg(const slapt_rc_config *global_config,
char md5sum_f[SLAPT_MD5_STR_LEN];
/*
- size_t file_size = 0;
+ size_t file_size = 0;
check the file size first so we don't run an md5 checksum
on an incomplete file
@@ -2190,11 +2182,11 @@ slapt_code_t slapt_verify_downloaded_pkg(const slapt_rc_config *global_config,
the PACKAGES.TXT... we do not really lose a lot by not checking
since we are validating the checksum anyway.
- file_size = slapt_get_pkg_file_size(global_config,pkg);
- if ((uint32_t)(file_size/1024) != pkg->size_c) {
- return SLAPT_DOWNLOAD_INCOMPLETE;
- }
- */
+ file_size = slapt_get_pkg_file_size(global_config,pkg);
+ if ((uint32_t)(file_size/1024) != pkg->size_c) {
+ return SLAPT_DOWNLOAD_INCOMPLETE;
+ }
+ */
/* if not checking the md5 checksum and the sizes match, assume its good */
if (global_config->no_md5_check)
@@ -2397,7 +2389,7 @@ static slapt_pkg_info_t *find_or_requirement(slapt_pkg_list_t *avail_pkgs,
slapt_pkg_info_t *pkg = NULL;
slapt_list_t *alternates = slapt_parse_delimited_list(required_str, '|');
- slapt_list_t_foreach(alternate, alternates) {
+ slapt_list_t_foreach (alternate, alternates) {
slapt_pkg_info_t *tmp_pkg = parse_meta_entry(avail_pkgs, installed_pkgs, alternate);
if (tmp_pkg != NULL) {
@@ -2483,9 +2475,9 @@ void slapt_add_pkg_err_to_list(slapt_pkg_err_list_t *l,
}
bool slapt_search_pkg_err_list(slapt_pkg_err_list_t *l,
- const char *pkg, const char *err)
+ const char *pkg, const char *err)
{
- slapt_pkg_err_list_t_foreach(error, l) {
+ slapt_pkg_err_list_t_foreach (error, l) {
if (strcmp(error->pkg, pkg) == 0 &&
strcmp(error->error, err) == 0) {
return true;
@@ -2496,7 +2488,7 @@ bool slapt_search_pkg_err_list(slapt_pkg_err_list_t *l,
void slapt_free_pkg_err_list(slapt_pkg_err_list_t *l)
{
- slapt_pkg_err_list_t_foreach(error, l) {
+ slapt_pkg_err_list_t_foreach (error, l) {
free(error->pkg);
free(error->error);
free(error);
@@ -2781,7 +2773,7 @@ slapt_pkg_list_t *slapt_get_pkg_source_patches(const slapt_rc_config *global_con
fprintf(stderr, gettext("Failed to download: %s\n"), err);
fclose(tmp_patch_f);
/* we don't care if the patch fails, for example current
- doesn't have patches source_dl_failed = true; */
+ doesn't have patches source_dl_failed = true; */
slapt_clear_head_cache(patch_filename);
}
@@ -2797,10 +2789,10 @@ slapt_pkg_list_t *slapt_get_pkg_source_patches(const slapt_rc_config *global_con
char *patch_filename = slapt_gen_filename_from_url(url, SLAPT_PATCHES_LIST);
char *patch_local_head = slapt_read_head_cache(patch_filename);
/*
- we go ahead and run the head request, not caring if it failed.
- If the subsequent download fails as well, it will give a nice
- error message of why.
- */
+ we go ahead and run the head request, not caring if it failed.
+ If the subsequent download fails as well, it will give a nice
+ error message of why.
+ */
patch_head = slapt_head_mirror_data(url, SLAPT_PATCHES_LIST);
if (patch_head != NULL && patch_local_head != NULL &&
@@ -2938,10 +2930,10 @@ FILE *slapt_get_pkg_source_checksums(const slapt_rc_config *global_config,
char *filename = slapt_gen_filename_from_url(url, SLAPT_CHECKSUM_FILE);
char *local_head = slapt_read_head_cache(filename);
/*
- we go ahead and run the head request, not caring if it failed.
- If the subsequent download fails as well, it will give a nice
- error message of why.
- */
+ we go ahead and run the head request, not caring if it failed.
+ If the subsequent download fails as well, it will give a nice
+ error message of why.
+ */
checksum_head = slapt_head_mirror_data(url, SLAPT_CHECKSUM_FILE);
if (checksum_head != NULL && local_head != NULL &&
@@ -2999,7 +2991,7 @@ FILE *slapt_get_pkg_source_checksums(const slapt_rc_config *global_config,
}
bool slapt_get_pkg_source_changelog(const slapt_rc_config *global_config,
- const char *url, bool *compressed)
+ const char *url, bool *compressed)
{
char *changelog_head = NULL;
char *filename = NULL;
@@ -3232,12 +3224,11 @@ slapt_get_obsolete_pkgs(const slapt_rc_config *global_config,
slapt_pkg_list_t *to_install = slapt_init_pkg_list();
slapt_pkg_list_t *to_remove = slapt_init_pkg_list();
- slapt_pkg_list_t_foreach(p, installed_pkgs) {
-
+ slapt_pkg_list_t_foreach (p, installed_pkgs) {
/*
- * if we can't find the installed package in our available pkg list,
- * it must be obsolete
- */
+ if we can't find the installed package in our available pkg list,
+ it must be obsolete
+ */
if (slapt_get_newest_pkg(avail_pkgs, p->name) == NULL) {
slapt_pkg_list_t *deps;
@@ -3247,7 +3238,7 @@ slapt_get_obsolete_pkgs(const slapt_rc_config *global_config,
*/
deps = slapt_is_required_by(global_config, avail_pkgs, installed_pkgs, to_install, to_remove, p);
- slapt_pkg_list_t_foreach(dep, deps) {
+ slapt_pkg_list_t_foreach (dep, deps) {
slapt_pkg_info_t *installed_dep = slapt_get_exact_pkg(installed_pkgs, dep->name, dep->version);
/* if it is installed, we add it to the list */
@@ -3331,7 +3322,7 @@ char *slapt_get_pkg_filelist(const slapt_pkg_info_t *pkg)
/*
open the package log file so that we can mmap it and parse out the
file list.
- */
+ */
pkg_f = slapt_open_file(pkg_f_name, "r");
if (pkg_f == NULL)
exit(EXIT_FAILURE);
diff --git a/src/package.h b/src/package.h
index 426afb8..70b6327 100644
--- a/src/package.h
+++ b/src/package.h
@@ -314,7 +314,7 @@ char *slapt_stringify_pkg(const slapt_pkg_info_t *pkg);
char *slapt_get_pkg_filelist(const slapt_pkg_info_t *pkg);
/*
- generate the directory name for the package log directory,
+ generate the directory name for the package log directory,
considering the ROOT environment variable if set
caller responsible for freeing the returned data
*/
diff --git a/src/transaction.c b/src/transaction.c
index c57d9da..7882506 100644
--- a/src/transaction.c
+++ b/src/transaction.c
@@ -72,14 +72,14 @@ int slapt_handle_transaction(const slapt_rc_config *global_config,
/* show unmet dependencies */
if (tran->missing_err->err_count > 0) {
fprintf(stderr, gettext("The following packages have unmet dependencies:\n"));
- slapt_pkg_err_list_t_foreach(error, tran->missing_err) {
+ slapt_pkg_err_list_t_foreach (error, tran->missing_err) {
fprintf(stderr, gettext(" %s: Depends: %s\n"), error->pkg, error->error);
}
}
/* show conflicts */
if (tran->conflict_err->err_count > 0) {
- slapt_pkg_err_list_t_foreach(conflict_error, tran->conflict_err) {
+ slapt_pkg_err_list_t_foreach (conflict_error, tran->conflict_err) {
fprintf(stderr, gettext("%s, which is required by %s, is excluded\n"),
conflict_error->error, conflict_error->pkg);
}
@@ -91,7 +91,7 @@ int slapt_handle_transaction(const slapt_rc_config *global_config,
printf(" ");
len = 0;
- slapt_pkg_list_t_foreach(e, tran->exclude_pkgs) {
+ slapt_pkg_list_t_foreach (e, tran->exclude_pkgs) {
if (len + strlen(e->name) + 1 < MAX_LINE_LEN) {
printf("%s ", e->name);
len += strlen(e->name) + 1;
@@ -107,12 +107,11 @@ int slapt_handle_transaction(const slapt_rc_config *global_config,
/* show suggested pkgs */
slapt_generate_suggestions(tran);
if (tran->suggests->count > 0) {
-
printf(gettext("Suggested packages:\n"));
printf(" ");
len = 0;
- slapt_list_t_foreach(s, tran->suggests) {
+ slapt_list_t_foreach (s, tran->suggests) {
/* don't show suggestion for something we already have in the transaction */
if (slapt_search_transaction(tran, s))
continue;
@@ -134,7 +133,7 @@ int slapt_handle_transaction(const slapt_rc_config *global_config,
printf(" ");
len = 0;
- slapt_pkg_list_t_foreach(p, tran->install_pkgs) {
+ slapt_pkg_list_t_foreach (p, tran->install_pkgs) {
size_t existing_file_size = 0;
if (len + strlen(p->name) + 1 < MAX_LINE_LEN) {
@@ -163,7 +162,7 @@ int slapt_handle_transaction(const slapt_rc_config *global_config,
printf(" ");
len = 0;
- slapt_pkg_list_t_foreach(r, tran->remove_pkgs) {
+ slapt_pkg_list_t_foreach (r, tran->remove_pkgs) {
if (len + strlen(r->name) + 1 < MAX_LINE_LEN) {
printf("%s ", r->name);
len += strlen(r->name) + 1;
@@ -180,14 +179,13 @@ int slapt_handle_transaction(const slapt_rc_config *global_config,
/* show pkgs to upgrade */
if (tran->upgrade_pkgs->pkg_count > 0) {
-
if ((tran->upgrade_pkgs->pkg_count - tran->upgrade_pkgs->reinstall_count) > 0) {
printf(gettext("The following packages will be upgraded:\n"));
printf(" ");
}
len = 0;
- slapt_pkg_upgrade_list_t_foreach(upgrade, tran->upgrade_pkgs) {
+ slapt_pkg_upgrade_list_t_foreach (upgrade, tran->upgrade_pkgs) {
slapt_pkg_info_t *u = upgrade->upgrade;
slapt_pkg_info_t *p = upgrade->installed;
@@ -226,7 +224,7 @@ int slapt_handle_transaction(const slapt_rc_config *global_config,
printf(" ");
len = 0;
- slapt_pkg_upgrade_list_t_foreach(reinstall_upgrade, tran->upgrade_pkgs) {
+ slapt_pkg_upgrade_list_t_foreach (reinstall_upgrade, tran->upgrade_pkgs) {
slapt_pkg_info_t *u = reinstall_upgrade->upgrade;
int line_len = len + strlen(u->name) + 1;
@@ -335,13 +333,13 @@ int slapt_handle_transaction(const slapt_rc_config *global_config,
}
if (global_config->print_uris) {
- slapt_pkg_list_t_foreach(info, tran->install_pkgs) {
+ slapt_pkg_list_t_foreach (info, tran->install_pkgs) {
const char *location = info->location + strspn(info->location, "./");
printf("%s%s/%s-%s%s\n",
info->mirror, location, info->name,
info->version, info->file_ext);
}
- slapt_pkg_upgrade_list_t_foreach(upgrade, tran->upgrade_pkgs) {
+ slapt_pkg_upgrade_list_t_foreach (upgrade, tran->upgrade_pkgs) {
const slapt_pkg_info_t *upgrade_info = upgrade->upgrade;
const char *location = upgrade_info->location + strspn(upgrade_info->location, "./");
printf("%s%s/%s-%s%s\n",
@@ -353,11 +351,11 @@ int slapt_handle_transaction(const slapt_rc_config *global_config,
/* if simulate is requested, just show what could happen and return */
if (global_config->simulate) {
- slapt_pkg_list_t_foreach(r, tran->remove_pkgs) {
+ slapt_pkg_list_t_foreach (r, tran->remove_pkgs) {
printf(gettext("%s-%s is to be removed\n"), r->name, r->version);
}
- slapt_queue_t_foreach(q, tran->queue) {
+ slapt_queue_t_foreach (q, tran->queue) {
if (q->type == INSTALL) {
printf(gettext("%s-%s is to be installed\n"),
q->pkg.i->name,
@@ -377,7 +375,7 @@ int slapt_handle_transaction(const slapt_rc_config *global_config,
pkg_dl_count = tran->install_pkgs->pkg_count + tran->upgrade_pkgs->pkg_count;
/* download pkgs */
- slapt_pkg_list_t_foreach(pkg, tran->install_pkgs) {
+ slapt_pkg_list_t_foreach (pkg, tran->install_pkgs) {
bool failed = true;
++dl_counter;
@@ -398,7 +396,7 @@ int slapt_handle_transaction(const slapt_rc_config *global_config,
exit(EXIT_FAILURE);
}
- slapt_pkg_upgrade_list_t_foreach(upgrade, tran->upgrade_pkgs) {
+ slapt_pkg_upgrade_list_t_foreach (upgrade, tran->upgrade_pkgs) {
bool failed = true;
++dl_counter;
@@ -422,13 +420,13 @@ int slapt_handle_transaction(const slapt_rc_config *global_config,
/* run transaction, remove, install, and upgrade */
if (global_config->download_only == false) {
- slapt_pkg_list_t_foreach(remove_pkg, tran->remove_pkgs) {
+ slapt_pkg_list_t_foreach (remove_pkg, tran->remove_pkgs) {
if (slapt_remove_pkg(global_config, remove_pkg) == -1) {
exit(EXIT_FAILURE);
}
}
- slapt_queue_t_foreach(q, tran->queue) {
+ slapt_queue_t_foreach (q, tran->queue) {
if (q->type == INSTALL) {
printf(gettext("Preparing to install %s-%s\n"),
q->pkg.i->name,
@@ -598,22 +596,22 @@ static void _slapt_add_upgrade_to_transaction(slapt_transaction_t *tran,
bool slapt_search_transaction(slapt_transaction_t *tran, char *pkg_name)
{
- slapt_pkg_list_t_foreach(pkg, tran->install_pkgs) {
+ slapt_pkg_list_t_foreach (pkg, tran->install_pkgs) {
if (strcmp(pkg_name, pkg->name) == 0)
return true;
}
- slapt_pkg_upgrade_list_t_foreach(upgrade, tran->upgrade_pkgs) {
+ slapt_pkg_upgrade_list_t_foreach (upgrade, tran->upgrade_pkgs) {
if (strcmp(pkg_name, upgrade->upgrade->name) == 0)
return true;
}
- slapt_pkg_list_t_foreach(remove_pkg, tran->remove_pkgs) {
+ slapt_pkg_list_t_foreach (remove_pkg, tran->remove_pkgs) {
if (strcmp(pkg_name, remove_pkg->name) == 0)
return true;
}
- slapt_pkg_list_t_foreach(exclude_pkg, tran->exclude_pkgs) {
+ slapt_pkg_list_t_foreach (exclude_pkg, tran->exclude_pkgs) {
if (strcmp(pkg_name, exclude_pkg->name) == 0)
return true;
}
@@ -622,9 +620,9 @@ bool slapt_search_transaction(slapt_transaction_t *tran, char *pkg_name)
}
bool slapt_search_upgrade_transaction(slapt_transaction_t *tran,
- slapt_pkg_info_t *pkg)
+ slapt_pkg_info_t *pkg)
{
- slapt_pkg_upgrade_list_t_foreach(upgrade, tran->upgrade_pkgs) {
+ slapt_pkg_upgrade_list_t_foreach (upgrade, tran->upgrade_pkgs) {
if (strcmp(pkg->name, upgrade->upgrade->name) == 0)
return true;
}
@@ -635,7 +633,7 @@ bool slapt_search_upgrade_transaction(slapt_transaction_t *tran,
void slapt_free_transaction(slapt_transaction_t *tran)
{
if (tran->install_pkgs->free_pkgs) {
- slapt_pkg_list_t_foreach(pkg, tran->install_pkgs) {
+ slapt_pkg_list_t_foreach (pkg, tran->install_pkgs) {
slapt_free_pkg(pkg);
}
}
@@ -643,14 +641,14 @@ void slapt_free_transaction(slapt_transaction_t *tran)
free(tran->install_pkgs);
if (tran->remove_pkgs->free_pkgs) {
- slapt_pkg_list_t_foreach(remove_pkg, tran->remove_pkgs) {
+ slapt_pkg_list_t_foreach (remove_pkg, tran->remove_pkgs) {
slapt_free_pkg(remove_pkg);
}
}
free(tran->remove_pkgs->pkgs);
free(tran->remove_pkgs);
- slapt_pkg_upgrade_list_t_foreach(upgrade, tran->upgrade_pkgs) {
+ slapt_pkg_upgrade_list_t_foreach (upgrade, tran->upgrade_pkgs) {
slapt_free_pkg(upgrade->upgrade);
slapt_free_pkg(upgrade->installed);
free(upgrade);
@@ -659,7 +657,7 @@ void slapt_free_transaction(slapt_transaction_t *tran)
free(tran->upgrade_pkgs);
if (tran->exclude_pkgs->free_pkgs) {
- slapt_pkg_list_t_foreach(exclude_pkg, tran->exclude_pkgs) {
+ slapt_pkg_list_t_foreach (exclude_pkg, tran->exclude_pkgs) {
slapt_free_pkg(exclude_pkg);
}
}
@@ -692,7 +690,7 @@ slapt_transaction_t *slapt_remove_from_transaction(slapt_transaction_t *tran,
new_tran->exclude_pkgs = slapt_malloc(sizeof *new_tran->exclude_pkgs);
new_tran = slapt_init_transaction();
- slapt_pkg_list_t_foreach(installed_pkg, tran->install_pkgs) {
+ slapt_pkg_list_t_foreach (installed_pkg, tran->install_pkgs) {
if (
strcmp(pkg->name, installed_pkg->name) == 0 &&
strcmp(pkg->version, installed_pkg->version) == 0 &&
@@ -703,7 +701,7 @@ slapt_transaction_t *slapt_remove_from_transaction(slapt_transaction_t *tran,
slapt_add_install_to_transaction(new_tran, installed_pkg);
}
- slapt_pkg_list_t_foreach(remove_pkg, tran->remove_pkgs) {
+ slapt_pkg_list_t_foreach (remove_pkg, tran->remove_pkgs) {
if (
strcmp(pkg->name, remove_pkg->name) == 0 &&
strcmp(pkg->version, remove_pkg->version) == 0 &&
@@ -714,7 +712,7 @@ slapt_transaction_t *slapt_remove_from_transaction(slapt_transaction_t *tran,
slapt_add_remove_to_transaction(new_tran, remove_pkg);
}
- slapt_pkg_upgrade_list_t_foreach(upgrade, tran->upgrade_pkgs) {
+ slapt_pkg_upgrade_list_t_foreach (upgrade, tran->upgrade_pkgs) {
slapt_pkg_info_t *u = upgrade->upgrade;
slapt_pkg_info_t *p = upgrade->installed;
@@ -728,7 +726,7 @@ slapt_transaction_t *slapt_remove_from_transaction(slapt_transaction_t *tran,
slapt_add_upgrade_to_transaction(new_tran, p, u);
}
- slapt_pkg_list_t_foreach(exclude_pkg, tran->exclude_pkgs) {
+ slapt_pkg_list_t_foreach (exclude_pkg, tran->exclude_pkgs) {
if (
strcmp(pkg->name, exclude_pkg->name) == 0 &&
strcmp(pkg->version, exclude_pkg->version) == 0 &&
@@ -774,18 +772,14 @@ int slapt_add_deps_to_trans(const slapt_rc_config *global_config,
}
/* loop through the deps */
- slapt_pkg_list_t_foreach(dep, deps) {
+ slapt_pkg_list_t_foreach (dep, deps) {
slapt_pkg_info_t *dep_installed = NULL;
slapt_pkg_list_t *conflicts = NULL;
- /*
- * the dep wouldn't get this far if it where excluded,
- * so we don't check for that here
- */
-
+ /* the dep wouldn't get this far if it where excluded, so we don't check for that here */
conflicts = slapt_is_conflicted(tran, avail_pkgs, installed_pkgs, dep);
- slapt_pkg_list_t_foreach(conflict, conflicts) {
+ slapt_pkg_list_t_foreach (conflict, conflicts) {
slapt_add_remove_to_transaction(tran, conflict);
}
@@ -815,11 +809,9 @@ slapt_pkg_list_t *slapt_is_conflicted(slapt_transaction_t *tran,
slapt_pkg_list_t *conflicts = NULL;
slapt_pkg_list_t *conflicts_in_transaction = slapt_init_pkg_list();
- /* if conflicts exist, check to see if they are installed
- or in the current transaction
- */
+ /* if conflicts exist, check to see if they are installed or in the current transaction */
conflicts = slapt_get_pkg_conflicts(avail_pkgs, installed_pkgs, pkg);
- slapt_pkg_list_t_foreach(conflict, conflicts) {
+ slapt_pkg_list_t_foreach (conflict, conflicts) {
if (slapt_search_upgrade_transaction(tran, conflict) == 1 || slapt_get_newest_pkg(tran->install_pkgs, conflict->name) != NULL) {
printf(gettext("%s, which is to be installed, conflicts with %s\n"), conflict->name, pkg->name);
@@ -847,7 +839,7 @@ static void add_suggestion(slapt_transaction_t *tran, slapt_pkg_info_t *pkg)
suggests = slapt_parse_delimited_list(pkg->suggests, ',');
- slapt_list_t_foreach(s, suggests) {
+ slapt_list_t_foreach (s, suggests) {
/* no need to add it if we already have it */
if (slapt_search_transaction(tran, s))
continue;
@@ -859,26 +851,26 @@ static void add_suggestion(slapt_transaction_t *tran, slapt_pkg_info_t *pkg)
}
bool slapt_search_transaction_by_pkg(slapt_transaction_t *tran,
- slapt_pkg_info_t *pkg)
+ slapt_pkg_info_t *pkg)
{
- slapt_pkg_list_t_foreach(install_pkg, tran->install_pkgs) {
+ slapt_pkg_list_t_foreach (install_pkg, tran->install_pkgs) {
if ((strcmp(pkg->name, install_pkg->name) == 0) && (strcmp(pkg->version, install_pkg->version) == 0))
return true;
}
- slapt_pkg_upgrade_list_t_foreach(upgrade, tran->upgrade_pkgs) {
+ slapt_pkg_upgrade_list_t_foreach (upgrade, tran->upgrade_pkgs) {
slapt_pkg_info_t *p = upgrade->upgrade;
if ((strcmp(pkg->name, p->name) == 0) && (strcmp(pkg->version, p->version) == 0))
return true;
}
- slapt_pkg_list_t_foreach(remove_pkg, tran->remove_pkgs) {
+ slapt_pkg_list_t_foreach (remove_pkg, tran->remove_pkgs) {
if ((strcmp(pkg->name, remove_pkg->name) == 0) && (strcmp(pkg->version, remove_pkg->version) == 0))
return true;
}
- slapt_pkg_list_t_foreach(exclude_pkg, tran->exclude_pkgs) {
+ slapt_pkg_list_t_foreach (exclude_pkg, tran->exclude_pkgs) {
if ((strcmp(pkg->name, exclude_pkg->name) == 0) && (strcmp(pkg->version, exclude_pkg->version) == 0))
return true;
}
@@ -928,7 +920,7 @@ static void queue_add_upgrade(slapt_queue_t *t, slapt_pkg_upgrade_t *p)
static void queue_free(slapt_queue_t *t)
{
- slapt_queue_t_foreach(i, t) {
+ slapt_queue_t_foreach (i, t) {
free(i);
}
free(t->pkgs);
@@ -937,7 +929,7 @@ static void queue_free(slapt_queue_t *t)
void slapt_generate_suggestions(slapt_transaction_t *tran)
{
- slapt_pkg_list_t_foreach(pkg, tran->install_pkgs) {
+ slapt_pkg_list_t_foreach (pkg, tran->install_pkgs) {
add_suggestion(tran, pkg);
}
}