[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 12 Dec 2011 15:15:55 +0800
From: Lai Jiangshan <laijs@...fujitsu.com>
To: Pekka Enberg <penberg@...nel.org>, Ingo Molnar <mingo@...e.hu>
Cc: linux-kernel@...r.kernel.org, Lai Jiangshan <laijs@...fujitsu.com>
Subject: [PATCH 11/11] kvm tools: remove duplicated code
Simple cleanup.
Signed-off-by: Lai Jiangshan <laijs@...fujitsu.com>
---
tools/kvm/guest_compat.c | 21 +++++++++------------
1 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/tools/kvm/guest_compat.c b/tools/kvm/guest_compat.c
index 8dd451b..43b9035 100644
--- a/tools/kvm/guest_compat.c
+++ b/tools/kvm/guest_compat.c
@@ -17,6 +17,13 @@ static int id;
static DEFINE_MUTEX(compat_mtx);
static LIST_HEAD(messages);
+static void compat__free(struct compat_message *msg)
+{
+ free(msg->title);
+ free(msg->desc);
+ free(msg);
+}
+
int compat__add_message(const char *title, const char *desc)
{
struct compat_message *msg;
@@ -42,22 +49,12 @@ int compat__add_message(const char *title, const char *desc)
return msg_id;
cleanup:
- if (msg) {
- free(msg->title);
- free(msg->desc);
- free(msg);
- }
+ if (msg)
+ compat__free(msg);
return -ENOMEM;
}
-static void compat__free(struct compat_message *msg)
-{
- free(msg->title);
- free(msg->desc);
- free(msg);
-}
-
int compat__remove_message(int id)
{
struct compat_message *pos, *n;
--
1.7.4.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists