search for: 0c841ff67

Displaying 2 results from an estimated 2 matches for "0c841ff67".

2017 Apr 19
4
[PATCH v2 0/2] daemon: Move the useful 'is_zero' function into common code.
v1 -> v2: The first patch is the same (the pure refactoring), but in the second patch I implement Eric Blake's suggested version. Rich.
2017 Apr 19
2
[PATCH] daemon: Move the useful 'is_zero' function into common code.
...ize_t i; - - for (i = 0; i < size; ++i) { - if (buffer[i] != 0) - return 0; - } - - return 1; -} - /* Helper for functions that need a root filesystem mounted. * NB. Cannot be used for FileIn functions. */ diff --git a/lib/guestfs-internal-all.h b/lib/guestfs-internal-all.h index 0c841ff67..4f7433332 100644 --- a/lib/guestfs-internal-all.h +++ b/lib/guestfs-internal-all.h @@ -89,6 +89,24 @@ #define xdr_uint32_t xdr_u_int32_t #endif +/* Return true iff the buffer is all zero bytes. + * + * Note that gcc is smart enough to optimize this properly: + * http://stackoverflow.com/questi...