Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit23ecb88

Browse files
committed
Add PQfreemem() call for Win32.
1 parentaaf11b9 commit23ecb88

File tree

3 files changed

+36
-3
lines changed

3 files changed

+36
-3
lines changed

‎doc/src/sgml/libpq.sgml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.113 2003/03/20 06:23:30 momjian Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.114 2003/03/22 03:29:05 momjian Exp $
33
-->
44

55
<chapter id="libpq">
@@ -1151,6 +1151,25 @@ unsigned char *PQunescapeBytea(const unsigned char *from, size_t *to_length);
11511151
</para>
11521152
</listitem>
11531153
</varlistentry>
1154+
1155+
<varlistentry>
1156+
<term><function>PQfreemem</function></term>
1157+
<listitem>
1158+
<para>
1159+
Frees memory allocated by <application>libpq</>
1160+
<synopsis>
1161+
void PQfreemem(void *ptr);
1162+
</synopsis>
1163+
</para>
1164+
1165+
<para>
1166+
Frees memory allocated by <application>libpq</>, particularly
1167+
<function>PQescapeBytea</function> and <function>PQunescapeBytea</function>.
1168+
It is needed by Win32, which can not free memory across
1169+
DLL's, unless multithreaded DLL's (/MD in VC6) are used.
1170+
</para>
1171+
</listitem>
1172+
</varlistentry>
11541173
</variablelist>
11551174

11561175
</sect2>

‎src/interfaces/libpq/fe-exec.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.126 2003/03/10 22:28:21 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.127 2003/03/22 03:29:06 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -284,6 +284,19 @@ PQunescapeBytea(const unsigned char *strtext, size_t *retbuflen)
284284
returnbuffer;
285285
}
286286

287+
288+
/*
289+
*PQfreemem - safely frees memory allocated
290+
*
291+
* Needed mostly by Win32, unless multithreaded DLL (/MD in VC6)
292+
* Used for freeing memory from PQescapeByte()a/PQunescapeBytea()
293+
*/
294+
voidPQfreemem(void*ptr)
295+
{
296+
free(ptr);
297+
}
298+
299+
287300
/* ----------------
288301
* Space management for PGresult.
289302
*

‎src/interfaces/libpq/libpq-fe.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: libpq-fe.h,v 1.89 2003/03/20 06:23:30 momjian Exp $
10+
* $Id: libpq-fe.h,v 1.90 2003/03/22 03:29:06 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -254,6 +254,7 @@ extern unsigned char *PQescapeBytea(const unsigned char *bintext, size_t binlen,
254254
size_t*bytealen);
255255
externunsignedchar*PQunescapeBytea(constunsignedchar*strtext,
256256
size_t*retbuflen);
257+
externvoidPQfreemem(void*ptr);
257258

258259

259260
/* Simple synchronous query */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp