mirror of
https://github.com/postgres/postgres.git
synced 2025-11-24 00:23:06 +03:00
Use PQfreemem() consistently, and document its use for Notify.
Keep PQfreeNotify() around for binary compatibility.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.4 2003/03/20 15:56:50 meskes Exp $ */
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.5 2003/03/25 02:44:36 momjian Exp $ */
|
||||
|
||||
/*
|
||||
* The aim is to get a simpler inteface to the database routines.
|
||||
@@ -1197,7 +1197,7 @@ ECPGexecute(struct statement * stmt)
|
||||
{
|
||||
ECPGlog("ECPGexecute line %d: ASYNC NOTIFY of '%s' from backend pid '%d' received\n",
|
||||
stmt->lineno, notify->relname, notify->be_pid);
|
||||
ECPGfree(notify);
|
||||
PQfreemem(notify);
|
||||
}
|
||||
|
||||
return status;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclId.c,v 1.40 2003/02/01 00:22:12 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclId.c,v 1.41 2003/03/25 02:44:36 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -554,7 +554,7 @@ Pg_Notify_EventProc(Tcl_Event *evPtr, int flags)
|
||||
if (event->connid == NULL)
|
||||
{
|
||||
if (event->notify)
|
||||
PQfreeNotify(event->notify);
|
||||
PQfreemem(event->notify);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -634,7 +634,7 @@ Pg_Notify_EventProc(Tcl_Event *evPtr, int flags)
|
||||
Tcl_Release((ClientData) event->connid);
|
||||
|
||||
if (event->notify)
|
||||
PQfreeNotify(event->notify);
|
||||
PQfreemem(event->notify);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.127 2003/03/22 03:29:06 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.128 2003/03/25 02:44:36 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -1577,20 +1577,6 @@ PQnotifies(PGconn *conn)
|
||||
return event;
|
||||
}
|
||||
|
||||
/*
|
||||
* PQfreeNotify - free's the memory associated with a PGnotify
|
||||
*
|
||||
* This function is needed on Windows when using libpq.dll and
|
||||
* for example libpgtcl.dll: All memory allocated inside a dll
|
||||
* should be freed in the context of the same dll.
|
||||
*
|
||||
*/
|
||||
void
|
||||
PQfreeNotify(PGnotify *notify)
|
||||
{
|
||||
free(notify);
|
||||
}
|
||||
|
||||
/*
|
||||
* PQgetline - gets a newline-terminated string from the backend.
|
||||
*
|
||||
@@ -2470,3 +2456,22 @@ PQsendSome(PGconn *conn)
|
||||
{
|
||||
return pqSendSome(conn);
|
||||
}
|
||||
|
||||
/*
|
||||
* PQfreeNotify - free's the memory associated with a PGnotify
|
||||
*
|
||||
* This function is here only for binary backward compatibility.
|
||||
* New code should use PQfreemem(). A macro will automatically map
|
||||
* calls to PQfreemem. It should be removed in the future. bjm 2003-03-24
|
||||
*/
|
||||
|
||||
#undef PQfreeNotify
|
||||
void PQfreeNotify(PGnotify *notify);
|
||||
|
||||
void
|
||||
PQfreeNotify(PGnotify *notify)
|
||||
{
|
||||
PQfreemem(notify);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: libpq-fe.h,v 1.90 2003/03/22 03:29:06 momjian Exp $
|
||||
* $Id: libpq-fe.h,v 1.91 2003/03/25 02:44:36 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -260,7 +260,8 @@ extern void PQfreemem(void *ptr);
|
||||
/* Simple synchronous query */
|
||||
extern PGresult *PQexec(PGconn *conn, const char *query);
|
||||
extern PGnotify *PQnotifies(PGconn *conn);
|
||||
extern void PQfreeNotify(PGnotify *notify);
|
||||
/* Exists for backward compatibility. bjm 2003-03-24 */
|
||||
#define PQfreeNotify(ptr) PQfreemem(ptr)
|
||||
|
||||
/* Interface for multiple-result or asynchronous queries */
|
||||
extern int PQsendQuery(PGconn *conn, const char *query);
|
||||
|
||||
@@ -2066,7 +2066,7 @@ pg_getnotify(pgobject * self, PyObject * args)
|
||||
}
|
||||
|
||||
PyTuple_SET_ITEM(notify_result, 1, temp);
|
||||
free(notify);
|
||||
PQfreemem(notify);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user