needlessly casting away const in localtime.c
Friends, per the recent thread "gratuitous casting away const", the
assignment on line 1247 of localtime.c has const lvalue and rvalue,
yet casts through (char *) rather than (const char *). Fix attached.
Mark Dilger
Attachments:
localtime.c.patchapplication/octet-stream; name=localtime.c.patchDownload
diff --git a/src/timezone/localtime.c b/src/timezone/localtime.c
index d004e5e..05877e1 100644
--- a/src/timezone/localtime.c
+++ b/src/timezone/localtime.c
@@ -1244,7 +1244,7 @@ localsub(struct state const * sp, pg_time_t const * timep,
if (result)
{
result->tm_isdst = ttisp->tt_isdst;
- result->tm_zone = (char *) &sp->chars[ttisp->tt_abbrind];
+ result->tm_zone = (const char *) &sp->chars[ttisp->tt_abbrind];
}
return result;
}
Mark Dilger <hornschnorter@gmail.com> writes:
Friends, per the recent thread "gratuitous casting away const", the
assignment on line 1247 of localtime.c has const lvalue and rvalue,
yet casts through (char *) rather than (const char *). Fix attached.
If you want to propose cosmetic improvements in localtime.c, or the
majority of the other stuff in src/timezone, you need to send it to
the IANA folk. Otherwise it'll just be lost next time we sync with
them. See src/timezone/README.
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers