[Reproducible-commits] [dpkg] 16/63: u-a: Remove useless alternative_has_slave() before alternative_get_slave()
Jérémy Bobbio
lunar at moszumanska.debian.org
Fri Mar 4 17:44:42 UTC 2016
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch pu/buildinfo
in repository dpkg.
commit 465a927a09fe640f96b60dabf91f4d27eac077f2
Author: Guillem Jover <guillem at debian.org>
Date: Mon Feb 22 19:17:38 2016 +0100
u-a: Remove useless alternative_has_slave() before alternative_get_slave()
This gets rid of a warning with gcc-6, that does not understand that we
never pass a NULL ‘sl’ pointer as we have checked previously if it has
slaves via alternative_has_slave().
And gets rid of unneeded calls to alternative_has_slave(), which
internally do alternative_get_slave() anyway.
---
utils/update-alternatives.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index 77f93b3..5dc3213 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -1135,8 +1135,8 @@ alternative_parse_slave(struct alternative *a, struct altdb_context *ctx)
free(name);
return false;
}
- if (alternative_has_slave(a, name)) {
- sl = alternative_get_slave(a, name);
+ sl = alternative_get_slave(a, name);
+ if (sl) {
free(name);
ctx->bad_format(ctx, _("duplicate slave name %s"), sl->name);
}
@@ -2149,16 +2149,18 @@ static void
alternative_evolve_slave(struct alternative *a, const char *cur_choice,
struct slave_link *sl, struct fileset *fs)
{
+ struct slave_link *sl_old;
struct stat st;
char *new_file = NULL;
const char *old, *new;
- if (!alternative_has_slave(a, sl->name)) {
+ sl_old = alternative_get_slave(a, sl->name);
+ if (sl_old == NULL) {
sl->updated = true;
return;
}
- old = alternative_get_slave(a, sl->name)->link;
+ old = sl_old->link;
new = sl->link;
if (cur_choice && strcmp(cur_choice, fs->master_file) == 0) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git
More information about the Reproducible-commits
mailing list