diff options
| author | Michal Nazarewicz | 2016-08-03 03:08:48 +0200 |
|---|---|---|
| committer | Michal Nazarewicz | 2016-09-09 03:07:15 +0200 |
| commit | c579b28f6281c9cc0b711a012c30bf00036c60bf (patch) | |
| tree | c54b9270ab30dd18239e594b8aee6957162d12d9 /src/character.c | |
| parent | b1c4c0050057ca982cab28b8ad11b3175c3bb0d2 (diff) | |
| download | emacs-c579b28f6281c9cc0b711a012c30bf00036c60bf.tar.gz emacs-c579b28f6281c9cc0b711a012c30bf00036c60bf.zip | |
Replace decimalnump with alphanumericp
decimalnump was used in regex.c only in ISALNUM macro which ored it with
alphabeticp. Because both of those functions require Unicode general
category lookup, this resulted in unnecessary lookups (if alphabeticp
return false decimalp had to perform another lookup). Drop decimalnump
in favour of alphanumericp which combines decimelnump with alphabeticp.
* src/character.c (decimalnump): Remove in favour of…
(alphanumericp): …new function.
* src/regex.c (ISALNUM): Use alphanumericp.
Diffstat (limited to 'src/character.c')
| -rw-r--r-- | src/character.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/character.c b/src/character.c index 9f60aa718d5..b19e41d660a 100644 --- a/src/character.c +++ b/src/character.c | |||
| @@ -983,17 +983,26 @@ alphabeticp (int c) | |||
| 983 | || gen_cat == UNICODE_CATEGORY_Nl); | 983 | || gen_cat == UNICODE_CATEGORY_Nl); |
| 984 | } | 984 | } |
| 985 | 985 | ||
| 986 | /* Return true if C is a decimal-number character. */ | 986 | /* Return true if C is a alphabetic or decimal-number character. */ |
| 987 | bool | 987 | bool |
| 988 | decimalnump (int c) | 988 | alphanumericp (int c) |
| 989 | { | 989 | { |
| 990 | Lisp_Object category = CHAR_TABLE_REF (Vunicode_category_table, c); | 990 | Lisp_Object category = CHAR_TABLE_REF (Vunicode_category_table, c); |
| 991 | if (! INTEGERP (category)) | 991 | if (! INTEGERP (category)) |
| 992 | return false; | 992 | return false; |
| 993 | EMACS_INT gen_cat = XINT (category); | 993 | EMACS_INT gen_cat = XINT (category); |
| 994 | 994 | ||
| 995 | /* See UTS #18. */ | 995 | /* See UTS #18. Same comment as for alphabeticp applies. FIXME. */ |
| 996 | return gen_cat == UNICODE_CATEGORY_Nd; | 996 | return (gen_cat == UNICODE_CATEGORY_Lu |
| 997 | || gen_cat == UNICODE_CATEGORY_Ll | ||
| 998 | || gen_cat == UNICODE_CATEGORY_Lt | ||
| 999 | || gen_cat == UNICODE_CATEGORY_Lm | ||
| 1000 | || gen_cat == UNICODE_CATEGORY_Lo | ||
| 1001 | || gen_cat == UNICODE_CATEGORY_Mn | ||
| 1002 | || gen_cat == UNICODE_CATEGORY_Mc | ||
| 1003 | || gen_cat == UNICODE_CATEGORY_Me | ||
| 1004 | || gen_cat == UNICODE_CATEGORY_Nl | ||
| 1005 | || gen_cat == UNICODE_CATEGORY_Nd); | ||
| 997 | } | 1006 | } |
| 998 | 1007 | ||
| 999 | /* Return true if C is a graphic character. */ | 1008 | /* Return true if C is a graphic character. */ |