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

Commitf0584d4

Browse files
committed
Replace strtok with strtok_r
1 parent37ca385 commitf0584d4

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

‎src/backend/utils/misc/tzparser.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,12 @@ splitTzLine(const char *filename, int lineno, char *line, tzEntry *tzentry)
102102
char*offset_endptr;
103103
char*remain;
104104
char*is_dst;
105+
char*saveptr=NULL;
105106

106107
tzentry->lineno=lineno;
107108
tzentry->filename=filename;
108109

109-
abbrev=strtok(line,WHITESPACE);
110+
abbrev=strtok_r(line,WHITESPACE,&saveptr);
110111
if (!abbrev)
111112
{
112113
GUC_check_errmsg("missing time zone abbreviation in time zone file \"%s\", line %d",
@@ -115,7 +116,7 @@ splitTzLine(const char *filename, int lineno, char *line, tzEntry *tzentry)
115116
}
116117
tzentry->abbrev=pstrdup(abbrev);
117118

118-
offset=strtok(NULL,WHITESPACE);
119+
offset=strtok_r(NULL,WHITESPACE,&saveptr);
119120
if (!offset)
120121
{
121122
GUC_check_errmsg("missing time zone offset in time zone file \"%s\", line %d",
@@ -135,11 +136,11 @@ splitTzLine(const char *filename, int lineno, char *line, tzEntry *tzentry)
135136
return false;
136137
}
137138

138-
is_dst=strtok(NULL,WHITESPACE);
139+
is_dst=strtok_r(NULL,WHITESPACE,&saveptr);
139140
if (is_dst&&pg_strcasecmp(is_dst,"D")==0)
140141
{
141142
tzentry->is_dst= true;
142-
remain=strtok(NULL,WHITESPACE);
143+
remain=strtok_r(NULL,WHITESPACE,&saveptr);
143144
}
144145
else
145146
{
@@ -158,7 +159,7 @@ splitTzLine(const char *filename, int lineno, char *line, tzEntry *tzentry)
158159
tzentry->zone=pstrdup(offset);
159160
tzentry->offset=0;
160161
tzentry->is_dst= false;
161-
remain=strtok(NULL,WHITESPACE);
162+
remain=strtok_r(NULL,WHITESPACE,&saveptr);
162163
}
163164

164165
if (!remain)/* no more non-whitespace chars */
@@ -284,6 +285,7 @@ ParseTzFile(const char *filename, int depth,
284285
tzEntrytzentry;
285286
intlineno=0;
286287
booloverride= false;
288+
char*saveptr=NULL;
287289
constchar*p;
288290

289291
/*
@@ -393,7 +395,7 @@ ParseTzFile(const char *filename, int depth,
393395
/* pstrdup so we can use filename in result data structure */
394396
char*includeFile=pstrdup(line+strlen("@INCLUDE"));
395397

396-
includeFile=strtok(includeFile,WHITESPACE);
398+
includeFile=strtok_r(includeFile,WHITESPACE,&saveptr);
397399
if (!includeFile|| !*includeFile)
398400
{
399401
GUC_check_errmsg("@INCLUDE without file name in time zone file \"%s\", line %d",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp