diff options
| author | 2010-04-13 17:12:50 -0500 | |
|---|---|---|
| committer | 2012-03-20 23:25:55 +0100 | |
| commit | 7275b8e8b1134c85d6f4b694ad6f515b3a6dace9 (patch) | |
| tree | 3ab34f9097528839c2c78b70b659ba7d90cf736c /cython | |
| parent | 360b7316b520baeae11c98cbd6423029141c2137 (diff) | |
| download | libimobiledevice-7275b8e8b1134c85d6f4b694ad6f515b3a6dace9.tar.gz libimobiledevice-7275b8e8b1134c85d6f4b694ad6f515b3a6dace9.tar.bz2 | |
Use stdlib.free and plist.plist_free.
Diffstat (limited to 'cython')
| -rw-r--r-- | cython/afc.pxi | 14 | ||||
| -rw-r--r-- | cython/file_relay.pxi | 2 | ||||
| -rw-r--r-- | cython/imobiledevice.pyx | 6 | ||||
| -rw-r--r-- | cython/lockdown.pxi | 8 | ||||
| -rw-r--r-- | cython/property_list_client.pxi | 2 | ||||
| -rw-r--r-- | cython/sbservices.pxi | 9 |
6 files changed, 19 insertions, 22 deletions
diff --git a/cython/afc.pxi b/cython/afc.pxi index 398ea39..9200067 100644 --- a/cython/afc.pxi +++ b/cython/afc.pxi | |||
| @@ -142,7 +142,7 @@ cdef class AfcFile(Base): | |||
| 142 | except BaseError, e: | 142 | except BaseError, e: |
| 143 | raise | 143 | raise |
| 144 | finally: | 144 | finally: |
| 145 | free(c_data) | 145 | stdlib.free(c_data) |
| 146 | 146 | ||
| 147 | return bytes_written | 147 | return bytes_written |
| 148 | 148 | ||
| @@ -186,9 +186,9 @@ cdef class AfcClient(BaseService): | |||
| 186 | while infos[i]: | 186 | while infos[i]: |
| 187 | info = infos[i] | 187 | info = infos[i] |
| 188 | result.append(info) | 188 | result.append(info) |
| 189 | free(infos[i]) | 189 | stdlib.free(infos[i]) |
| 190 | i = i + 1 | 190 | i = i + 1 |
| 191 | free(infos) | 191 | stdlib.free(infos) |
| 192 | 192 | ||
| 193 | return result | 193 | return result |
| 194 | 194 | ||
| @@ -209,9 +209,9 @@ cdef class AfcClient(BaseService): | |||
| 209 | while dir_list[i]: | 209 | while dir_list[i]: |
| 210 | f = dir_list[i] | 210 | f = dir_list[i] |
| 211 | result.append(f) | 211 | result.append(f) |
| 212 | free(dir_list[i]) | 212 | stdlib.free(dir_list[i]) |
| 213 | i = i + 1 | 213 | i = i + 1 |
| 214 | free(dir_list) | 214 | stdlib.free(dir_list) |
| 215 | 215 | ||
| 216 | return result | 216 | return result |
| 217 | 217 | ||
| @@ -258,9 +258,9 @@ cdef class AfcClient(BaseService): | |||
| 258 | while c_result[i]: | 258 | while c_result[i]: |
| 259 | info = c_result[i] | 259 | info = c_result[i] |
| 260 | result.append(info) | 260 | result.append(info) |
| 261 | free(c_result[i]) | 261 | stdlib.free(c_result[i]) |
| 262 | i = i + 1 | 262 | i = i + 1 |
| 263 | free(c_result) | 263 | stdlib.free(c_result) |
| 264 | 264 | ||
| 265 | return result | 265 | return result |
| 266 | 266 | ||
diff --git a/cython/file_relay.pxi b/cython/file_relay.pxi index db9932a..fd7b67e 100644 --- a/cython/file_relay.pxi +++ b/cython/file_relay.pxi | |||
| @@ -62,7 +62,7 @@ cdef class FileRelayClient(PropertyListService): | |||
| 62 | c_sources[count] = NULL | 62 | c_sources[count] = NULL |
| 63 | 63 | ||
| 64 | err = file_relay_request_sources(self._c_client, <const_sources_t>c_sources, &conn._c_connection) | 64 | err = file_relay_request_sources(self._c_client, <const_sources_t>c_sources, &conn._c_connection) |
| 65 | free(c_sources) | 65 | stdlib.free(c_sources) |
| 66 | self.handle_error(err) | 66 | self.handle_error(err) |
| 67 | return conn | 67 | return conn |
| 68 | 68 | ||
diff --git a/cython/imobiledevice.pyx b/cython/imobiledevice.pyx index 77a7a3a..bde43d0 100644 --- a/cython/imobiledevice.pyx +++ b/cython/imobiledevice.pyx | |||
| @@ -172,8 +172,8 @@ cdef class iDevice(Base): | |||
| 172 | 172 | ||
| 173 | cdef extern from *: | 173 | cdef extern from *: |
| 174 | ctypedef char* const_char_ptr "const char*" | 174 | ctypedef char* const_char_ptr "const char*" |
| 175 | void free(void *ptr) | 175 | |
| 176 | void plist_free(plist.plist_t node) | 176 | cimport stdlib |
| 177 | 177 | ||
| 178 | cdef class BaseService(Base): | 178 | cdef class BaseService(Base): |
| 179 | __service_name__ = None | 179 | __service_name__ = None |
| @@ -191,7 +191,7 @@ cdef class PropertyListService(BaseService): | |||
| 191 | self.handle_error(err) | 191 | self.handle_error(err) |
| 192 | except BaseError, e: | 192 | except BaseError, e: |
| 193 | if c_node != NULL: | 193 | if c_node != NULL: |
| 194 | plist_free(c_node) | 194 | plist.plist_free(c_node) |
| 195 | raise | 195 | raise |
| 196 | 196 | ||
| 197 | return plist.plist_t_to_node(c_node) | 197 | return plist.plist_t_to_node(c_node) |
diff --git a/cython/lockdown.pxi b/cython/lockdown.pxi index 76f84b1..f8955e5 100644 --- a/cython/lockdown.pxi +++ b/cython/lockdown.pxi | |||
| @@ -122,7 +122,7 @@ cdef class LockdownClient(PropertyListService): | |||
| 122 | finally: | 122 | finally: |
| 123 | if c_type != NULL: | 123 | if c_type != NULL: |
| 124 | result = c_type | 124 | result = c_type |
| 125 | free(c_type) | 125 | stdlib.free(c_type) |
| 126 | 126 | ||
| 127 | return result | 127 | return result |
| 128 | 128 | ||
| @@ -141,7 +141,7 @@ cdef class LockdownClient(PropertyListService): | |||
| 141 | self.handle_error(err) | 141 | self.handle_error(err) |
| 142 | except BaseError, e: | 142 | except BaseError, e: |
| 143 | if c_node != NULL: | 143 | if c_node != NULL: |
| 144 | plist_free(c_node) | 144 | plist.plist_free(c_node) |
| 145 | raise | 145 | raise |
| 146 | 146 | ||
| 147 | return plist.plist_t_to_node(c_node) | 147 | return plist.plist_t_to_node(c_node) |
| @@ -154,7 +154,7 @@ cdef class LockdownClient(PropertyListService): | |||
| 154 | raise | 154 | raise |
| 155 | finally: | 155 | finally: |
| 156 | if c_node != NULL: | 156 | if c_node != NULL: |
| 157 | plist_free(c_node) | 157 | plist.plist_free(c_node) |
| 158 | 158 | ||
| 159 | cpdef remove_value(self, bytes domain, bytes key): | 159 | cpdef remove_value(self, bytes domain, bytes key): |
| 160 | self.handle_error(lockdownd_remove_value(self._c_client, domain, key)) | 160 | self.handle_error(lockdownd_remove_value(self._c_client, domain, key)) |
| @@ -207,7 +207,7 @@ cdef class LockdownClient(PropertyListService): | |||
| 207 | finally: | 207 | finally: |
| 208 | if c_session_id != NULL: | 208 | if c_session_id != NULL: |
| 209 | session_id = c_session_id | 209 | session_id = c_session_id |
| 210 | free(c_session_id) | 210 | stdlib.free(c_session_id) |
| 211 | 211 | ||
| 212 | return (session_id, ssl_enabled) | 212 | return (session_id, ssl_enabled) |
| 213 | 213 | ||
diff --git a/cython/property_list_client.pxi b/cython/property_list_client.pxi index c137b34..718b07f 100644 --- a/cython/property_list_client.pxi +++ b/cython/property_list_client.pxi | |||
| @@ -11,7 +11,7 @@ cdef class PropertyListClient(Base): | |||
| 11 | self.handle_error(err) | 11 | self.handle_error(err) |
| 12 | except BaseError, e: | 12 | except BaseError, e: |
| 13 | if c_node != NULL: | 13 | if c_node != NULL: |
| 14 | plist_free(c_node) | 14 | plist.plist_free(c_node) |
| 15 | raise | 15 | raise |
| 16 | 16 | ||
| 17 | return plist.plist_t_to_node(c_node) | 17 | return plist.plist_t_to_node(c_node) |
diff --git a/cython/sbservices.pxi b/cython/sbservices.pxi index 28aa5a5..13a49aa 100644 --- a/cython/sbservices.pxi +++ b/cython/sbservices.pxi | |||
| @@ -52,7 +52,7 @@ cdef class SpringboardServicesClient(Base): | |||
| 52 | self.handle_error(err) | 52 | self.handle_error(err) |
| 53 | except BaseError, e: | 53 | except BaseError, e: |
| 54 | if c_node != NULL: | 54 | if c_node != NULL: |
| 55 | plist_free(c_node) | 55 | plist.plist_free(c_node) |
| 56 | raise | 56 | raise |
| 57 | return plist.plist_t_to_node(c_node) | 57 | return plist.plist_t_to_node(c_node) |
| 58 | def __set__(self, plist.Node newstate not None): | 58 | def __set__(self, plist.Node newstate not None): |
| @@ -60,7 +60,6 @@ cdef class SpringboardServicesClient(Base): | |||
| 60 | 60 | ||
| 61 | cpdef bytes get_pngdata(self, bytes bundleId): | 61 | cpdef bytes get_pngdata(self, bytes bundleId): |
| 62 | cdef: | 62 | cdef: |
| 63 | bytes result | ||
| 64 | char* pngdata = NULL | 63 | char* pngdata = NULL |
| 65 | uint64_t pngsize | 64 | uint64_t pngsize |
| 66 | sbservices_error_t err | 65 | sbservices_error_t err |
| @@ -68,8 +67,6 @@ cdef class SpringboardServicesClient(Base): | |||
| 68 | try: | 67 | try: |
| 69 | self.handle_error(err) | 68 | self.handle_error(err) |
| 70 | except BaseError, e: | 69 | except BaseError, e: |
| 70 | stdlib.free(pngdata) | ||
| 71 | raise | 71 | raise |
| 72 | finally: | 72 | return pngdata[:pngsize] |
| 73 | result = pngdata[:pngsize] | ||
| 74 | free(pngdata) | ||
| 75 | return result | ||
