[PATCH 11/11] kvm tools: remove duplicated code
From: Lai Jiangshan
Date: Mon Dec 12 2011 - 02:15:41 EST
Simple cleanup.
Signed-off-by: Lai Jiangshan <laijs@xxxxxxxxxxxxxx>
---
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/