This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch main in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=96ae2e533e8ebdc23ca6a4078057a34d1700b971 commit 96ae2e533e8ebdc23ca6a4078057a34d1700b971 Author: Guillem Jover <[email protected]> AuthorDate: Sun Jan 1 04:11:17 2023 +0100 lib, src: Fold if with last previous else This simplifies the code and reduces the indentation levels. Changelog: internal --- lib/dpkg/parse.c | 7 +++---- src/deb/build.c | 7 +++---- src/main/archives.c | 24 +++++++++++------------- src/main/script.c | 12 +++++------- 4 files changed, 22 insertions(+), 28 deletions(-) diff --git a/lib/dpkg/parse.c b/lib/dpkg/parse.c index a28983e74..96af147f8 100644 --- a/lib/dpkg/parse.c +++ b/lib/dpkg/parse.c @@ -896,11 +896,10 @@ void copy_dependency_links(struct pkginfo *pkg, for (dop= dyp->list; dop; dop= dop->next) { if (dop->rev_prev) dop->rev_prev->rev_next = dop->rev_next; + else if (available) + dop->ed->depended.available = dop->rev_next; else - if (available) - dop->ed->depended.available = dop->rev_next; - else - dop->ed->depended.installed = dop->rev_next; + dop->ed->depended.installed = dop->rev_next; if (dop->rev_next) dop->rev_next->rev_prev = dop->rev_prev; } diff --git a/src/deb/build.c b/src/deb/build.c index 597872ba2..1f0c050ee 100644 --- a/src/deb/build.c +++ b/src/deb/build.c @@ -177,10 +177,9 @@ file_treewalk_feed(const char *dir, int fd_out) if (S_ISLNK(treenode_get_mode(node))) { fi = file_info_new(nodename); file_info_list_append(&symlist, &symlist_end, fi); - } else { - if (fd_write(fd_out, nodename, strlen(nodename) + 1) < 0) - ohshite(_("failed to write filename to tar pipe (%s)"), - _("data member")); + } else if (fd_write(fd_out, nodename, strlen(nodename) + 1) < 0) { + ohshite(_("failed to write filename to tar pipe (%s)"), + _("data member")); } free(nodename); diff --git a/src/main/archives.c b/src/main/archives.c index b6ca2880d..7e399f922 100644 --- a/src/main/archives.c +++ b/src/main/archives.c @@ -1686,19 +1686,17 @@ wanttoinstall(struct pkginfo *pkg) } else { return true; } + } else if (in_force(FORCE_DOWNGRADE)) { + warning(_("downgrading %.250s from %.250s to %.250s"), + pkg_name(pkg, pnaw_nonambig), + versiondescribe(&pkg->installed.version, vdew_nonambig), + versiondescribe(&pkg->available.version, vdew_nonambig)); + return true; } else { - if (in_force(FORCE_DOWNGRADE)) { - warning(_("downgrading %.250s from %.250s to %.250s"), - pkg_name(pkg, pnaw_nonambig), - versiondescribe(&pkg->installed.version, vdew_nonambig), - versiondescribe(&pkg->available.version, vdew_nonambig)); - return true; - } else { - notice(_("will not downgrade %.250s from %.250s to %.250s, skipping"), - pkg_name(pkg, pnaw_nonambig), - versiondescribe(&pkg->installed.version, vdew_nonambig), - versiondescribe(&pkg->available.version, vdew_nonambig)); - return false; - } + notice(_("will not downgrade %.250s from %.250s to %.250s, skipping"), + pkg_name(pkg, pnaw_nonambig), + versiondescribe(&pkg->installed.version, vdew_nonambig), + versiondescribe(&pkg->available.version, vdew_nonambig)); + return false; } } diff --git a/src/main/script.c b/src/main/script.c index b4f369dfa..017d92efe 100644 --- a/src/main/script.c +++ b/src/main/script.c @@ -358,13 +358,11 @@ maintscript_fallback(struct pkginfo *pkg, } warning(_("unable to stat %s '%.250s': %s"), cmd.name, oldscriptpath, strerror(errno)); - } else { - if (!maintscript_exec(pkg, &pkg->installed, &cmd, &stab, SUBPROC_WARN)) { - command_destroy(&cmd); - free(buf); - post_script_tasks(); - return 1; - } + } else if (!maintscript_exec(pkg, &pkg->installed, &cmd, &stab, SUBPROC_WARN)) { + command_destroy(&cmd); + free(buf); + post_script_tasks(); + return 1; } notice(_("trying script from the new package instead ...")); -- Dpkg.Org's dpkg

