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

Commit09caa87

Browse files
alvherrepull[bot]
authored andcommitted
Remove useless pstrdups in untransformRelOptions
The two strings are already a single palloc'd chunk, not freed; there'sno reason to allocate separate copies that have the same lifetime.This code is only called in short-lived memory contexts (except in somecases in TopTransactionContext, which is still short-lived enough not toreally matter), and typically only for short arrays, so the memory orcomputation saved is likely negligible. However, let's fix it to avoidleaving a bad example of code to copy. This is the only place I couldfind where we're doing this with makeDefElem().Reported-by: Junwang Zhao <zhjwpku@gmail.com>Discussion:https://postgr.es/m/20220909142050.3vv2hjekppk265dd@alvherre.pgsql
1 parentcf0baf7 commit09caa87

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎src/backend/access/common/reloptions.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,9 +1357,9 @@ untransformRelOptions(Datum options)
13571357
if (p)
13581358
{
13591359
*p++='\0';
1360-
val= (Node*)makeString(pstrdup(p));
1360+
val= (Node*)makeString(p);
13611361
}
1362-
result=lappend(result,makeDefElem(pstrdup(s),val,-1));
1362+
result=lappend(result,makeDefElem(s,val,-1));
13631363
}
13641364

13651365
returnresult;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp