From: Calvin Wan <calvinwan@google.com>
To: git@vger.kernel.org
Cc: Calvin Wan <calvinwan@google.com>,
phillip.wood123@gmail.com, jonathantanmy@google.com
Subject: [PATCH v5 4/6] kwset: move translation table from ctype
Date: Wed, 5 Jul 2023 17:09:22 +0000 [thread overview]
Message-ID: <20230705170924.3833828-4-calvinwan@google.com> (raw)
In-Reply-To: <20230705170812.3833103-1-calvinwan@google.com>
This table was originally introduced to solely be used with kwset
machinery (0f871cf56e), so it would make sense for it to belong in
kwset.[ch] rather than ctype.c and git-compat-util.h. It is only used in
diffcore-pickaxe.c, which already includes kwset.h so no other headers
have to be modified.
Signed-off-by: Calvin Wan <calvinwan@google.com>
---
ctype.c | 36 ------------------------------------
git-compat-util.h | 3 ---
kwset.c | 36 ++++++++++++++++++++++++++++++++++++
kwset.h | 2 ++
4 files changed, 38 insertions(+), 39 deletions(-)
diff --git a/ctype.c b/ctype.c
index fc0225cebd..3451745550 100644
--- a/ctype.c
+++ b/ctype.c
@@ -28,39 +28,3 @@ const unsigned char sane_ctype[256] = {
A, A, A, A, A, A, A, A, A, A, A, R, R, U, P, X, /* 112..127 */
/* Nothing in the 128.. range */
};
-
-/* For case-insensitive kwset */
-const unsigned char tolower_trans_tbl[256] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
- ' ', '!', '"', '#', '$', '%', '&', 0x27,
- '(', ')', '*', '+', ',', '-', '.', '/',
- '0', '1', '2', '3', '4', '5', '6', '7',
- '8', '9', ':', ';', '<', '=', '>', '?',
- '@', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
- 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
- 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
- 'x', 'y', 'z', '[', 0x5c, ']', '^', '_',
- '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
- 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
- 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
- 'x', 'y', 'z', '{', '|', '}', '~', 0x7f,
- 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
- 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
- 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
- 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
- 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
- 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
- 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
- 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
- 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
- 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
- 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
- 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
- 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
- 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
- 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
- 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
-};
diff --git a/git-compat-util.h b/git-compat-util.h
index 5f916e1094..1832444fa2 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -1152,9 +1152,6 @@ static inline size_t xsize_t(off_t len)
#define HOST_NAME_MAX 256
#endif
-/* in ctype.c, for kwset users */
-extern const unsigned char tolower_trans_tbl[256];
-
#include "sane-ctype.h"
/*
diff --git a/kwset.c b/kwset.c
index 4b14d4f86b..bbfcf815a5 100644
--- a/kwset.c
+++ b/kwset.c
@@ -49,6 +49,42 @@ static void *obstack_chunk_alloc(long size)
#define U(c) ((unsigned char) (c))
+/* For case-insensitive kwset */
+const unsigned char tolower_trans_tbl[256] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+ ' ', '!', '"', '#', '$', '%', '&', 0x27,
+ '(', ')', '*', '+', ',', '-', '.', '/',
+ '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', ':', ';', '<', '=', '>', '?',
+ '@', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
+ 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
+ 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
+ 'x', 'y', 'z', '[', 0x5c, ']', '^', '_',
+ '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
+ 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
+ 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
+ 'x', 'y', 'z', '{', '|', '}', '~', 0x7f,
+ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
+ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
+ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
+ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
+ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
+ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
+ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
+ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
+ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
+ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
+ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
+ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
+ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
+ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
+ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
+};
+
/* Balanced tree of edges and labels leaving a given trie node. */
struct tree
{
diff --git a/kwset.h b/kwset.h
index f50ecae573..d42a793a30 100644
--- a/kwset.h
+++ b/kwset.h
@@ -26,6 +26,8 @@
The author may be reached (Email) at the address mike@ai.mit.edu,
or (US mail) as Mike Haertel c/o Free Software Foundation. */
+extern const unsigned char tolower_trans_tbl[256];
+
struct kwsmatch
{
int index; /* Index number of matching keyword. */
--
2.41.0.255.g8b1d071c50-goog
next prev parent reply other threads:[~2023-07-05 17:10 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-16 17:09 [PATCH 0/6] git-compat-util cleanups Calvin Wan
2023-05-16 17:09 ` [PATCH 1/6] strbuf.h: move declarations for strbuf.c functions from git-compat-util.h Calvin Wan
2023-05-16 21:18 ` Junio C Hamano
2023-05-16 17:09 ` [PATCH 2/6] wrapper.h: move declarations for wrapper.c " Calvin Wan
2023-05-16 22:08 ` Junio C Hamano
2023-05-16 17:09 ` [PATCH 3/6] common.h: move non-compat specific macros and " Calvin Wan
2023-05-16 22:30 ` Junio C Hamano
2023-05-17 17:26 ` Calvin Wan
2023-05-16 17:09 ` [PATCH 4/6] usage.h: move declarations for usage.c " Calvin Wan
2023-05-16 17:09 ` [PATCH 5/6] treewide: remove unnecessary includes for wrapper.h Calvin Wan
2023-05-16 17:09 ` [PATCH 6/6] common: move alloc macros to common.h Calvin Wan
2023-05-16 17:54 ` [PATCH 0/6] git-compat-util cleanups Junio C Hamano
2023-05-16 19:00 ` Calvin Wan
2023-05-23 19:27 ` [PATCH v2 0/7] " Calvin Wan
2023-05-23 19:29 ` [PATCH v2 1/7] strbuf.h: move declarations for strbuf.c functions from git-compat-util.h Calvin Wan
2023-05-26 21:06 ` Jonathan Tan
2023-05-23 19:29 ` [PATCH v2 2/7] wrapper.h: move declarations for wrapper.c " Calvin Wan
2023-05-26 21:25 ` Jonathan Tan
2023-05-23 19:29 ` [PATCH v2 3/7] sane-ctype.h: move sane-ctype macros " Calvin Wan
2023-05-26 21:19 ` Jonathan Tan
2023-05-28 12:04 ` Phillip Wood
2023-05-30 17:29 ` Jonathan Tan
2023-06-01 4:12 ` Junio C Hamano
2023-05-23 19:29 ` [PATCH v2 4/7] common.h: move non-compat specific macros and functions " Calvin Wan
2023-05-23 19:29 ` [PATCH v2 5/7] usage.h: move declarations for usage.c " Calvin Wan
2023-05-23 19:29 ` [PATCH v2 6/7] treewide: remove unnecessary includes for wrapper.h Calvin Wan
2023-05-23 19:29 ` [PATCH v2 7/7] common: move alloc macros to common.h Calvin Wan
2023-05-26 21:27 ` Jonathan Tan
2023-05-26 21:03 ` [PATCH v2 0/7] git-compat-util cleanups Jonathan Tan
2023-06-06 17:07 ` [PATCH v3 0/8] " Calvin Wan
2023-06-06 17:09 ` [PATCH v3 1/8] git-compat-util: move strbuf.c funcs to its header Calvin Wan
2023-06-06 17:09 ` [PATCH v3 2/8] git-compat-util: move wrapper.c " Calvin Wan
2023-06-06 17:09 ` [PATCH v3 3/8] sane-ctype.h: create header for sane-ctype macros Calvin Wan
2023-06-06 17:09 ` [PATCH v3 4/8] kwset: move translation table from ctype Calvin Wan
2023-06-06 17:09 ` [PATCH v3 5/8] common.h: move non-compat specific macros and functions Calvin Wan
2023-06-06 22:45 ` Ramsay Jones
2023-06-07 17:02 ` Calvin Wan
2023-06-12 20:48 ` Junio C Hamano
2023-06-13 22:42 ` Calvin Wan
2023-06-13 23:10 ` Junio C Hamano
2023-06-14 1:58 ` Calvin Wan
2023-06-06 17:10 ` [PATCH v3 6/8] git-compat-util: move usage.c funcs to its header Calvin Wan
2023-06-06 17:10 ` [PATCH v3 7/8] treewide: remove unnecessary includes for wrapper.h Calvin Wan
2023-06-06 17:10 ` [PATCH v3 8/8] common: move alloc macros to common.h Calvin Wan
2023-06-30 20:22 ` [PATCH v4 0/6] git-compat-util cleanups Calvin Wan
2023-06-30 20:23 ` [PATCH v4 1/6] git-compat-util: move strbuf.c funcs to its header Calvin Wan
2023-06-30 20:23 ` [PATCH v4 2/6] git-compat-util: move wrapper.c " Calvin Wan
2023-06-30 20:23 ` [PATCH v4 3/6] sane-ctype.h: create header for sane-ctype macros Calvin Wan
2023-06-30 20:23 ` [PATCH v4 4/6] kwset: move translation table from ctype Calvin Wan
2023-06-30 20:23 ` [PATCH v4 5/6] treewide: remove unnecessary includes for wrapper.h Calvin Wan
2023-06-30 20:23 ` [PATCH v4 6/6] common: move alloc macros to common.h Calvin Wan
2023-06-30 22:49 ` Junio C Hamano
2023-07-05 16:25 ` Calvin Wan
2023-07-05 17:33 ` Junio C Hamano
2023-07-05 17:58 ` Calvin Wan
2023-06-30 21:56 ` [PATCH v4 0/6] git-compat-util cleanups Junio C Hamano
2023-07-05 17:08 ` [PATCH v5 " Calvin Wan
2023-07-05 17:09 ` [PATCH v5 1/6] git-compat-util: move strbuf.c funcs to its header Calvin Wan
2023-07-05 17:09 ` [PATCH v5 2/6] git-compat-util: move wrapper.c " Calvin Wan
2023-07-05 17:09 ` [PATCH v5 3/6] sane-ctype.h: create header for sane-ctype macros Calvin Wan
2023-07-05 17:09 ` Calvin Wan [this message]
2023-07-05 17:09 ` [PATCH v5 5/6] treewide: remove unnecessary includes for wrapper.h Calvin Wan
2023-07-05 17:09 ` [PATCH v5 6/6] git-compat-util: move alloc macros to git-compat-util.h Calvin Wan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230705170924.3833828-4-calvinwan@google.com \
--to=calvinwan@google.com \
--cc=git@vger.kernel.org \
--cc=jonathantanmy@google.com \
--cc=phillip.wood123@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).