[v4 3/3] dinput: Alter function name and code style
David Lawrie
david.dljunk at gmail.com
Mon Jul 11 06:06:02 CDT 2016
Makes the dinput Mac joystick code more similar to winmm Mac joystick
code and improves code stylistically
Tested on OS X 10.10.5.
Signed-off-by: David Lawrie <david.dljunk at gmail.com>
---
dlls/dinput/joystick_osx.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/dlls/dinput/joystick_osx.c b/dlls/dinput/joystick_osx.c
index e937647..637692b 100644
--- a/dlls/dinput/joystick_osx.c
+++ b/dlls/dinput/joystick_osx.c
@@ -198,10 +198,9 @@ static long get_device_location_ID(IOHIDDeviceRef device)
return get_device_property_long(device, CFSTR(kIOHIDLocationIDKey));
}
-
-static void CFSetApplierFunctionCopyToCFArray(const void *value, void *context)
+static void copy_set_to_array(const void *value, void *context)
{
- CFArrayAppendValue( ( CFMutableArrayRef ) context, value );
+ CFArrayAppendValue(context, value);
}
static CFComparisonResult device_location_comparator(const void *val1, const void *val2, void *context)
@@ -486,10 +485,12 @@ static int find_osx_devices(void)
if (devset)
{
CFIndex num_devices, num_main_elements, idx;
- CFMutableArrayRef devices = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
- CFSetApplyFunction(devset, CFSetApplierFunctionCopyToCFArray, devices);
- CFRelease( devset);
- num_devices = CFArrayGetCount(devices);
+ CFMutableArrayRef devices;
+
+ num_devices = CFSetGetCount(devset);
+ devices = CFArrayCreateMutable(kCFAllocatorDefault, num_devices, &kCFTypeArrayCallBacks);
+ CFSetApplyFunction(devset, copy_set_to_array, devices);
+ CFRelease(devset);
CFArraySortValues(devices, CFRangeMake(0, num_devices), device_location_comparator, NULL);
device_main_elements = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
--
1.7.12.4 (Apple Git-37)
More information about the wine-patches
mailing list