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

Commitef4120f

Browse files
author
Marina Polyakova
committed
PGPRO-6866: do not use the function pg_atoi if possible
In PostgreSQL version 12 or higher it's more effecient to use the functionpg_strtoint32 instead (see the commit 86eaf208ea048936df6be77276a246d3f92e9620).And in PostgreSQL 15 the function pg_atoi was removed altogether (see the commit73508475d69e90f98ebd9b7e1a5933a26a49c5e9). Therefore if possible use thefunction pg_strtoint32 instead.
1 parent9a911f7 commitef4120f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

‎tsparser.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,10 @@ typedef struct TParser
269269
inttype;
270270
}TParser;
271271

272+
#ifPG_VERSION_NUM<120000
273+
#definepg_strtoint32(value)pg_atoi((value), sizeof(int32), 0)
274+
#endif
275+
272276

273277
/* forward decls here */
274278
staticboolTParserGet(TParser*prs);
@@ -2533,13 +2537,13 @@ tsparser_headline(PG_FUNCTION_ARGS)
25332537
char*val=defGetString(defel);
25342538

25352539
if (pg_strcasecmp(defel->defname,"MaxWords")==0)
2536-
max_words=pg_atoi(val,sizeof(int32),0);
2540+
max_words=pg_strtoint32(val);
25372541
elseif (pg_strcasecmp(defel->defname,"MinWords")==0)
2538-
min_words=pg_atoi(val,sizeof(int32),0);
2542+
min_words=pg_strtoint32(val);
25392543
elseif (pg_strcasecmp(defel->defname,"ShortWord")==0)
2540-
shortword=pg_atoi(val,sizeof(int32),0);
2544+
shortword=pg_strtoint32(val);
25412545
elseif (pg_strcasecmp(defel->defname,"MaxFragments")==0)
2542-
max_fragments=pg_atoi(val,sizeof(int32),0);
2546+
max_fragments=pg_strtoint32(val);
25432547
elseif (pg_strcasecmp(defel->defname,"StartSel")==0)
25442548
prs->startsel=pstrdup(val);
25452549
elseif (pg_strcasecmp(defel->defname,"StopSel")==0)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp