summaryrefslogtreecommitdiff
path: root/lib/time_rz.c
diff options
context:
space:
mode:
authorYuuki Harano <masm+github@masm11.me>2020-12-27 03:13:00 +0900
committerYuuki Harano <masm+github@masm11.me>2020-12-27 03:13:00 +0900
commitb64089c37b4305a511e5ddbf02746862c7c7575e (patch)
treec6978d471e4b0b061b7cc9c46147968379aec94f /lib/time_rz.c
parent565d8f57d349c19d9bbb5d5d5fdacf3c70b85d42 (diff)
parent4b2ca6bfc079c66cfcf39f2f36dc139012787535 (diff)
downloademacs-b64089c37b4305a511e5ddbf02746862c7c7575e.tar.gz
emacs-b64089c37b4305a511e5ddbf02746862c7c7575e.tar.bz2
emacs-b64089c37b4305a511e5ddbf02746862c7c7575e.zip
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs into feature/pgtk
Diffstat (limited to 'lib/time_rz.c')
-rw-r--r--lib/time_rz.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/lib/time_rz.c b/lib/time_rz.c
index 95438cf876e..8992c2e37e0 100644
--- a/lib/time_rz.c
+++ b/lib/time_rz.c
@@ -27,19 +27,15 @@
#include <time.h>
#include <errno.h>
-#include <limits.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include "flexmember.h"
+#include "idx.h"
#include "time-internal.h"
-#ifndef SIZE_MAX
-# define SIZE_MAX ((size_t) -1)
-#endif
-
/* The approximate size to use for small allocation requests. This is
the largest "small" request for the GNU C library malloc. */
enum { DEFAULT_MXFAST = 64 * sizeof (size_t) / 4 };
@@ -125,14 +121,8 @@ save_abbr (timezone_t tz, struct tm *tm)
{
if (! (*zone_copy || (zone_copy == tz->abbrs && tz->tz_is_set)))
{
- size_t zone_size = strlen (zone) + 1;
- size_t zone_used = zone_copy - tz->abbrs;
- if (SIZE_MAX - zone_used < zone_size)
- {
- errno = ENOMEM;
- return false;
- }
- if (zone_used + zone_size < ABBR_SIZE_MIN)
+ 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
{