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

Commit25b7583

Browse files
author
Neil Conway
committed
Minor perf tweak for _SPI_strdup(): if we're going to call strlen()
anyway, it is faster to memcpy() than to strcpy().
1 parent208d0a2 commit25b7583

File tree

1 file changed

+4
-3
lines changed
  • src/backend/utils/adt

1 file changed

+4
-3
lines changed

‎src/backend/utils/adt/xml.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.64 2008/01/01 19:45:53 momjian Exp $
10+
* $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.65 2008/01/12 10:38:32 neilc Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1821,9 +1821,10 @@ map_sql_value_to_xml_value(Datum value, Oid type)
18211821
staticchar*
18221822
_SPI_strdup(constchar*s)
18231823
{
1824-
char*ret=SPI_palloc(strlen(s)+1);
1824+
size_tlen=strlen(s)+1;
1825+
char*ret=SPI_palloc(len);
18251826

1826-
strcpy(ret,s);
1827+
memcpy(ret,s,len);
18271828
returnret;
18281829
}
18291830

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp