[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 19/20] 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> --- tools/libxl/libxl.c | 2 -- tools/libxl/libxl_event.c | 8 +------- tools/libxl/libxl_internal.h | 4 ++-- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 54f3813..b7f665a 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -779,7 +779,6 @@ static void domain_death_occurred(libxl__egc *egc, *evg_upd = evg_next; libxl_event *ev = NEW_EVENT(egc, DOMAIN_DEATH, evg->domid); - if (!ev) return; libxl__event_occurred(egc, ev); @@ -866,7 +865,6 @@ static void domain_death_xswatch_callback(libxl__egc *egc, libxl__ev_xswatch *w, 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 --git a/tools/libxl/libxl_event.c b/tools/libxl/libxl_event.c index f355e3d..7600aa4 100644 --- a/tools/libxl/libxl_event.c +++ b/tools/libxl/libxl_event.c @@ -980,13 +980,7 @@ libxl_event *libxl__event_new(libxl__egc *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 --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 4e97f5e..977db2a 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -641,10 +641,10 @@ _hidden libxl_event *libxl__event_new(libxl__egc*, libxl_event_type, 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. */ /* -- 1.7.2.5 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |