public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 ./WHATS_NEW lib/datastruct/str_list.c lib ...
@ 2012-02-08 12:53 zkabelac
  0 siblings, 0 replies; 2+ messages in thread
From: zkabelac @ 2012-02-08 12:53 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2012-02-08 12:53:00

Modified files:
	.              : WHATS_NEW 
	lib/datastruct : str_list.c str_list.h 
	lib/metadata   : metadata.c mirror.c 
	tools          : toollib.c 

Log message:
	Switch to return void
	
	List delete cannot fail, so there is no reason to test for error.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2269&r2=1.2270
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/datastruct/str_list.c.diff?cvsroot=lvm2&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/datastruct/str_list.h.diff?cvsroot=lvm2&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.475&r2=1.476
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/mirror.c.diff?cvsroot=lvm2&r1=1.177&r2=1.178
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.238&r2=1.239

--- LVM2/WHATS_NEW	2012/02/08 12:50:10	1.2269
+++ LVM2/WHATS_NEW	2012/02/08 12:52:58	1.2270
@@ -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.
--- LVM2/lib/datastruct/str_list.c	2010/11/11 12:32:33	1.14
+++ LVM2/lib/datastruct/str_list.c	2012/02/08 12:52:59	1.15
@@ -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 @@
 	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,
--- LVM2/lib/datastruct/str_list.h	2010/11/11 12:32:33	1.11
+++ LVM2/lib/datastruct/str_list.h	2012/02/08 12:52:59	1.12
@@ -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);
--- LVM2/lib/metadata/metadata.c	2012/01/25 08:50:10	1.475
+++ LVM2/lib/metadata/metadata.c	2012/02/08 12:52:59	1.476
@@ -770,13 +770,9 @@
 				  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 @@
 				  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;
 }
 
--- LVM2/lib/metadata/mirror.c	2012/02/08 11:40:02	1.177
+++ LVM2/lib/metadata/mirror.c	2012/02/08 12:52:59	1.178
@@ -335,9 +335,7 @@
 
 	/* 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 @@
 	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 "
--- LVM2/tools/toollib.c	2012/01/25 21:52:53	1.238
+++ LVM2/tools/toollib.c	2012/02/08 12:52:59	1.239
@@ -1594,11 +1594,8 @@
 				  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;
 }


^ permalink raw reply	[flat|nested] 2+ messages in thread

* LVM2 ./WHATS_NEW lib/datastruct/str_list.c lib ...
@ 2007-09-17 16:02 agk
  0 siblings, 0 replies; 2+ messages in thread
From: agk @ 2007-09-17 16:02 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2007-09-17 16:02:46

Modified files:
	.              : WHATS_NEW 
	lib/datastruct : str_list.c 
	lib/metadata   : metadata.c 

Log message:
	Fix strdup memory leak in str_list_dup().

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.706&r2=1.707
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/datastruct/str_list.c.diff?cvsroot=lvm2&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.135&r2=1.136

--- LVM2/WHATS_NEW	2007/09/12 16:54:23	1.706
+++ LVM2/WHATS_NEW	2007/09/17 16:02:46	1.707
@@ -1,5 +1,6 @@
 Version 2.02.29 -
 ==================================
+  Fix strdup memory leak in str_list_dup().
   Avoid static link failure with some SELinux libraries.
   Diagnose invalid PE values given on the pvmove command line (64-bit systems).
   Include strerror string in dev_open_flags' stat failure message.
--- LVM2/lib/datastruct/str_list.c	2007/08/20 20:55:24	1.8
+++ LVM2/lib/datastruct/str_list.c	2007/09/17 16:02:46	1.9
@@ -74,7 +74,7 @@
 	list_init(sllnew);
 
 	list_iterate_items(sl, sllold) {
-		if (!str_list_add(mem, sllnew, strdup(sl->str))) {
+		if (!str_list_add(mem, sllnew, dm_pool_strdup(mem, sl->str))) {
 			stack;
 			return 0;
 		}
--- LVM2/lib/metadata/metadata.c	2007/08/28 16:14:48	1.135
+++ LVM2/lib/metadata/metadata.c	2007/09/17 16:02:46	1.136
@@ -908,6 +908,7 @@
 		return NULL;
 	}
 
+	/* FIXME Can fail when no PV mda */
 	if (!pv->vg_name[0]) {
 		log_error("Physical volume %s not in a volume group", pv_name);
 		return NULL;


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-02-08 12:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-08 12:53 LVM2 ./WHATS_NEW lib/datastruct/str_list.c lib zkabelac
  -- strict thread matches above, loose matches on Subject: below --
2007-09-17 16:02 agk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).