提交 23ecb885 编写于 作者: B Bruce Momjian

Add PQfreemem() call for Win32.

上级 aaf11b93
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.113 2003/03/20 06:23:30 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.114 2003/03/22 03:29:05 momjian Exp $
--> -->
<chapter id="libpq"> <chapter id="libpq">
...@@ -1151,6 +1151,25 @@ unsigned char *PQunescapeBytea(const unsigned char *from, size_t *to_length); ...@@ -1151,6 +1151,25 @@ unsigned char *PQunescapeBytea(const unsigned char *from, size_t *to_length);
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><function>PQfreemem</function></term>
<listitem>
<para>
Frees memory allocated by <application>libpq</>
<synopsis>
void PQfreemem(void *ptr);
</synopsis>
</para>
<para>
Frees memory allocated by <application>libpq</>, particularly
<function>PQescapeBytea</function> and <function>PQunescapeBytea</function>.
It is needed by Win32, which can not free memory across
DLL's, unless multithreaded DLL's (/MD in VC6) are used.
</para>
</listitem>
</varlistentry>
</variablelist> </variablelist>
</sect2> </sect2>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.126 2003/03/10 22:28:21 tgl Exp $ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.127 2003/03/22 03:29:06 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -284,6 +284,19 @@ PQunescapeBytea(const unsigned char *strtext, size_t *retbuflen) ...@@ -284,6 +284,19 @@ PQunescapeBytea(const unsigned char *strtext, size_t *retbuflen)
return buffer; return buffer;
} }
/*
* PQfreemem - safely frees memory allocated
*
* Needed mostly by Win32, unless multithreaded DLL (/MD in VC6)
* Used for freeing memory from PQescapeByte()a/PQunescapeBytea()
*/
void PQfreemem(void *ptr)
{
free(ptr);
}
/* ---------------- /* ----------------
* Space management for PGresult. * Space management for PGresult.
* *
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: libpq-fe.h,v 1.89 2003/03/20 06:23:30 momjian Exp $ * $Id: libpq-fe.h,v 1.90 2003/03/22 03:29:06 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -254,6 +254,7 @@ extern unsigned char *PQescapeBytea(const unsigned char *bintext, size_t binlen, ...@@ -254,6 +254,7 @@ extern unsigned char *PQescapeBytea(const unsigned char *bintext, size_t binlen,
size_t *bytealen); size_t *bytealen);
extern unsigned char *PQunescapeBytea(const unsigned char *strtext, extern unsigned char *PQunescapeBytea(const unsigned char *strtext,
size_t *retbuflen); size_t *retbuflen);
extern void PQfreemem(void *ptr);
/* Simple synchronous query */ /* Simple synchronous query */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册