[23/59] Minor tzfile.c clarity improvements
Checks
Context |
Check |
Description |
redhat-pt-bot/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
Commit Message
* time/tzfile.c (__tzfile_read, __tzfile_compute):
Avoid some unnecesary unsigned char -> int conversions.
Improve clarity of loop controlling.
---
time/tzfile.c | 23 +++++++++--------------
1 file changed, 9 insertions(+), 14 deletions(-)
@@ -508,16 +508,14 @@ __tzfile_read (const char *file)
transitioned to earliest in time. */
__tzname[0] = NULL;
__tzname[1] = NULL;
- for (i = timecnt; i > 0; )
+ for (i = timecnt; i > 0; i--)
{
- int type = type_idxs[--i];
- int dst = types[type].dst;
+ struct ttinfo *ttype = &types[type_idxs[i - 1]];
+ unsigned char dst = ttype->dst;
if (__tzname[dst] == NULL)
{
- int idx = types[type].idx;
-
- __tzname[dst] = __tzstring (&zone_names[idx]);
+ __tzname[dst] = __tzstring (&zone_names[ttype->idx]);
if (__tzname[1 - dst] != NULL)
break;
@@ -699,22 +697,19 @@ __tzfile_compute (__time64_t timer, int use_localtime,
&& (i == timecnt || timer < transitions[i])); */
__tzname[types[type_idxs[i - 1]].dst]
= __tzstring (&zone_names[types[type_idxs[i - 1]].idx]);
- tzidx j = i;
- while (j < timecnt)
+
+ for (tzidx j = i; j < timecnt; j++)
{
- int type = type_idxs[j];
- int dst = types[type].dst;
- int idx = types[type].idx;
+ struct ttinfo *ttype = &types[type_idxs[j]];
+ unsigned char dst = ttype->dst;
if (__tzname[dst] == NULL)
{
- __tzname[dst] = __tzstring (&zone_names[idx]);
+ __tzname[dst] = __tzstring (&zone_names[ttype->idx]);
if (__tzname[1 - dst] != NULL)
break;
}
-
- ++j;
}
if (__glibc_unlikely (__tzname[0] == NULL))