1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

Switch to return void

List delete cannot fail, so there is no reason to test for error.
This commit is contained in:
Zdenek Kabelac 2012-02-08 12:52:58 +00:00
parent f03f322f13
commit 7ce534f911
6 changed files with 16 additions and 33 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.91 -
===================================
Switch int to void return for str_list_del()
Fix error path handling in _build_desc()
Add range test for device number in _scan_proc_dev().
Use signed long for sysconf() call in cmirrord.

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved.
* Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved.
* Copyright (C) 2004-2012 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
@ -50,16 +50,13 @@ int str_list_add(struct dm_pool *mem, struct dm_list *sll, const char *str)
return 1;
}
int str_list_del(struct dm_list *sll, const char *str)
void str_list_del(struct dm_list *sll, const char *str)
{
struct dm_list *slh, *slht;
dm_list_iterate_safe(slh, slht, sll) {
dm_list_iterate_safe(slh, slht, sll)
if (!strcmp(str, dm_list_item(slh, struct str_list)->str))
dm_list_del(slh);
}
return 1;
}
int str_list_dup(struct dm_pool *mem, struct dm_list *sllnew,

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved.
* Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved.
* Copyright (C) 2004-2012 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
@ -18,7 +18,7 @@
struct dm_list *str_list_create(struct dm_pool *mem);
int str_list_add(struct dm_pool *mem, struct dm_list *sll, const char *str);
int str_list_del(struct dm_list *sll, const char *str);
void str_list_del(struct dm_list *sll, const char *str);
int str_list_match_item(const struct dm_list *sll, const char *str);
int str_list_match_list(const struct dm_list *sll, const struct dm_list *sll2, const char **tag_matched);
int str_list_lists_equal(const struct dm_list *sll, const struct dm_list *sll2);

View File

@ -770,13 +770,9 @@ int lv_change_tag(struct logical_volume *lv, const char *tag, int add_tag)
tag, lv->vg->name, lv->name);
return 0;
}
} else {
if (!str_list_del(&lv->tags, tag)) {
log_error("Failed to remove tag %s from %s/%s",
tag, lv->vg->name, lv->name);
return 0;
}
}
} else
str_list_del(&lv->tags, tag);
return 1;
}
@ -800,13 +796,9 @@ int vg_change_tag(struct volume_group *vg, const char *tag, int add_tag)
tag, vg->name);
return 0;
}
} else {
if (!str_list_del(&vg->tags, tag)) {
log_error("Failed to remove tag %s from volume group "
"%s", tag, vg->name);
return 0;
}
}
} else
str_list_del(&vg->tags, tag);
return 1;
}

View File

@ -335,9 +335,7 @@ static int _init_mirror_log(struct cmd_context *cmd,
/* Remove the temporary tags */
dm_list_iterate_items(sl, tags)
if (!str_list_del(&log_lv->tags, sl->str))
log_error("Failed to remove tag %s from mirror log.",
sl->str);
str_list_del(&log_lv->tags, sl->str);
if (activation() && !set_lv(cmd, log_lv, log_lv->size,
in_sync ? -1 : 0)) {
@ -374,9 +372,7 @@ revert_new_lv:
log_lv->status = orig_status;
dm_list_iterate_items(sl, tags)
if (!str_list_del(&log_lv->tags, sl->str))
log_error("Failed to remove tag %s from mirror log.",
sl->str);
str_list_del(&log_lv->tags, sl->str);
if (remove_on_failure && !lv_remove(log_lv)) {
log_error("Manual intervention may be required to remove "

View File

@ -1594,11 +1594,8 @@ static int _pv_change_tag(struct physical_volume *pv, const char *tag, int addta
tag, pv_dev_name(pv));
return 0;
}
} else if (!str_list_del(&pv->tags, tag)) {
log_error("Failed to remove tag %s from physical volume" "%s",
tag, pv_dev_name(pv));
return 0;
}
} else
str_list_del(&pv->tags, tag);
return 1;
}