From: VMware, Inc <> Date: Tue, 13 Mar 2012 19:59:59 +0000 (-0700) Subject: lib/misc: pick up review comments X-Git-Tag: 2012.03.13-651368~75 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1b54e685027c4e0efc95bd391f19495aed6df0fc;p=thirdparty%2Fopen-vm-tools.git lib/misc: pick up review comments Regis had a few, nice suggestions. Signed-off-by: Dmitry Torokhov --- diff --git a/open-vm-tools/lib/misc/hostinfoPosix.c b/open-vm-tools/lib/misc/hostinfoPosix.c index 10a5ea57a..ef917d9bd 100644 --- a/open-vm-tools/lib/misc/hostinfoPosix.c +++ b/open-vm-tools/lib/misc/hostinfoPosix.c @@ -1611,9 +1611,8 @@ HostinfoSystemTimerMach(VmTimeType *result) // OUT # define vmx86_apple 1 typedef struct { - mach_timebase_info_data_t timeBase; - double scalingFactor; - Bool unity; + double scalingFactor; + Bool unity; } timerData; VmTimeType raw; @@ -1629,17 +1628,18 @@ HostinfoSystemTimerMach(VmTimeType *result) // OUT ptr = Atomic_ReadPtr(&atomic); if (UNLIKELY(ptr == NULL)) { - timerData *new = Util_SafeMalloc(sizeof *new); + mach_timebase_info_data_t timeBase; + timerData *try = Util_SafeMalloc(sizeof *try); - mach_timebase_info(&new->timeBase); + mach_timebase_info(&timeBase); - new->scalingFactor = ((double) new->timeBase.numer) / - ((double) new->timeBase.denom); + try->scalingFactor = ((double) timeBase.numer) / + ((double) timeBase.denom); - new->unity = ((new->timeBase.numer == 1) && (new->timeBase.denom == 1)); + try->unity = ((timeBase.numer == 1) && (timeBase.denom == 1)); - if (Atomic_ReadIfEqualWritePtr(&atomic, NULL, new)) { - free(new); + if (Atomic_ReadIfEqualWritePtr(&atomic, NULL, try)) { + free(try); } ptr = Atomic_ReadPtr(&atomic);