[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master d48f4c3: Port to NetBSD tzalloc
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] master d48f4c3: Port to NetBSD tzalloc |
Date: |
Sun, 11 Mar 2018 04:22:13 -0400 (EDT) |
branch: master
commit d48f4c3be13f8894964dad160f98ff8a7c7c3561
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
Port to NetBSD tzalloc
Problem reported by Valery Ushakov (Bug#30738).
* src/editfns.c (xtzalloc): Remove.
(invalid_time_zone_specification): New function.
(tzlookup): Port to NetBSD, where tzalloc can fail when the TZ
string has an invalid value.
---
src/editfns.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/src/editfns.c b/src/editfns.c
index 3a34dd0..debe105 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -117,14 +117,10 @@ emacs_mktime_z (timezone_t tz, struct tm *tm)
return t;
}
-/* Allocate a timezone, signaling on failure. */
-static timezone_t
-xtzalloc (char const *name)
+static _Noreturn void
+invalid_time_zone_specification (Lisp_Object zone)
{
- timezone_t tz = tzalloc (name);
- if (!tz)
- memory_full (SIZE_MAX);
- return tz;
+ xsignal2 (Qerror, build_string ("Invalid time zone specification"), zone);
}
/* Free a timezone, except do not free the time zone for local time.
@@ -205,9 +201,15 @@ tzlookup (Lisp_Object zone, bool settz)
}
}
else
- xsignal2 (Qerror, build_string ("Invalid time zone specification"),
- zone);
- new_tz = xtzalloc (zone_string);
+ invalid_time_zone_specification (zone);
+
+ new_tz = tzalloc (zone_string);
+ if (!new_tz)
+ {
+ if (errno == ENOMEM)
+ memory_full (SIZE_MAX);
+ invalid_time_zone_specification (zone);
+ }
}
if (settz)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master d48f4c3: Port to NetBSD tzalloc,
Paul Eggert <=