diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2019-07-10 20:05:14 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2019-07-10 20:05:14 +0300 |
commit | 45f329477f5bc8b2259cf11b489095ac94b0a813 (patch) | |
tree | 9dea96aa8cbb144a3c8f093fbaf0a7bc478af08e | |
parent | a3e4314631601e98d63a9b702cb31931ec5222b3 (diff) | |
download | vmod-dbrw-45f329477f5bc8b2259cf11b489095ac94b0a813.tar.gz vmod-dbrw-45f329477f5bc8b2259cf11b489095ac94b0a813.tar.bz2 |
Use wordsplit for a submodule
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | Makefile.am | 3 | ||||
-rwxr-xr-x | bootstrap | 2 | ||||
-rw-r--r-- | src/Makefile.am | 12 | ||||
-rw-r--r-- | src/wordsplit.c | 2546 | ||||
-rw-r--r-- | src/wordsplit.h | 271 | ||||
-rw-r--r-- | tests/Makefile.am | 6 | ||||
m--------- | wordsplit | 0 |
8 files changed, 20 insertions, 2823 deletions
diff --git a/.gitmodules b/.gitmodules index 00ae21c..6f6db00 100644 --- a/.gitmodules +++ b/.gitmodules | |||
@@ -1,3 +1,6 @@ | |||
1 | [submodule "acvmod"] | 1 | [submodule "acvmod"] |
2 | path = acvmod | 2 | path = acvmod |
3 | url = git://git.gnu.org.ua/acvmod.git | 3 | url = git://git.gnu.org.ua/acvmod.git |
4 | [submodule "wordsplit"] | ||
5 | path = wordsplit | ||
6 | url = git://git.gnu.org.ua/wordsplit.git | ||
diff --git a/Makefile.am b/Makefile.am index a5248b8..df797dd 100644 --- a/Makefile.am +++ b/Makefile.am | |||
@@ -1,21 +1,22 @@ | |||
1 | # This file is part of vmod-dbrw | 1 | # This file is part of vmod-dbrw |
2 | # Copyright (C) 2013-2017 Sergey Poznyakoff | 2 | # Copyright (C) 2013-2019 Sergey Poznyakoff |
3 | # | 3 | # |
4 | # Vmod-dbrw is free software; you can redistribute it and/or modify | 4 | # Vmod-dbrw is free software; you can redistribute it and/or modify |
5 | # it under the terms of the GNU General Public License as published by | 5 | # it under the terms of the GNU General Public License as published by |
6 | # the Free Software Foundation; either version 3, or (at your option) | 6 | # the Free Software Foundation; either version 3, or (at your option) |
7 | # any later version. | 7 | # any later version. |
8 | # | 8 | # |
9 | # Vmod-dbrw is distributed in the hope that it will be useful, | 9 | # Vmod-dbrw is distributed in the hope that it will be useful, |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | # GNU General Public License for more details. | 12 | # GNU General Public License for more details. |
13 | # | 13 | # |
14 | # You should have received a copy of the GNU General Public License | 14 | # You should have received a copy of the GNU General Public License |
15 | # along with vmod-dbrw. If not, see <http://www.gnu.org/licenses/>. | 15 | # along with vmod-dbrw. If not, see <http://www.gnu.org/licenses/>. |
16 | ACLOCAL_AMFLAGS = -I m4 -I acvmod | 16 | ACLOCAL_AMFLAGS = -I m4 -I acvmod |
17 | 17 | ||
18 | SUBDIRS = src doc tests | 18 | SUBDIRS = src doc tests |
19 | 19 | ||
20 | include acvmod/top.am | 20 | include acvmod/top.am |
21 | 21 | ||
22 | EXTRA_DIST += wordsplit/wordsplit.c wordsplit/wordsplit.h | ||
@@ -1,9 +1,9 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | for dir in m4 build-aux | 2 | for dir in m4 build-aux |
3 | do | 3 | do |
4 | test -d $dir || mkdir $dir | 4 | test -d $dir || mkdir $dir |
5 | done | 5 | done |
6 | git submodule init | 6 | git submodule init |
7 | git submodule update | 7 | git submodule update --init --recursive |
8 | test -f ChangeLog || touch ChangeLog | 8 | test -f ChangeLog || touch ChangeLog |
9 | autoreconf -f -i -s | 9 | autoreconf -f -i -s |
diff --git a/src/Makefile.am b/src/Makefile.am index 6cda3aa..2f23477 100644 --- a/src/Makefile.am +++ b/src/Makefile.am | |||
@@ -1,36 +1,42 @@ | |||
1 | # This file is part of vmod-dbrw | 1 | # This file is part of vmod-dbrw |
2 | # Copyright (C) 2013-2017 Sergey Poznyakoff | 2 | # Copyright (C) 2013-2019 Sergey Poznyakoff |
3 | # | 3 | # |
4 | # Vmod-dbrw is free software; you can redistribute it and/or modify | 4 | # Vmod-dbrw is free software; you can redistribute it and/or modify |
5 | # it under the terms of the GNU General Public License as published by | 5 | # it under the terms of the GNU General Public License as published by |
6 | # the Free Software Foundation; either version 3, or (at your option) | 6 | # the Free Software Foundation; either version 3, or (at your option) |
7 | # any later version. | 7 | # any later version. |
8 | # | 8 | # |
9 | # Vmod-dbrw is distributed in the hope that it will be useful, | 9 | # Vmod-dbrw is distributed in the hope that it will be useful, |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | # GNU General Public License for more details. | 12 | # GNU General Public License for more details. |
13 | # | 13 | # |
14 | # You should have received a copy of the GNU General Public License | 14 | # You should have received a copy of the GNU General Public License |
15 | # along with vmod-dbrw. If not, see <http://www.gnu.org/licenses/>. | 15 | # along with vmod-dbrw. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 | ||
17 | AM_CPPFLAGS=$(VARNISHAPI_CFLAGS) -I$(srcdir) -I$(builddir) | 17 | AM_CPPFLAGS=\ |
18 | $(VARNISHAPI_CFLAGS)\ | ||
19 | -I$(srcdir)\ | ||
20 | -I$(builddir)\ | ||
21 | -I$(top_srcdir)/wordsplit | ||
18 | noinst_LTLIBRARIES = libsql.la | 22 | noinst_LTLIBRARIES = libsql.la |
19 | libsql_la_SOURCES = \ | 23 | libsql_la_SOURCES = \ |
20 | be.c\ | 24 | be.c\ |
21 | dbrw.h\ | 25 | dbrw.h\ |
22 | sql.c\ | 26 | sql.c |
27 | nodist_libsql_la_SOURCES = \ | ||
23 | wordsplit.h\ | 28 | wordsplit.h\ |
24 | wordsplit.c | 29 | wordsplit.c |
30 | VPATH += $(top_srcdir)/wordsplit | ||
25 | 31 | ||
26 | if USE_MYSQL | 32 | if USE_MYSQL |
27 | libsql_la_SOURCES += mysql.c | 33 | libsql_la_SOURCES += mysql.c |
28 | endif | 34 | endif |
29 | 35 | ||
30 | if USE_PGSQL | 36 | if USE_PGSQL |
31 | libsql_la_SOURCES += pgsql.c | 37 | libsql_la_SOURCES += pgsql.c |
32 | endif | 38 | endif |
33 | 39 | ||
34 | libsql_la_LIBADD=@MYSQLLIBS@ @PGSQLLIBS@ | 40 | libsql_la_LIBADD=@MYSQLLIBS@ @PGSQLLIBS@ |
35 | 41 | ||
36 | vmoddir = $(VMODDIR) | 42 | vmoddir = $(VMODDIR) |
diff --git a/src/wordsplit.c b/src/wordsplit.c deleted file mode 100644 index bad59b1..0000000 --- a/src/wordsplit.c +++ /dev/null | |||
@@ -1,2546 +0,0 @@ | |||
1 | /* wordsplit - a word splitter | ||
2 | Copyright (C) 2009-2018 Sergey Poznyakoff | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify it | ||
5 | under the terms of the GNU General Public License as published by the | ||
6 | Free Software Foundation; either version 3 of the License, or (at your | ||
7 | option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License along | ||
15 | with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
16 | |||
17 | #ifdef HAVE_CONFIG_H | ||
18 | # include <config.h> | ||
19 | #endif | ||
20 | |||
21 | #include <errno.h> | ||
22 | #include <ctype.h> | ||
23 | #include <unistd.h> | ||
24 | #include <stdlib.h> | ||
25 | #include <string.h> | ||
26 | #include <stdio.h> | ||
27 | #include <stdarg.h> | ||
28 | #include <pwd.h> | ||
29 | #include <glob.h> | ||
30 | |||
31 | #if ENABLE_NLS | ||
32 | # include <gettext.h> | ||
33 | #else | ||
34 | # define gettext(msgid) msgid | ||
35 | #endif | ||
36 | #define _(msgid) gettext (msgid) | ||
37 | #define N_(msgid) msgid | ||
38 | |||
39 | #include <wordsplit.h> | ||
40 | |||
41 | #define ISWS(c) ((c)==' '||(c)=='\t'||(c)=='\n') | ||
42 | #define ISDELIM(ws,c) \ | ||
43 | (strchr ((ws)->ws_delim, (c)) != NULL) | ||
44 | #define ISPUNCT(c) (strchr("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",(c))!=NULL) | ||
45 | #define ISUPPER(c) ('A' <= ((unsigned) (c)) && ((unsigned) (c)) <= 'Z') | ||
46 | #define ISLOWER(c) ('a' <= ((unsigned) (c)) && ((unsigned) (c)) <= 'z') | ||
47 | #define ISALPHA(c) (ISUPPER(c) || ISLOWER(c)) | ||
48 | #define ISDIGIT(c) ('0' <= ((unsigned) (c)) && ((unsigned) (c)) <= '9') | ||
49 | #define ISXDIGIT(c) (strchr("abcdefABCDEF", c)!=NULL) | ||
50 | #define ISALNUM(c) (ISALPHA(c) || ISDIGIT(c)) | ||
51 | #define ISPRINT(c) (' ' <= ((unsigned) (c)) && ((unsigned) (c)) <= 127) | ||
52 | |||
53 | #define ISVARBEG(c) (ISALPHA(c) || c == '_') | ||
54 | #define ISVARCHR(c) (ISALNUM(c) || c == '_') | ||
55 | |||
56 | #define WSP_RETURN_DELIMS(wsp) \ | ||
57 | ((wsp)->ws_flags & WRDSF_RETURN_DELIMS || ((wsp)->ws_options & WRDSO_MAXWORDS)) | ||
58 | |||
59 | #define ALLOC_INIT 128 | ||
60 | #define ALLOC_INCR 128 | ||
61 | |||
62 | static void | ||
63 | _wsplt_alloc_die (struct wordsplit *wsp) | ||
64 | { | ||
65 | wsp->ws_error ("%s", _("memory exhausted")); | ||
66 | abort (); | ||
67 | } | ||
68 | |||
69 | static void | ||
70 | _wsplt_error (const char *fmt, ...) | ||
71 | { | ||
72 | va_list ap; | ||
73 | |||
74 | va_start (ap, fmt); | ||
75 | vfprintf (stderr, fmt, ap); | ||
76 | va_end (ap); | ||
77 | fputc ('\n', stderr); | ||
78 | } | ||
79 | |||
80 | static void wordsplit_free_nodes (struct wordsplit *); | ||
81 | |||
82 | static int | ||
83 | _wsplt_seterr (struct wordsplit *wsp, int ec) | ||
84 | { | ||
85 | wsp->ws_errno = ec; | ||
86 | if (wsp->ws_flags & WRDSF_SHOWERR) | ||
87 | wordsplit_perror (wsp); | ||
88 | return ec; | ||
89 | } | ||
90 | |||
91 | static int | ||
92 | _wsplt_nomem (struct wordsplit *wsp) | ||
93 | { | ||
94 | errno = ENOMEM; | ||
95 | wsp->ws_errno = WRDSE_NOSPACE; | ||
96 | if (wsp->ws_flags & WRDSF_ENOMEMABRT) | ||
97 | wsp->ws_alloc_die (wsp); | ||
98 | if (wsp->ws_flags & WRDSF_SHOWERR) | ||
99 | wordsplit_perror (wsp); | ||
100 | if (!(wsp->ws_flags & WRDSF_REUSE)) | ||
101 | wordsplit_free (wsp); | ||
102 | wordsplit_free_nodes (wsp); | ||
103 | return wsp->ws_errno; | ||
104 | } | ||
105 | |||