+static void http_request_datashare_destroy_handles(void *el)
+{
+ zval **r = (zval **) el;
+ TSRMLS_FETCH();
+
+ { /* gcc 2.95 needs these braces */
+ getObjectEx(http_request_object, obj, *r);
+
+ curl_easy_setopt(obj->request->ch, CURLOPT_SHARE, NULL);
+ zval_ptr_dtor(r);
+ }
+}
+
+#ifdef ZTS
+static void *http_request_datashare_locks_init(void)
+{
+ int i;
+ http_request_datashare_lock *locks = pecalloc(CURL_LOCK_DATA_LAST, sizeof(http_request_datashare_lock), 1);
+
+ if (locks) {
+ for (i = 0; i < CURL_LOCK_DATA_LAST; ++i) {
+ locks[i].mx = tsrm_mutex_alloc();
+ }
+ }
+
+ return locks;
+}
+
+static void http_request_datashare_locks_dtor(void *l)
+{
+ int i;
+ http_request_datashare_lock *locks = (http_request_datashare_lock *) l;
+
+ for (i = 0; i < CURL_LOCK_DATA_LAST; ++i) {
+ tsrm_mutex_free(locks[i].mx);
+ }
+ pefree(locks, 1);
+}
+