[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] libxl: Introduce FILLZERO
commit a074278122b338fb08fa20ab30825e1366b2da68 Author: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> AuthorDate: Tue Feb 10 19:00:06 2015 +0000 Commit: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> CommitDate: Fri Jun 26 16:53:51 2015 +0100 libxl: Introduce FILLZERO FILLZERO is a macro for memset(&foo,0,sizeof(foo)). It eliminates the possiblity to make the error memset(&foo,0,sizeof(&foo)). No callers yet, but document it in CODING_STYLE. (In accordance with existing libxl policy, I haven't gone through all existing possible call sites.) Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx> --- v2: New in this version of the series. --- tools/libxl/CODING_STYLE | 1 + tools/libxl/libxl_internal.h | 3 +++ tools/libxl/libxl_utils.h | 3 +++ 3 files changed, 7 insertions(+), 0 deletions(-) diff --git a/tools/libxl/CODING_STYLE b/tools/libxl/CODING_STYLE index f5b5890..a65efb3 100644 --- a/tools/libxl/CODING_STYLE +++ b/tools/libxl/CODING_STYLE @@ -62,6 +62,7 @@ whenever they are applicable. For example: libxl__ctx_[un]lock CTX_LOCK, CTX_UNLOCK gc=...; ao=...; EGC_GC, AO_GC, STATE_AO_GC explicit gc creation GC_INIT, GC_FREE + memset(..,0,sizeof..) FILLZERO ERROR HANDLING diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 6364d22..2db6b2e 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -3291,6 +3291,9 @@ _hidden const char *libxl__device_model_savefile(libxl__gc *gc, uint32_t domid); }) +#define FILLZERO LIBXL_FILLZERO + + /* * All of these assume (or define) * libxl__gc *gc; diff --git a/tools/libxl/libxl_utils.h b/tools/libxl/libxl_utils.h index 1c1761d..9b90a44 100644 --- a/tools/libxl/libxl_utils.h +++ b/tools/libxl/libxl_utils.h @@ -160,6 +160,9 @@ int libxl_cpumap_to_nodemap(libxl_ctx *ctx, void libxl_string_copy(libxl_ctx *ctx, char **dst, char **src); + +#define LIBXL_FILLZERO(object) (memset(&(object), 0, sizeof((object)))) + #endif /* -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |