tmparse: remove incorrect isalpha definition

Checking the range of c|0x60 incorrectly classifies many characters
as alphabetic (digits, control characters 0x01-0x20, and punctuation
characters '!'-':'). This prevents tmparse from parsing dates with
a timezone bounded by those characters (for example, "12:11:56 (PDT)").

Instead, just reuse the isalpha macro provided by ctype.h.
This commit is contained in:
Michael Forney 2022-05-26 20:23:11 +00:00 committed by xfnw
parent 24e5308c2a
commit 9b19835bd4

View file

@ -1,5 +1,6 @@
#include <u.h>
#include <libc.h>
#include <ctype.h>
typedef struct Tzabbrev Tzabbrev;
typedef struct Tzoffpair Tzoffpair;
@ -62,9 +63,6 @@ struct Tzoffpair {
int off;
};
#define isalpha(c)\
(((c)|0x60) >= 'a' && ((c)|0x60) <= 'z')
/* Obsolete time zone names. Hardcoded to match RFC5322 */
static Tzabbrev tzabbrev[] = {
{"UT", "GMT"}, {"GMT", "GMT"}, {"UTC", "GMT"},