Skip to content

Commit 0163cd9

Browse files
committed
Update libplist requirement to 2.6.0 and use PLIST_DICT helper for cleaner code
1 parent e9a0dce commit 0163cd9

File tree

2 files changed

+6
-26
lines changed

2 files changed

+6
-26
lines changed

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ LT_INIT
2121

2222
# Checks for libraries.
2323
PKG_CHECK_MODULES(libusb, libusb-1.0 >= 1.0.9)
24-
PKG_CHECK_MODULES(libplist, libplist-2.0 >= 2.3.0)
24+
PKG_CHECK_MODULES(libplist, libplist-2.0 >= 2.6.0)
2525
PKG_CHECK_MODULES(libimobiledevice, libimobiledevice-1.0 >= 1.3.0, have_limd=yes, have_limd=no)
2626
PKG_CHECK_MODULES(limd_glue, libimobiledevice-glue-1.0 >= 1.0.0)
2727

src/client.c

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -452,10 +452,7 @@ static int send_listener_list(struct mux_client *client, uint32_t tag)
452452
plist_dict_set_item(l, "Blacklisted", plist_new_bool(0));
453453
n = NULL;
454454
if (lc->info) {
455-
n = plist_dict_get_item(lc->info, "BundleID");
456-
}
457-
if (n) {
458-
plist_dict_set_item(l, "BundleID", plist_copy(n));
455+
plist_dict_copy_item(item, lc->info, "BundleID", NULL);
459456
}
460457
plist_dict_set_item(l, "ConnType", plist_new_uint(0));
461458

@@ -632,28 +629,11 @@ static char* plist_dict_get_string_val(plist_t dict, const char* key)
632629

633630
static void update_client_info(struct mux_client *client, plist_t dict)
634631
{
635-
plist_t node = NULL;
636632
plist_t info = plist_new_dict();
637-
638-
node = plist_dict_get_item(dict, "BundleID");
639-
if (node && (plist_get_node_type(node) == PLIST_STRING)) {
640-
plist_dict_set_item(info, "BundleID", plist_copy(node));
641-
}
642-
643-
node = plist_dict_get_item(dict, "ClientVersionString");
644-
if (node && (plist_get_node_type(node) == PLIST_STRING)) {
645-
plist_dict_set_item(info, "ClientVersionString", plist_copy(node));
646-
}
647-
648-
node = plist_dict_get_item(dict, "ProgName");
649-
if (node && (plist_get_node_type(node) == PLIST_STRING)) {
650-
plist_dict_set_item(info, "ProgName", plist_copy(node));
651-
}
652-
653-
node = plist_dict_get_item(dict, "kLibUSBMuxVersion");
654-
if (node && (plist_get_node_type(node) == PLIST_UINT)) {
655-
plist_dict_set_item(info, "kLibUSBMuxVersion", plist_copy(node));
656-
}
633+
plist_dict_copy_item(info, dict, "BundleID", NULL);
634+
plist_dict_copy_item(info, dict, "ClientVersionString", NULL);
635+
plist_dict_copy_item(info, dict, "ProgName", NULL);
636+
plist_dict_copy_item(info, dict, "kLibUSBMuxVersion", NULL);
657637
plist_free(client->info);
658638
client->info = info;
659639
}

0 commit comments

Comments
 (0)