]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
util: pick up review comments
authorVMware, Inc <>
Mon, 20 Dec 2010 22:18:35 +0000 (14:18 -0800)
committerMarcelo Vanzin <mvanzin@vmware.com>
Mon, 20 Dec 2010 22:18:35 +0000 (14:18 -0800)
More review comments to pick up.

Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/lib/include/util.h

index 555b698ba6c3c28a0c894a6a53789a2577fe9392..519fb40b2c115ee87bea4f5c2e62ece5e70d9ae4 100644 (file)
@@ -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;
 }
 
+
 /*
  *----------------------------------------------------------------------
  *