From: VMware, Inc <> Date: Mon, 20 Dec 2010 22:18:35 +0000 (-0800) Subject: util: pick up review comments X-Git-Tag: 2010.12.19-339835~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=be01f2e8e038ea618f506b6d931cf93c20f13cd7;p=thirdparty%2Fopen-vm-tools.git util: pick up review comments More review comments to pick up. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/lib/include/util.h b/open-vm-tools/lib/include/util.h index 555b698ba..519fb40b2 100644 --- a/open-vm-tools/lib/include/util.h +++ b/open-vm-tools/lib/include/util.h @@ -188,10 +188,10 @@ Util_ValidateBytes(const void *ptr, // IN: ptr to check p = (uint8 *) ptr; - /* Compare bytes until a "nice" boundary is achieved */ - while ((((uintptr_t) p) & (sizeof(uint64) - 1)) != 0) { + /* Compare bytes until a "nice" boundary is achieved. */ + while ((uintptr_t) p % sizeof bigValue) { if (*p != byteValue) { - return (void *) p; + return p; } size--; @@ -203,23 +203,23 @@ Util_ValidateBytes(const void *ptr, // IN: ptr to check p++; } - /* Compare using a "nice sized" chunk for a long as possible */ - memset((void *) &bigValue, (int) byteValue, sizeof bigValue); + /* Compare using a "nice sized" chunk for a long as possible. */ + memset(&bigValue, (int) byteValue, sizeof bigValue); - while (size >= sizeof(uint64)) { + while (size >= sizeof bigValue) { if (*((uint64 *) p) != bigValue) { - /* That's not right... let the loop below report the exact address */ + /* That's not right... let the loop below report the exact address. */ break; } - size -= sizeof(uint64); - p += sizeof(uint64); + size -= sizeof bigValue; + p += sizeof bigValue; } - /* Handle any trailing bytes */ + /* Handle any trailing bytes. */ while (size) { if (*p != byteValue) { - return (void *) p; + return p; } size--; @@ -229,6 +229,7 @@ Util_ValidateBytes(const void *ptr, // IN: ptr to check return NULL; } + /* *---------------------------------------------------------------------- *