diff --git a/psycopg/psycopg.h b/psycopg/psycopg.h index 7834cf67..adda12d9 100644 --- a/psycopg/psycopg.h +++ b/psycopg/psycopg.h @@ -125,8 +125,6 @@ RAISES HIDDEN PyObject *psyco_set_error(PyObject *exc, cursorObject *curs, const HIDDEN char *psycopg_escape_string(connectionObject *conn, const char *from, Py_ssize_t len, char *to, Py_ssize_t *tolen); HIDDEN char *psycopg_escape_identifier_easy(const char *from, Py_ssize_t len); -HIDDEN char *psycopg_escape_conninfo(const char *from, Py_ssize_t len); - HIDDEN int psycopg_strdup(char **to, const char *from, Py_ssize_t len); HIDDEN int psycopg_is_text_file(PyObject *f); diff --git a/psycopg/psycopgmodule.c b/psycopg/psycopgmodule.c index 5e8eb5b7..c08cd70e 100644 --- a/psycopg/psycopgmodule.c +++ b/psycopg/psycopgmodule.c @@ -73,7 +73,6 @@ HIDDEN PyObject *psyco_null = NULL; /* The type of the cursor.description items */ HIDDEN PyObject *psyco_DescriptionType = NULL; - /** connect module-level function **/ #define psyco_connect_doc \ "_connect(dsn, [connection_factory], [async]) -- New database connection.\n\n" @@ -87,6 +86,7 @@ psyco_connect(PyObject *self, PyObject *args, PyObject *keywds) int async = 0; static char *kwlist[] = {"dsn", "connection_factory", "async", NULL}; + if (!PyArg_ParseTupleAndKeywords(args, keywds, "s|Oi", kwlist, &dsn, &factory, &async)) { return NULL; diff --git a/psycopg/utils.c b/psycopg/utils.c index e9dc3ba6..ec8e47c8 100644 --- a/psycopg/utils.c +++ b/psycopg/utils.c @@ -124,50 +124,6 @@ psycopg_escape_identifier_easy(const char *from, Py_ssize_t len) return rv; } -char * -psycopg_escape_conninfo(const char *from, Py_ssize_t len) -{ - char *rv = NULL; - const char *src; - const char *end; - char *dst; - int space = 0; - - if (!len) { len = strlen(from); } - end = from + len; - - if (!(rv = PyMem_Malloc(3 + 2 * len))) { - PyErr_NoMemory(); - return NULL; - } - - /* check for any whitespace or empty string */ - if (from < end && *from) { - for (src = from; src < end && *src; ++src) { - if (isspace(*src)) { - space = 1; - break; - } - } - } else { - /* empty string: we should produce '' */ - space = 1; - } - - dst = rv; - if (space) { *(dst++) = '\''; } - /* scan and copy */ - for (src = from; src < end && *src; ++src, ++dst) { - if (*src == '\'' || *src == '\\') - *(dst++) = '\\'; - *dst = *src; - } - if (space) { *(dst++) = '\''; } - *dst = '\0'; - - return rv; -} - /* Duplicate a string. * * Allocate a new buffer on the Python heap containing the new string.