[Python-modules-commits] r22842 - in packages/pycurl/trunk/debian (3 files)

morph at users.alioth.debian.org morph at users.alioth.debian.org
Sun Oct 28 09:25:14 UTC 2012


    Date: Sunday, October 28, 2012 @ 09:25:13
  Author: morph
Revision: 22842

* debian/patches/20_remove_string_options.patch
  - No longer keep copies of string options since this is managed by libcurl,
    needed to have pycurl.c in sync with upstream CVS, and apply further
    patches

Added:
  packages/pycurl/trunk/debian/patches/20_remove_string_options.patch
Modified:
  packages/pycurl/trunk/debian/changelog
  packages/pycurl/trunk/debian/patches/series

Modified: packages/pycurl/trunk/debian/changelog
===================================================================
--- packages/pycurl/trunk/debian/changelog	2012-10-27 11:08:24 UTC (rev 22841)
+++ packages/pycurl/trunk/debian/changelog	2012-10-28 09:25:13 UTC (rev 22842)
@@ -1,3 +1,12 @@
+pycurl (7.19.0-6) UNRELEASED; urgency=low
+
+  * debian/patches/20_remove_string_options.patch
+    - No longer keep copies of string options since this is managed by libcurl,
+      needed to have pycurl.c in sync with upstream CVS, and apply further
+      patches
+
+ -- Sandro Tosi <morph at debian.org>  Sun, 28 Oct 2012 10:24:46 +0100
+
 pycurl (7.19.0-5) unstable; urgency=low
 
   * debian/rules

Added: packages/pycurl/trunk/debian/patches/20_remove_string_options.patch
===================================================================
--- packages/pycurl/trunk/debian/patches/20_remove_string_options.patch	                        (rev 0)
+++ packages/pycurl/trunk/debian/patches/20_remove_string_options.patch	2012-10-28 09:25:13 UTC (rev 22842)
@@ -0,0 +1,165 @@
+Description: No longer keep copies of string options since this is managed by libcurl
+Origin: http://pycurl.cvs.sourceforge.net/viewvc/pycurl/pycurl/src/pycurl.c?r1=1.147&r2=1.148
+
+--- pycurl-7.19.0.orig/src/pycurl.c	2008/09/09 17:40:34	1.147
++++ pycurl-7.19.0/src/pycurl.c	2008/09/29 10:56:57	1.148
+@@ -1,4 +1,4 @@
+-/* $Id: pycurl.c,v 1.147 2008/09/09 17:40:34 kjetilja Exp $ */
++/* $Id: pycurl.c,v 1.148 2008/09/29 10:56:57 kjetilja Exp $ */
+ 
+ /* PycURL -- cURL Python module
+  *
+@@ -97,12 +97,6 @@
+ /* Calculate the number of OBJECTPOINT options we need to store */
+ #define OPTIONS_SIZE    ((int)CURLOPT_LASTENTRY % 10000)
+ #define MOPTIONS_SIZE   ((int)CURLMOPT_LASTENTRY % 10000)
+-static int OPT_INDEX(int o)
+-{
+-    assert(o >= CURLOPTTYPE_OBJECTPOINT);
+-    assert(o < CURLOPTTYPE_OBJECTPOINT + OPTIONS_SIZE);
+-    return o - CURLOPTTYPE_OBJECTPOINT;
+-}
+ 
+ /* Type objects */
+ static PyObject *ErrorObject = NULL;
+@@ -161,7 +155,6 @@
+     PyObject *writedata_fp;
+     PyObject *writeheader_fp;
+     /* misc */
+-    void *options[OPTIONS_SIZE];    /* for OBJECTPOINT options */
+     char error[CURL_ERROR_SIZE+1];
+ } CurlObject;
+ 
+@@ -741,7 +734,6 @@
+     self->writeheader_fp = NULL;
+ 
+     /* Zero string pointer memory buffer used by setopt */
+-    memset(self->options, 0, sizeof(self->options));
+     memset(self->error, 0, sizeof(self->error));
+ 
+     return self;
+@@ -804,7 +796,6 @@
+         free(s);
+         goto error;
+     }
+-    self->options[ OPT_INDEX(CURLOPT_USERAGENT) ] = s; s = NULL;
+ 
+     /* Success - return new object */
+     return self;
+@@ -872,7 +863,6 @@
+ util_curl_close(CurlObject *self)
+ {
+     CURL *handle;
+-    int i;
+ 
+     /* Zero handle and thread-state to disallow any operations to be run
+      * from now on */
+@@ -916,16 +906,6 @@
+     SFREE(self->postquote);
+     SFREE(self->prequote);
+ #undef SFREE
+-
+-    /* Last, free the options.  This must be done after the curl handle
+-     * is closed since libcurl assumes that some options are valid when
+-     * invoking curl_easy_cleanup(). */
+-    for (i = 0; i < OPTIONS_SIZE; i++) {
+-        if (self->options[i] != NULL) {
+-            free(self->options[i]);
+-            self->options[i] = NULL;
+-        }
+-    }
+ }
+ 
+ 
+@@ -1424,8 +1404,6 @@
+ static PyObject*
+ do_curl_reset(CurlObject *self)
+ {
+-    unsigned int i;
+-
+     curl_easy_reset(self->handle);
+ 
+     /* Decref callbacks and file handles */
+@@ -1443,15 +1421,6 @@
+     SFREE(self->postquote);
+     SFREE(self->prequote);
+ #undef SFREE
+-
+-    /* Last, free the options */
+-    for (i = 0; i < OPTIONS_SIZE; i++) {
+-        if (self->options[i] != NULL) {
+-            free(self->options[i]);
+-            self->options[i] = NULL;
+-        }
+-    }
+-
+     return Py_None;
+ }
+ 
+@@ -1461,7 +1430,6 @@
+ util_curl_unsetopt(CurlObject *self, int option)
+ {
+     int res;
+-    int opt_index = -1;
+ 
+ #define SETOPT2(o,x) \
+     if ((res = curl_easy_setopt(self->handle, (o), (x))) != CURLE_OK) goto error
+@@ -1502,7 +1470,6 @@
+     case CURLOPT_SSL_CIPHER_LIST:
+     case CURLOPT_USERPWD:
+         SETOPT((char *) 0);
+-        opt_index = OPT_INDEX(option);
+         break;
+ 
+     /* info: we explicitly list unsupported options here */
+@@ -1512,11 +1479,6 @@
+         return NULL;
+     }
+ 
+-    if (opt_index >= 0 && self->options[opt_index] != NULL) {
+-        free(self->options[opt_index]);
+-        self->options[opt_index] = NULL;
+-    }
+-
+     Py_INCREF(Py_None);
+     return Py_None;
+ 
+@@ -1587,8 +1549,6 @@
+     if (PyString_Check(obj)) {
+         char *str = NULL;
+         Py_ssize_t len = -1;
+-        char *buf;
+-        int opt_index;
+ 
+         /* Check that the option specified a string as well as the input */
+         switch (option) {
+@@ -1651,28 +1611,12 @@
+         }
+         /* Allocate memory to hold the string */
+         assert(str != NULL);
+-        if (len <= 0)
+-            buf = strdup(str);
+-        else {
+-            buf = (char *) malloc(len);
+-            if (buf) memcpy(buf, str, len);
+-        }
+-        if (buf == NULL)
+-            return PyErr_NoMemory();
+         /* Call setopt */
+-        res = curl_easy_setopt(self->handle, (CURLoption)option, buf);
++        res = curl_easy_setopt(self->handle, (CURLoption)option, str);
+         /* Check for errors */
+         if (res != CURLE_OK) {
+-            free(buf);
+             CURLERROR_RETVAL();
+         }
+-        /* Save allocated option buffer */
+-        opt_index = OPT_INDEX(option);
+-        if (self->options[opt_index] != NULL) {
+-            free(self->options[opt_index]);
+-            self->options[opt_index] = NULL;
+-        }
+-        self->options[opt_index] = buf;
+         Py_INCREF(Py_None);
+         return Py_None;
+     }

Modified: packages/pycurl/trunk/debian/patches/series
===================================================================
--- packages/pycurl/trunk/debian/patches/series	2012-10-27 11:08:24 UTC (rev 22841)
+++ packages/pycurl/trunk/debian/patches/series	2012-10-28 09:25:13 UTC (rev 22842)
@@ -1 +1,2 @@
 10_setup.py.patch
+20_remove_string_options.patch




More information about the Python-modules-commits mailing list