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

Commitd6148e7

Browse files
committed
ecpg: Remove useless return values
Remove useless or inconsistently used return values from functions,matching backend changes99bf328 and791359f.Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
1 parentcb29ff8 commitd6148e7

File tree

4 files changed

+15
-30
lines changed

4 files changed

+15
-30
lines changed

‎src/interfaces/ecpg/pgtypeslib/dt.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,12 +313,12 @@ do { \
313313

314314
intDecodeInterval(char**,int*,int,int*,structtm*,fsec_t*);
315315
intDecodeTime(char*,int*,structtm*,fsec_t*);
316-
intEncodeDateTime(structtm*tm,fsec_tfsec,boolprint_tz,inttz,constchar*tzn,intstyle,char*str,boolEuroDates);
317-
intEncodeInterval(structtm*tm,fsec_tfsec,intstyle,char*str);
316+
voidEncodeDateTime(structtm*tm,fsec_tfsec,boolprint_tz,inttz,constchar*tzn,intstyle,char*str,boolEuroDates);
317+
voidEncodeInterval(structtm*tm,fsec_tfsec,intstyle,char*str);
318318
inttm2timestamp(structtm*,fsec_t,int*,timestamp*);
319319
intDecodeUnits(intfield,char*lowtoken,int*val);
320320
boolCheckDateTokenTables(void);
321-
intEncodeDateOnly(structtm*tm,intstyle,char*str,boolEuroDates);
321+
voidEncodeDateOnly(structtm*tm,intstyle,char*str,boolEuroDates);
322322
intGetEpochTime(structtm*);
323323
intParseDateTime(char*,char*,char**,int*,int*,char**);
324324
intDecodeDateTime(char**,int*,int,int*,structtm*,fsec_t*,bool);

‎src/interfaces/ecpg/pgtypeslib/dt_common.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -671,11 +671,10 @@ DecodeSpecial(int field, char *lowtoken, int *val)
671671
/* EncodeDateOnly()
672672
* Encode date as local time.
673673
*/
674-
int
674+
void
675675
EncodeDateOnly(structtm*tm,intstyle,char*str,boolEuroDates)
676676
{
677-
if (tm->tm_mon<1||tm->tm_mon>MONTHS_PER_YEAR)
678-
return-1;
677+
Assert(tm->tm_mon >=1&&tm->tm_mon <=MONTHS_PER_YEAR);
679678

680679
switch (style)
681680
{
@@ -723,9 +722,7 @@ EncodeDateOnly(struct tm *tm, int style, char *str, bool EuroDates)
723722
sprintf(str+5,"-%04d %s",-(tm->tm_year-1),"BC");
724723
break;
725724
}
726-
727-
return TRUE;
728-
}/* EncodeDateOnly() */
725+
}
729726

730727
void
731728
TrimTrailingZeros(char*str)
@@ -758,7 +755,7 @@ TrimTrailingZeros(char *str)
758755
*US - mm/dd/yyyy
759756
*European - dd/mm/yyyy
760757
*/
761-
int
758+
void
762759
EncodeDateTime(structtm*tm,fsec_tfsec,boolprint_tz,inttz,constchar*tzn,intstyle,char*str,boolEuroDates)
763760
{
764761
intday,
@@ -951,9 +948,7 @@ EncodeDateTime(struct tm *tm, fsec_t fsec, bool print_tz, int tz, const char *tz
951948
}
952949
break;
953950
}
954-
955-
return TRUE;
956-
}/* EncodeDateTime() */
951+
}
957952

958953
int
959954
GetEpochTime(structtm*tm)

‎src/interfaces/ecpg/pgtypeslib/interval.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,6 @@ DecodeISO8601Interval(char *str,
331331
** ECPG semes not to have a global IntervalStyle
332332
* so added
333333
*int IntervalStyle = INTSTYLE_POSTGRES;
334-
*
335-
** Assert wasn't available so removed it.
336334
*/
337335
int
338336
DecodeInterval(char**field,int*ftype,intnf,/* int range, */
@@ -374,7 +372,7 @@ DecodeInterval(char **field, int *ftype, int nf,/* int range, */
374372
* least one digit; there could be ':', '.', '-' embedded in
375373
* it as well.
376374
*/
377-
/*Assert(*field[i] == '-' || *field[i] == '+'); */
375+
Assert(*field[i]=='-'||*field[i]=='+');
378376

379377
/*
380378
* Try for hh:mm or hh:mm:ss. If not, fall through to
@@ -771,7 +769,7 @@ AppendSeconds(char *cp, int sec, fsec_t fsec, int precision, bool fillzeros)
771769
* Change pg_tm to tm
772770
*/
773771

774-
int
772+
void
775773
EncodeInterval(struct/* pg_ */tm*tm,fsec_tfsec,intstyle,char*str)
776774
{
777775
char*cp=str;
@@ -947,9 +945,7 @@ EncodeInterval(struct /* pg_ */ tm *tm, fsec_t fsec, int style, char *str)
947945
strcat(cp," ago");
948946
break;
949947
}
950-
951-
return0;
952-
}/* EncodeInterval() */
948+
}
953949

954950

955951
/* interval2tm()
@@ -1091,11 +1087,7 @@ PGTYPESinterval_to_asc(interval * span)
10911087
returnNULL;
10921088
}
10931089

1094-
if (EncodeInterval(tm,fsec,IntervalStyle,buf)!=0)
1095-
{
1096-
errno=PGTYPES_INTVL_BAD_INTERVAL;
1097-
returnNULL;
1098-
}
1090+
EncodeInterval(tm,fsec,IntervalStyle,buf);
10991091

11001092
returnpgtypes_strdup(buf);
11011093
}

‎src/interfaces/ecpg/pgtypeslib/timestamp.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,18 +192,16 @@ timestamp2tm(timestamp dt, int *tzp, struct tm *tm, fsec_t *fsec, const char **t
192192
/* EncodeSpecialTimestamp()
193193
** Convert reserved timestamp data type to string.
194194
* */
195-
staticint
195+
staticvoid
196196
EncodeSpecialTimestamp(timestampdt,char*str)
197197
{
198198
if (TIMESTAMP_IS_NOBEGIN(dt))
199199
strcpy(str,EARLY);
200200
elseif (TIMESTAMP_IS_NOEND(dt))
201201
strcpy(str,LATE);
202202
else
203-
return FALSE;
204-
205-
return TRUE;
206-
}/* EncodeSpecialTimestamp() */
203+
abort();/* shouldn't happen */
204+
}
207205

208206
timestamp
209207
PGTYPEStimestamp_from_asc(char*str,char**endptr)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp