Commit d6148e7d authored by Peter Eisentraut's avatar Peter Eisentraut

ecpg: Remove useless return values

Remove useless or inconsistently used return values from functions,
matching backend changes 99bf3282 and
791359fe.
Reviewed-by: default avatarMichael Paquier <michael.paquier@gmail.com>
parent cb29ff83
...@@ -313,12 +313,12 @@ do { \ ...@@ -313,12 +313,12 @@ do { \
int DecodeInterval(char **, int *, int, int *, struct tm *, fsec_t *); int DecodeInterval(char **, int *, int, int *, struct tm *, fsec_t *);
int DecodeTime(char *, int *, struct tm *, fsec_t *); int DecodeTime(char *, int *, struct tm *, fsec_t *);
int EncodeDateTime(struct tm *tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str, bool EuroDates); void EncodeDateTime(struct tm *tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str, bool EuroDates);
int EncodeInterval(struct tm *tm, fsec_t fsec, int style, char *str); void EncodeInterval(struct tm *tm, fsec_t fsec, int style, char *str);
int tm2timestamp(struct tm *, fsec_t, int *, timestamp *); int tm2timestamp(struct tm *, fsec_t, int *, timestamp *);
int DecodeUnits(int field, char *lowtoken, int *val); int DecodeUnits(int field, char *lowtoken, int *val);
bool CheckDateTokenTables(void); bool CheckDateTokenTables(void);
int EncodeDateOnly(struct tm *tm, int style, char *str, bool EuroDates); void EncodeDateOnly(struct tm *tm, int style, char *str, bool EuroDates);
int GetEpochTime(struct tm *); int GetEpochTime(struct tm *);
int ParseDateTime(char *, char *, char **, int *, int *, char **); int ParseDateTime(char *, char *, char **, int *, int *, char **);
int DecodeDateTime(char **, int *, int, int *, struct tm *, fsec_t *, bool); int DecodeDateTime(char **, int *, int, int *, struct tm *, fsec_t *, bool);
......
...@@ -671,11 +671,10 @@ DecodeSpecial(int field, char *lowtoken, int *val) ...@@ -671,11 +671,10 @@ DecodeSpecial(int field, char *lowtoken, int *val)
/* EncodeDateOnly() /* EncodeDateOnly()
* Encode date as local time. * Encode date as local time.
*/ */
int void
EncodeDateOnly(struct tm *tm, int style, char *str, bool EuroDates) EncodeDateOnly(struct tm *tm, int style, char *str, bool EuroDates)
{ {
if (tm->tm_mon < 1 || tm->tm_mon > MONTHS_PER_YEAR) Assert(tm->tm_mon >= 1 && tm->tm_mon <= MONTHS_PER_YEAR);
return -1;
switch (style) switch (style)
{ {
...@@ -723,9 +722,7 @@ EncodeDateOnly(struct tm *tm, int style, char *str, bool EuroDates) ...@@ -723,9 +722,7 @@ EncodeDateOnly(struct tm *tm, int style, char *str, bool EuroDates)
sprintf(str + 5, "-%04d %s", -(tm->tm_year - 1), "BC"); sprintf(str + 5, "-%04d %s", -(tm->tm_year - 1), "BC");
break; break;
} }
}
return TRUE;
} /* EncodeDateOnly() */
void void
TrimTrailingZeros(char *str) TrimTrailingZeros(char *str)
...@@ -758,7 +755,7 @@ TrimTrailingZeros(char *str) ...@@ -758,7 +755,7 @@ TrimTrailingZeros(char *str)
* US - mm/dd/yyyy * US - mm/dd/yyyy
* European - dd/mm/yyyy * European - dd/mm/yyyy
*/ */
int void
EncodeDateTime(struct tm *tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str, bool EuroDates) EncodeDateTime(struct tm *tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str, bool EuroDates)
{ {
int day, int day,
...@@ -951,9 +948,7 @@ EncodeDateTime(struct tm *tm, fsec_t fsec, bool print_tz, int tz, const char *tz ...@@ -951,9 +948,7 @@ EncodeDateTime(struct tm *tm, fsec_t fsec, bool print_tz, int tz, const char *tz
} }
break; break;
} }
}
return TRUE;
} /* EncodeDateTime() */
int int
GetEpochTime(struct tm *tm) GetEpochTime(struct tm *tm)
......
...@@ -331,8 +331,6 @@ DecodeISO8601Interval(char *str, ...@@ -331,8 +331,6 @@ DecodeISO8601Interval(char *str,
* * ECPG semes not to have a global IntervalStyle * * ECPG semes not to have a global IntervalStyle
* so added * so added
* int IntervalStyle = INTSTYLE_POSTGRES; * int IntervalStyle = INTSTYLE_POSTGRES;
*
* * Assert wasn't available so removed it.
*/ */
int int
DecodeInterval(char **field, int *ftype, int nf, /* int range, */ DecodeInterval(char **field, int *ftype, int nf, /* int range, */
...@@ -374,7 +372,7 @@ DecodeInterval(char **field, int *ftype, int nf, /* int range, */ ...@@ -374,7 +372,7 @@ DecodeInterval(char **field, int *ftype, int nf, /* int range, */
* least one digit; there could be ':', '.', '-' embedded in * least one digit; there could be ':', '.', '-' embedded in
* it as well. * it as well.
*/ */
/* Assert(*field[i] == '-' || *field[i] == '+'); */ Assert(*field[i] == '-' || *field[i] == '+');
/* /*
* Try for hh:mm or hh:mm:ss. If not, fall through to * 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) ...@@ -771,7 +769,7 @@ AppendSeconds(char *cp, int sec, fsec_t fsec, int precision, bool fillzeros)
* Change pg_tm to tm * Change pg_tm to tm
*/ */
int void
EncodeInterval(struct /* pg_ */ tm *tm, fsec_t fsec, int style, char *str) EncodeInterval(struct /* pg_ */ tm *tm, fsec_t fsec, int style, char *str)
{ {
char *cp = str; char *cp = str;
...@@ -947,9 +945,7 @@ EncodeInterval(struct /* pg_ */ tm *tm, fsec_t fsec, int style, char *str) ...@@ -947,9 +945,7 @@ EncodeInterval(struct /* pg_ */ tm *tm, fsec_t fsec, int style, char *str)
strcat(cp, " ago"); strcat(cp, " ago");
break; break;
} }
}
return 0;
} /* EncodeInterval() */
/* interval2tm() /* interval2tm()
...@@ -1091,11 +1087,7 @@ PGTYPESinterval_to_asc(interval * span) ...@@ -1091,11 +1087,7 @@ PGTYPESinterval_to_asc(interval * span)
return NULL; return NULL;
} }
if (EncodeInterval(tm, fsec, IntervalStyle, buf) != 0) EncodeInterval(tm, fsec, IntervalStyle, buf);
{
errno = PGTYPES_INTVL_BAD_INTERVAL;
return NULL;
}
return pgtypes_strdup(buf); return pgtypes_strdup(buf);
} }
......
...@@ -192,7 +192,7 @@ timestamp2tm(timestamp dt, int *tzp, struct tm *tm, fsec_t *fsec, const char **t ...@@ -192,7 +192,7 @@ timestamp2tm(timestamp dt, int *tzp, struct tm *tm, fsec_t *fsec, const char **t
/* EncodeSpecialTimestamp() /* EncodeSpecialTimestamp()
* * Convert reserved timestamp data type to string. * * Convert reserved timestamp data type to string.
* */ * */
static int static void
EncodeSpecialTimestamp(timestamp dt, char *str) EncodeSpecialTimestamp(timestamp dt, char *str)
{ {
if (TIMESTAMP_IS_NOBEGIN(dt)) if (TIMESTAMP_IS_NOBEGIN(dt))
...@@ -200,10 +200,8 @@ EncodeSpecialTimestamp(timestamp dt, char *str) ...@@ -200,10 +200,8 @@ EncodeSpecialTimestamp(timestamp dt, char *str)
else if (TIMESTAMP_IS_NOEND(dt)) else if (TIMESTAMP_IS_NOEND(dt))
strcpy(str, LATE); strcpy(str, LATE);
else else
return FALSE; abort(); /* shouldn't happen */
}
return TRUE;
} /* EncodeSpecialTimestamp() */
timestamp timestamp
PGTYPEStimestamp_from_asc(char *str, char **endptr) PGTYPEStimestamp_from_asc(char *str, char **endptr)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment