Thanks to visit codestin.com
Credit goes to github.com

Skip to content

PGPRO-6866: do not use the function pg_atoi if possible #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions tsparser.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@ typedef struct TParser
int type;
} TParser;

#if PG_VERSION_NUM < 120000
#define pg_strtoint32(value) pg_atoi((value), sizeof(int32), 0)
#endif


/* forward decls here */
static bool TParserGet(TParser *prs);
Expand Down Expand Up @@ -2533,13 +2537,13 @@ tsparser_headline(PG_FUNCTION_ARGS)
char *val = defGetString(defel);

if (pg_strcasecmp(defel->defname, "MaxWords") == 0)
max_words = pg_atoi(val, sizeof(int32), 0);
max_words = pg_strtoint32(val);
else if (pg_strcasecmp(defel->defname, "MinWords") == 0)
min_words = pg_atoi(val, sizeof(int32), 0);
min_words = pg_strtoint32(val);
else if (pg_strcasecmp(defel->defname, "ShortWord") == 0)
shortword = pg_atoi(val, sizeof(int32), 0);
shortword = pg_strtoint32(val);
else if (pg_strcasecmp(defel->defname, "MaxFragments") == 0)
max_fragments = pg_atoi(val, sizeof(int32), 0);
max_fragments = pg_strtoint32(val);
else if (pg_strcasecmp(defel->defname, "StartSel") == 0)
prs->startsel = pstrdup(val);
else if (pg_strcasecmp(defel->defname, "StopSel") == 0)
Expand Down