summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2015-01-27 21:56:48 +0100
committerGravatar Martin Szulecki2015-01-27 22:01:23 +0100
commita6fcb3fd337bf63aba9237f54e4ecb8c737e984c (patch)
treec69914b4b1c2fb0056ea190b30b51c5d2b66d743
parent294dea4eaa847527c5940e402a0c5cff35026e9e (diff)
downloadlibimobiledevice-a6fcb3fd337bf63aba9237f54e4ecb8c737e984c.tar.gz
libimobiledevice-a6fcb3fd337bf63aba9237f54e4ecb8c737e984c.tar.bz2
idevicedebug: Use more efficient instproxy_lookup instead of browsing all apps
-rw-r--r--tools/idevicedebug.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/tools/idevicedebug.c b/tools/idevicedebug.c
index c9648d0..996fa46 100644
--- a/tools/idevicedebug.c
+++ b/tools/idevicedebug.c
@@ -2,7 +2,7 @@
* idevicedebug.c
* Interact with the debugserver service of a device.
*
- * Copyright (c) 2014 Martin Szulecki All Rights Reserved.
+ * Copyright (c) 2014-2015 Martin Szulecki All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -65,31 +65,19 @@ static instproxy_error_t instproxy_client_get_object_by_key_from_info_directiona
// only return attributes we need
instproxy_client_options_set_return_attributes(client_opts, "CFBundleIdentifier", "CFBundleExecutable", key, NULL);
+ // only query for specific appid
+ const char* appids[] = {appid, NULL};
+
// query device for list of apps
- instproxy_error_t ierr = instproxy_browse(client, client_opts, &apps);
+ instproxy_error_t ierr = instproxy_lookup(client, appids, client_opts, &apps);
+
instproxy_client_options_free(client_opts);
+
if (ierr != INSTPROXY_E_SUCCESS) {
return ierr;
}
- plist_t app_found = NULL;
- uint32_t i;
- for (i = 0; i < plist_array_get_size(apps); i++) {
- char *appid_str = NULL;
- plist_t app_info = plist_array_get_item(apps, i);
- plist_t idp = plist_dict_get_item(app_info, "CFBundleIdentifier");
- if (idp) {
- plist_get_string_val(idp, &appid_str);
- }
- if (appid_str && strcmp(appid, appid_str) == 0) {
- app_found = app_info;
- }
- free(appid_str);
- if (app_found) {
- break;
- }
- }
-
+ plist_t app_found = plist_access_path(apps, 1, appid);
if (!app_found) {
if (apps)
plist_free(apps);