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

[Xen-changelog] [xen-unstable] libxl: remove malloc failure handling from NEW_EVENT


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Mon, 14 May 2012 16:32:43 +0000
  • Delivery-date: Mon, 14 May 2012 16:33:09 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
# Date 1336759145 -3600
# Node ID 30c22846e770c48c32d3a74ae36f7877a257a9eb
# Parent  687512370976584f44ce21a95e6b7e74fdf3b855
libxl: remove malloc failure handling from NEW_EVENT

Change to use libxl__zalloc, where allocation failure is fatal.

Also remove a spurious semicolon from the helper macro.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Committed-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---


diff -r 687512370976 -r 30c22846e770 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Fri May 11 18:59:05 2012 +0100
+++ b/tools/libxl/libxl.c       Fri May 11 18:59:05 2012 +0100
@@ -789,7 +789,6 @@ static void domain_death_occurred(libxl_
     *evg_upd = evg_next;
 
     libxl_event *ev = NEW_EVENT(egc, DOMAIN_DEATH, evg->domid);
-    if (!ev) return;
 
     libxl__event_occurred(egc, ev);
 
@@ -876,7 +875,6 @@ static void domain_death_xswatch_callbac
             if (!evg->shutdown_reported &&
                 (got->flags & XEN_DOMINF_shutdown)) {
                 libxl_event *ev = NEW_EVENT(egc, DOMAIN_SHUTDOWN, got->domain);
-                if (!ev) goto out;
                 
                 LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, " shutdown reporting");
 
diff -r 687512370976 -r 30c22846e770 tools/libxl/libxl_event.c
--- a/tools/libxl/libxl_event.c Fri May 11 18:59:05 2012 +0100
+++ b/tools/libxl/libxl_event.c Fri May 11 18:59:05 2012 +0100
@@ -989,13 +989,7 @@ libxl_event *libxl__event_new(libxl__egc
 {
     libxl_event *ev;
 
-    ev = malloc(sizeof(*ev));
-    if (!ev) {
-        LIBXL__EVENT_DISASTER(egc, "allocate new event", errno, type);
-        return NULL;
-    }
-
-    memset(ev, 0, sizeof(*ev));
+    ev = libxl__zalloc(0,sizeof(*ev));
     ev->type = type;
     ev->domid = domid;
 
diff -r 687512370976 -r 30c22846e770 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Fri May 11 18:59:05 2012 +0100
+++ b/tools/libxl/libxl_internal.h      Fri May 11 18:59:05 2012 +0100
@@ -654,10 +654,10 @@ _hidden libxl_event *libxl__event_new(li
                                       uint32_t domid);
   /* Convenience function.
    * Allocates a new libxl_event, fills in domid and type.
-   * If allocation fails, calls _disaster, and returns NULL. */
+   * Cannot fail. */
 
 #define NEW_EVENT(egc, type, domid)                              \
-    libxl__event_new((egc), LIBXL_EVENT_TYPE_##type, (domid));
+    libxl__event_new((egc), LIBXL_EVENT_TYPE_##type, (domid))
     /* Convenience macro. */
 
 /*

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.