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

Commitc4f8e89

Browse files
Consistently use named parameters in timezone code.
Make our copy of the IANA timezone library use named parameters infunction declarations. Also make sure that parameter names from eachfunction's declaration match corresponding definition parameter names.This makes the timezone code follow Postgres coding standards. Thevalue of having a consistent standard everywhere seems to outweigh thecost of keeping the function declarations in sync with future IANAreleases.Author: Peter Geoghegan <pg@bowt.ie>Reviewed-By: David Rowley <dgrowleyml@gmail.com>Discussion:https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com
1 parentbc2187e commitc4f8e89

File tree

4 files changed

+36
-32
lines changed

4 files changed

+36
-32
lines changed

‎src/timezone/localtime.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,15 @@ struct rule
8282
* Prototypes for static functions.
8383
*/
8484

85-
staticstructpg_tm*gmtsub(pg_time_tconst*,int32,structpg_tm*);
86-
staticboolincrement_overflow(int*,int);
87-
staticboolincrement_overflow_time(pg_time_t*,int32);
88-
staticint64leapcorr(structstateconst*,pg_time_t);
89-
staticstructpg_tm*timesub(pg_time_tconst*,int32,structstateconst*,
90-
structpg_tm*);
91-
staticbooltypesequiv(structstateconst*,int,int);
85+
staticstructpg_tm*gmtsub(pg_time_tconst*timep,int32offset,
86+
structpg_tm*tmp);
87+
staticboolincrement_overflow(int*ip,intj);
88+
staticboolincrement_overflow_time(pg_time_t*tp,int32j);
89+
staticint64leapcorr(structstateconst*sp,pg_time_tt);
90+
staticstructpg_tm*timesub(pg_time_tconst*timep,
91+
int32offset,structstateconst*sp,
92+
structpg_tm*tmp);
93+
staticbooltypesequiv(structstateconst*sp,inta,intb);
9294

9395

9496
/*

‎src/timezone/pgtz.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,15 +232,15 @@ init_timezone_hashtable(void)
232232
* default timezone setting is later overridden from postgresql.conf.
233233
*/
234234
pg_tz*
235-
pg_tzset(constchar*name)
235+
pg_tzset(constchar*tzname)
236236
{
237237
pg_tz_cache*tzp;
238238
structstatetzstate;
239239
charuppername[TZ_STRLEN_MAX+1];
240240
charcanonname[TZ_STRLEN_MAX+1];
241241
char*p;
242242

243-
if (strlen(name)>TZ_STRLEN_MAX)
243+
if (strlen(tzname)>TZ_STRLEN_MAX)
244244
returnNULL;/* not going to fit */
245245

246246
if (!timezone_cache)
@@ -254,8 +254,8 @@ pg_tzset(const char *name)
254254
* a POSIX-style timezone spec.)
255255
*/
256256
p=uppername;
257-
while (*name)
258-
*p++=pg_toupper((unsignedchar)*name++);
257+
while (*tzname)
258+
*p++=pg_toupper((unsignedchar)*tzname++);
259259
*p='\0';
260260

261261
tzp= (pg_tz_cache*)hash_search(timezone_cache,

‎src/timezone/strftime.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ enum warn
111111
IN_NONE,IN_SOME,IN_THIS,IN_ALL
112112
};
113113

114-
staticchar*_add(constchar*,char*,constchar*);
115-
staticchar*_conv(int,constchar*,char*,constchar*);
116-
staticchar*_fmt(constchar*,conststructpg_tm*,char*,constchar*,
117-
enumwarn*);
118-
staticchar*_yconv(int,int,bool,bool,char*,charconst*);
114+
staticchar*_add(constchar*str,char*pt,constchar*ptlim);
115+
staticchar*_conv(intn,constchar*format,char*pt,constchar*ptlim);
116+
staticchar*_fmt(constchar*format,conststructpg_tm*t,char*pt,constchar*ptlim,
117+
enumwarn*warnp);
118+
staticchar*_yconv(inta,intb,boolconvert_top,boolconvert_yy,char*pt,charconst*ptlim);
119119

120120

121121
/*

‎src/timezone/zic.c

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -123,30 +123,32 @@ static void error(const char *string,...) pg_attribute_printf(1, 2);
123123
staticvoidwarning(constchar*string,...)pg_attribute_printf(1,2);
124124
staticvoidusage(FILE*stream,intstatus)pg_attribute_noreturn();
125125
staticvoidaddtt(zic_tstarttime,inttype);
126-
staticintaddtype(zic_t,charconst*,bool,bool,bool);
127-
staticvoidleapadd(zic_t,int,int);
126+
staticintaddtype(zic_tutoff,charconst*abbr,
127+
boolisdst,boolttisstd,boolttisut);
128+
staticvoidleapadd(zic_tt,intcorrection,introlling);
128129
staticvoidadjleap(void);
129130
staticvoidassociate(void);
130-
staticvoiddolink(constchar*,constchar*,bool);
131-
staticchar**getfields(char*buf);
131+
staticvoiddolink(charconst*target,charconst*linkname,
132+
boolstaysymlink);
133+
staticchar**getfields(char*cp);
132134
staticzic_tgethms(constchar*string,constchar*errstring);
133-
staticzic_tgetsave(char*,bool*);
134-
staticvoidinexpires(char**,int);
135-
staticvoidinfile(constchar*filename);
135+
staticzic_tgetsave(char*field,bool*isdst);
136+
staticvoidinexpires(char**fields,intnfields);
137+
staticvoidinfile(constchar*name);
136138
staticvoidinleap(char**fields,intnfields);
137139
staticvoidinlink(char**fields,intnfields);
138140
staticvoidinrule(char**fields,intnfields);
139141
staticboolinzcont(char**fields,intnfields);
140142
staticboolinzone(char**fields,intnfields);
141-
staticboolinzsub(char**,int,bool);
142-
staticboolitsdir(charconst*);
143-
staticboolitssymlink(charconst*);
143+
staticboolinzsub(char**fields,intnfields,booliscont);
144+
staticboolitsdir(charconst*name);
145+
staticboolitssymlink(charconst*name);
144146
staticboolis_alpha(chara);
145-
staticcharlowerit(char);
146-
staticvoidmkdirs(charconst*,bool);
147-
staticvoidnewabbr(constchar*abbr);
147+
staticcharlowerit(chara);
148+
staticvoidmkdirs(charconst*argname,boolancestors);
149+
staticvoidnewabbr(constchar*string);
148150
staticzic_toadd(zic_tt1,zic_tt2);
149-
staticvoidoutzone(conststructzone*zp,ptrdiff_tntzones);
151+
staticvoidoutzone(conststructzone*zpfirst,ptrdiff_tzonecount);
150152
staticzic_trpytime(conststructrule*rp,zic_twantedy);
151153
staticvoidrulesub(structrule*rp,
152154
constchar*loyearp,constchar*hiyearp,
@@ -304,8 +306,8 @@ struct lookup
304306
constintl_value;
305307
};
306308

307-
staticstructlookupconst*byword(constchar*string,
308-
conststructlookup*lp);
309+
staticstructlookupconst*byword(constchar*word,
310+
conststructlookup*table);
309311

310312
staticstructlookupconstzi_line_codes[]= {
311313
{"Rule",LC_RULE},

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp