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

Commit2d4b973

Browse files
author
Neil Conway
committed
Trivial dead code removal: in _complete_from_query(), 'text' cannot be
NULL (e.g. due to the preceding strlen()). Therefore we needn't recheckthis before initializing 'e_text'.Per Coverity static analysis performed by EnterpriseDB.
1 parent141e878 commit2d4b973

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

‎src/bin/psql/tab-complete.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.131 2005/06/14 17:43:14 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.132 2005/06/21 00:48:33 neilc Exp $
77
*/
88

99
/*----------------------------------------------------------------------
@@ -1909,13 +1909,8 @@ _complete_from_query(int is_schema_query, const char *text, int state)
19091909
result=NULL;
19101910

19111911
/* Set up suitably-escaped copies of textual inputs */
1912-
if (text)
1913-
{
1914-
e_text=pg_malloc(strlen(text)*2+1);
1915-
PQescapeString(e_text,text,strlen(text));
1916-
}
1917-
else
1918-
e_text=NULL;
1912+
e_text=pg_malloc(string_length*2+1);
1913+
PQescapeString(e_text,text,string_length);
19191914

19201915
if (completion_info_charp)
19211916
{
@@ -2035,9 +2030,7 @@ _complete_from_query(int is_schema_query, const char *text, int state)
20352030
result=exec_query(query_buffer.data);
20362031

20372032
termPQExpBuffer(&query_buffer);
2038-
2039-
if (e_text)
2040-
free(e_text);
2033+
free(e_text);
20412034
if (e_info_charp)
20422035
free(e_info_charp);
20432036
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp