From 62a99e5ed933060dfc69fabf4c9b16a4f9257dd9 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 6 Dec 2020 12:31:13 +0100 Subject: [PATCH] time_rz: Use idx_t for nonnegative ptrdiff_t variables. * lib/time_rz.c: Include idx.h. (save_abbr): Mark zone_size as nonnegative. * modules/time_rz (Depends-on): Add idx. --- ChangeLog | 7 +++++++ lib/time_rz.c | 3 ++- modules/time_rz | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b6b6a37fc1..139c384a79 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2020-12-06 Bruno Haible + + time_rz: Use idx_t for nonnegative ptrdiff_t variables. + * lib/time_rz.c: Include idx.h. + (save_abbr): Mark zone_size as nonnegative. + * modules/time_rz (Depends-on): Add idx. + 2020-12-06 Bruno Haible parse-datetime: Use idx_t for nonnegative ptrdiff_t variables. diff --git a/lib/time_rz.c b/lib/time_rz.c index a33b8078bf..6e70ca9ff9 100644 --- a/lib/time_rz.c +++ b/lib/time_rz.c @@ -33,6 +33,7 @@ #include #include "flexmember.h" +#include "idx.h" #include "time-internal.h" /* The approximate size to use for small allocation requests. This is @@ -120,7 +121,7 @@ save_abbr (timezone_t tz, struct tm *tm) { if (! (*zone_copy || (zone_copy == tz->abbrs && tz->tz_is_set))) { - ptrdiff_t zone_size = strlen (zone) + 1; + idx_t zone_size = strlen (zone) + 1; if (zone_size < tz->abbrs + ABBR_SIZE_MIN - zone_copy) extend_abbrs (zone_copy, zone, zone_size); else diff --git a/modules/time_rz b/modules/time_rz index 699a61d56f..6a2b23c8cc 100644 --- a/modules/time_rz +++ b/modules/time_rz @@ -22,6 +22,7 @@ c99 extensions time flexmember [test $HAVE_TIMEZONE_T = 0] +idx [test $HAVE_TIMEZONE_T = 0] setenv [test $HAVE_TIMEZONE_T = 0] stdbool [test $HAVE_TIMEZONE_T = 0] time_r [test $HAVE_TIMEZONE_T = 0] -- 2.39.5