summaryrefslogtreecommitdiffstats
path: root/cython
diff options
context:
space:
mode:
authorGravatar aymenim2016-03-21 11:27:26 +0300
committerGravatar Nikias Bassen2024-04-01 02:55:18 +0200
commit9eee3d14d19aaee60c3510c558a22ccb3dc2ce10 (patch)
tree99354358ded5155890ba6c9bb002535705e5e38a /cython
parentfb1dec7e2cbb2eae14536d8d68db25d3f9384ac1 (diff)
downloadlibimobiledevice-9eee3d14d19aaee60c3510c558a22ccb3dc2ce10.tar.gz
libimobiledevice-9eee3d14d19aaee60c3510c558a22ccb3dc2ce10.tar.bz2
cython: Allow passing null to lockdown set value
* added code to handle passing null values to lockdown_set_value, needed for example setting device name .
Diffstat (limited to 'cython')
-rw-r--r--cython/lockdown.pxi15
1 files changed, 12 insertions, 3 deletions
diff --git a/cython/lockdown.pxi b/cython/lockdown.pxi
index 6b88f9d..25edb4c 100644
--- a/cython/lockdown.pxi
+++ b/cython/lockdown.pxi
@@ -210,14 +210,23 @@ cdef class LockdownClient(PropertyListService):
raise
cpdef set_value(self, bytes domain, bytes key, object value):
- cdef plist.plist_t c_node = plist.native_to_plist_t(value)
+ cdef:
+ plist.plist_t c_node = NULL
+ char* c_domain = NULL
+ char* c_key = NULL
+
+ c_node = plist.native_to_plist_t(value)
+ if domain is not None:
+ c_domain = domain
+ if key is not None:
+ c_key = key
try:
- self.handle_error(lockdownd_set_value(self._c_client, domain, key, c_node))
+ self.handle_error(lockdownd_set_value(self._c_client, c_domain, c_key, c_node))
except BaseError, e:
raise
finally:
if c_node != NULL:
- plist.plist_free(c_node)
+ c_node = NULL
cpdef remove_value(self, bytes domain, bytes key):
self.handle_error(lockdownd_remove_value(self._c_client, domain, key))