[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] LVM2 ./WHATS_NEW_DM daemons/dmeventd/dmeventd. ...



CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk sourceware org	2010-08-16 18:19:46

Modified files:
	.              : WHATS_NEW_DM 
	daemons/dmeventd: dmeventd.c libdevmapper-event.c 
	daemons/dmeventd/plugins/mirror: dmeventd_mirror.c 

Log message:
	Remove superfluous NULL pointer tests before dm_free from dmeventd.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.408&r2=1.409
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/dmeventd.c.diff?cvsroot=lvm2&r1=1.64&r2=1.65
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/libdevmapper-event.c.diff?cvsroot=lvm2&r1=1.32&r2=1.33
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c.diff?cvsroot=lvm2&r1=1.36&r2=1.37

--- LVM2/WHATS_NEW_DM	2010/08/16 11:22:08	1.408
+++ LVM2/WHATS_NEW_DM	2010/08/16 18:19:46	1.409
@@ -1,5 +1,6 @@
 Version 1.02.54 - 
 ================================
+  Remove superfluous NULL pointer tests before dm_free from dmeventd.
   Assume dm-mod autoloading support is in kernel 2.6.36 and higher, not 2.6.35.
   Fix udev rules to support udev database content generated by older rules.
   Reinstate detection of inappropriate uevent with DISK_RO set and suppress it.
--- LVM2/daemons/dmeventd/dmeventd.c	2010/07/13 13:51:02	1.64
+++ LVM2/daemons/dmeventd/dmeventd.c	2010/08/16 18:19:46	1.65
@@ -327,13 +327,10 @@
 /* Free message memory. */
 static void _free_message(struct message_data *message_data)
 {
-	if (message_data->id)
-		dm_free(message_data->id);
-	if (message_data->dso_name)
-		dm_free(message_data->dso_name);
+	dm_free(message_data->id);
+	dm_free(message_data->dso_name);
 
-	if (message_data->device_uuid)
-		dm_free(message_data->device_uuid);
+	dm_free(message_data->device_uuid);
 
 }
 
@@ -1051,8 +1048,7 @@
 			   && (thread->events)) ? thread->events : thread->
 	    events | DM_EVENT_REGISTRATION_PENDING;
 
-	if (msg->data)
-		dm_free(msg->data);
+	dm_free(msg->data);
 
 	msg->size = dm_asprintf(&(msg->data), fmt, id, dso, dev, events);
 
@@ -1162,8 +1158,7 @@
 	struct thread_status *thread;
 	struct dm_event_daemon_message *msg = message_data->msg;
 
-	if (msg->data)
-		dm_free(msg->data);
+	dm_free(msg->data);
 
 	_lock_mutex();
 	if ((thread = _lookup_thread_status(message_data))) {
@@ -1287,8 +1282,7 @@
 	}
 
 	if (bytes != size) {
-		if (msg->data)
-			dm_free(msg->data);
+		dm_free(msg->data);
 		msg->data = NULL;
 		msg->size = 0;
 	}
@@ -1416,8 +1410,7 @@
 	if (!_client_write(fifos, &msg))
 		stack;
 
-	if (msg.data)
-		dm_free(msg.data);
+	dm_free(msg.data);
 }
 
 static void _cleanup_unused_threads(void)
--- LVM2/daemons/dmeventd/libdevmapper-event.c	2010/04/14 13:01:42	1.32
+++ LVM2/daemons/dmeventd/libdevmapper-event.c	2010/08/16 18:19:46	1.33
@@ -47,10 +47,8 @@
 
 static void _dm_event_handler_clear_dev_info(struct dm_event_handler *dmevh)
 {
-	if (dmevh->dev_name)
-		dm_free(dmevh->dev_name);
-	if (dmevh->uuid)
-		dm_free(dmevh->uuid);
+	dm_free(dmevh->dev_name);
+	dm_free(dmevh->uuid);
 	dmevh->dev_name = dmevh->uuid = NULL;
 	dmevh->major = dmevh->minor = 0;
 }
