summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org>2015-10-28 05:45:17 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2015-12-17 13:26:56 (GMT)
commitd51a70af75b14720a1756d90ec53132596aa3ebf (patch) (side-by-side diff)
treefc4ad5f29e4bd481713ae652caa4e37f6e5cdff6
parenta1760108b8a85e4bcb1704737fb5beb7dd14755f (diff)
downloadgrecs-d51a70af75b14720a1756d90ec53132596aa3ebf.tar.gz
grecs-d51a70af75b14720a1756d90ec53132596aa3ebf.tar.bz2
Minor improvement in wordsplit.
* src/wordsplit.h (WRDSX_WORD, WRDSX_QUOTE): New defines. * src/wordsplit.c: Use them when initializing ws_escape.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--src/wordsplit.c16
-rw-r--r--src/wordsplit.h4
2 files changed, 12 insertions, 8 deletions
diff --git a/src/wordsplit.c b/src/wordsplit.c
index 355373e..86d4f4b 100644
--- a/src/wordsplit.c
+++ b/src/wordsplit.c
@@ -241,6 +241,6 @@ wordsplit_init (struct wordsplit *wsp, const char *input, size_t len,
{
- if (!wsp->ws_escape[0])
- wsp->ws_escape[0] = "";
- if (!wsp->ws_escape[1])
- wsp->ws_escape[1] = "";
+ if (!wsp->ws_escape[WRDSX_WORD])
+ wsp->ws_escape[WRDSX_WORD] = "";
+ if (!wsp->ws_escape[WRDSX_QUOTE])
+ wsp->ws_escape[WRDSX_QUOTE] = "";
}
@@ -250,4 +250,4 @@ wordsplit_init (struct wordsplit *wsp, const char *input, size_t len,
{
- wsp->ws_escape[0] = wordsplit_c_escape_tab;
- wsp->ws_escape[1] = wordsplit_c_escape_tab;
+ wsp->ws_escape[WRDSX_WORD] = wordsplit_c_escape_tab;
+ wsp->ws_escape[WRDSX_QUOTE] = wordsplit_c_escape_tab;
wsp->ws_options |= WRDSO_OESC_QUOTE | WRDSO_OESC_WORD
@@ -257,4 +257,4 @@ wordsplit_init (struct wordsplit *wsp, const char *input, size_t len,
{
- wsp->ws_escape[0] = "";
- wsp->ws_escape[1] = "\\\\\"\"";
+ wsp->ws_escape[WRDSX_WORD] = "";
+ wsp->ws_escape[WRDSX_QUOTE] = "\\\\\"\"";
wsp->ws_options |= WRDSO_BSKEEP_QUOTE;
diff --git a/src/wordsplit.h b/src/wordsplit.h
index e7df8bb..53503a4 100644
--- a/src/wordsplit.h
+++ b/src/wordsplit.h
@@ -211,2 +211,6 @@ struct wordsplit
+/* Indices into ws_escape */
+#define WRDSX_WORD 0
+#define WRDSX_QUOTE 1
+
/* Set escape option F in WS for words (Q==0) or quoted strings (Q==1) */

Return to:

Send suggestions and report system problems to the System administrator.