asprintf() removal.

This commit is contained in:
Federico Di Gregorio 2005-03-01 07:06:11 +00:00
parent 0d4db2ec55
commit 3141770f53
2 changed files with 8 additions and 3 deletions

View File

@ -1,5 +1,9 @@
2005-03-01 Federico Di Gregorio <fog@debian.org>
* psycopg/cursor_type.c (psyco_curs_copy_from): we now use
PyOS_snprintf instead of asprintf. On some platforms this can be
bad (win32).. if that's your case, get a better platform. :/
* psycopg/microprotocols.c (microprotocols_adapt): fixed small
typo that made adaptation using __conform__ impossible.

View File

@ -930,7 +930,8 @@ _psyco_curs_has_write_check(PyObject* o, void* var)
static PyObject *
psyco_curs_copy_from(cursorObject *self, PyObject *args)
{
char *table_name, *query = NULL;
char query[256];
char *table_name;
char *sep = "\t", *null ="NULL";
long int bufsize = DEFAULT_COPYSIZE;
PyObject *file, *res = NULL;
@ -943,8 +944,8 @@ psyco_curs_copy_from(cursorObject *self, PyObject *args)
EXC_IF_CURS_CLOSED(self);
asprintf(&query, "COPY %s FROM stdin USING DELIMITERS '%s'"
" WITH NULL AS '%s'", table_name, sep, null);
PyOS_snprintf(query, 256, "COPY %s FROM stdin USING DELIMITERS '%s'"
" WITH NULL AS '%s'", table_name, sep, null);
Dprintf("psyco_curs_copy_from: query = %s", query);
self->copysize = bufsize;