@@ -73,8 +71,7 @@
 void dm_event_handler_destroy(struct dm_event_handler *dmevh)
 {
 	_dm_event_handler_clear_dev_info(dmevh);
-	if (dmevh->dso)
-		dm_free(dmevh->dso);
+	dm_free(dmevh->dso);
 	dm_free(dmevh);
 }
 
@@ -82,8 +79,7 @@
 {
 	if (!path) /* noop */
 		return 0;
-	if (dmevh->dso)
-		dm_free(dmevh->dso);
+	dm_free(dmevh->dso);
 
 	dmevh->dso = dm_strdup(path);
 	if (!dmevh->dso)
@@ -259,8 +255,7 @@
 	}
 
 	if (bytes != size) {
-		if (msg->data)
-			dm_free(msg->data);
+		dm_free(msg->data);
 		msg->data = NULL;
 	}
 
@@ -366,8 +361,7 @@
 
 	do {
 
-		if (msg->data)
-			dm_free(msg->data);
+		dm_free(msg->data);
 		msg->data = 0;
 
 		if (!_daemon_read(fifos, msg)) {
@@ -564,8 +558,7 @@
 
 	ret = _daemon_talk(&fifos, msg, DM_EVENT_CMD_HELLO, 0, 0, 0, 0);
 
-	if (msg->data)
-		dm_free(msg->data);
+	dm_free(msg->data);
 	msg->data = 0;
 
 	if (!ret)
@@ -600,8 +593,7 @@
 		ret = 0;
 	}
 
-	if (msg.data)
-		dm_free(msg.data);
+	dm_free(msg.data);
 
 	dm_task_destroy(dmt);
 
@@ -630,8 +622,7 @@
 		ret = 0;
 	}
 
-	if (msg.data)
-		dm_free(msg.data);
+	dm_free(msg.data);
 
 	dm_task_destroy(dmt);
 
@@ -711,10 +702,8 @@
 	dm_task_destroy(dmt);
 	dmt = NULL;
 
-	if (msg.data) {
-		dm_free(msg.data);
-		msg.data = NULL;
-	}
+	dm_free(msg.data);
+	msg.data = NULL;
 
 	_dm_event_handler_clear_dev_info(dmevh);
 	dmevh->uuid = dm_strdup(reply_uuid);
@@ -731,15 +720,11 @@
 	dm_event_handler_set_dso(dmevh, reply_dso);
 	dm_event_handler_set_event_mask(dmevh, reply_mask);
 
-	if (reply_dso) {
-		dm_free(reply_dso);
-		reply_dso = NULL;
-	}
+	dm_free(reply_dso);
+	reply_dso = NULL;
 
-	if (reply_uuid) {
-		dm_free(reply_uuid);
-		reply_uuid = NULL;
-	}
+	dm_free(reply_uuid);
+	reply_uuid = NULL;
 
 	dmevh->dev_name = dm_strdup(dm_task_get_name(dmt));
 	if (!dmevh->dev_name) {
@@ -760,12 +745,9 @@
 	return ret;
 
  fail:
-	if (msg.data)
-		dm_free(msg.data);
-	if (reply_dso)
-		dm_free(reply_dso);
-	if (reply_uuid)
-		dm_free(reply_uuid);
+	dm_free(msg.data);
+	dm_free(reply_dso);
+	dm_free(reply_uuid);
 	_dm_event_handler_clear_dev_info(dmevh);
 	if (dmt)
 		dm_task_destroy(dmt);
--- LVM2/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c	2010/07/09 15:34:41	1.36
+++ LVM2/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c	2010/08/16 18:19:46	1.37
@@ -119,13 +119,11 @@
 		goto out_parse;
 
 out:
-	if (args)
-		dm_free(args);
+	dm_free(args);
 	return r;
 	
 out_parse:
-	if (args)
-		dm_free(args);
+	dm_free(args);
 	syslog(LOG_ERR, "Unable to parse mirror status string.");
 	return ME_IGNORE;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]