>From f09bd3c4dfa248da10dbec6ac5708f61239dca09 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 5 Dec 2020 11:53:00 +0100 Subject: [PATCH 5/6] 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 57dea1d..9c0fef9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2020-12-05 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-05 Bruno Haible + parse-datetime: Use idx_t for nonnegative ptrdiff_t variables. * lib/parse-datetime.y: Include idx.h. (textint): Mark digits as nonnegative. diff --git a/lib/time_rz.c b/lib/time_rz.c index a33b807..6e70ca9 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 699a61d..6a2b23c 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.7.4