summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian2003-03-22 03:29:06 +0000
committerBruce Momjian2003-03-22 03:29:06 +0000
commit23ecb8855d4002798847681f6b60bfaaf2840373 (patch)
tree15d32c516265211bc575b2c21c72aa435ae1c031
parentaaf11b931f2fbb5a3f9c520d4c3c7e9cd32dd4e1 (diff)
Add PQfreemem() call for Win32.
-rw-r--r--doc/src/sgml/libpq.sgml21
-rw-r--r--src/interfaces/libpq/fe-exec.c15
-rw-r--r--src/interfaces/libpq/libpq-fe.h3
3 files changed, 36 insertions, 3 deletions
diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml
index 235a8cbc2e2..3c9bc9cd2d7 100644
--- a/doc/src/sgml/libpq.sgml
+++ b/doc/src/sgml/libpq.sgml
@@ -1,5 +1,5 @@
<!--
-$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">
@@ -1151,6 +1151,25 @@ unsigned char *PQunescapeBytea(const unsigned char *from, size_t *to_length);
</para>
</listitem>
</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>
</sect2>
diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c
index 878da94cff5..5b8a6d3ef04 100644
--- a/src/interfaces/libpq/fe-exec.c
+++ b/src/interfaces/libpq/fe-exec.c
@@ -8,7 +8,7 @@
*
*
* 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)
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.
*
diff --git a/src/interfaces/libpq/libpq-fe.h b/src/interfaces/libpq/libpq-fe.h
index 8114d6e78ea..ce9132deb4b 100644
--- a/src/interfaces/libpq/libpq-fe.h
+++ b/src/interfaces/libpq/libpq-fe.h
@@ -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.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,
size_t *bytealen);
extern unsigned char *PQunescapeBytea(const unsigned char *strtext,
size_t *retbuflen);
+extern void PQfreemem(void *ptr);
/* Simple synchronous query */