Skip to content

Commit

Permalink
Remove odd memory copy function (#380)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabebear authored and shazron committed May 7, 2019
1 parent a15979f commit cd21ad3
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions src/ios-deploy/ios-deploy.m
Original file line number Diff line number Diff line change
Expand Up @@ -314,23 +314,6 @@ device_desc get_device_desc(CFStringRef model) {
return res;
}

char * MYCFStringCopyUTF8String(CFStringRef aString) {
if (aString == NULL) {
return NULL;
}

CFIndex length = CFStringGetLength(aString);
CFIndex maxSize =
CFStringGetMaximumSizeForEncoding(length,
kCFStringEncodingUTF8);
char *buffer = (char *)malloc(maxSize);
if (CFStringGetCString(aString, buffer, maxSize,
kCFStringEncodingUTF8)) {
return buffer;
}
return NULL;
}

CFStringRef get_device_full_name(const AMDeviceRef device) {
CFStringRef full_name = NULL,
device_udid = AMDeviceCopyDeviceIdentifier(device),
Expand Down Expand Up @@ -1540,7 +1523,8 @@ void handle_device(AMDeviceRef device) {
return;
}
} else {
device_id = MYCFStringCopyUTF8String(found_device_id);
// Use the first device we find if a device_id wasn't specified.
device_id = strdup(CFStringGetCStringPtr(found_device_id, kCFStringEncodingUTF8));
found_device = true;
}

Expand Down

0 comments on commit cd21ad3

Please sign in to comment.