summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bootstrap2
-rw-r--r--.bzrignore11
-rw-r--r--ChangeLog7
-rw-r--r--Makefile.am39
-rw-r--r--README.FIRST2
-rwxr-xr-xbootstrap.sh1355
-rw-r--r--clients/execute.cc2
-rw-r--r--clients/generator.cc2
-rw-r--r--clients/memaslap.c12
-rw-r--r--clients/memcapable.cc2
-rw-r--r--clients/memcat.cc2
-rw-r--r--clients/memcp.cc2
-rw-r--r--clients/memdump.cc2
-rw-r--r--clients/memerror.cc2
-rw-r--r--clients/memexist.cc2
-rw-r--r--clients/memflush.cc2
-rw-r--r--clients/memparse.cc2
-rw-r--r--clients/memping.cc2
-rw-r--r--clients/memrm.cc2
-rw-r--r--clients/memslap.cc2
-rw-r--r--clients/memstat.cc2
-rw-r--r--clients/memtouch.cc2
-rw-r--r--clients/ms_conn.c13
-rw-r--r--clients/ms_task.c12
-rw-r--r--clients/ms_thread.c12
-rw-r--r--clients/utilities.cc2
-rw-r--r--clients/utilities.h12
-rw-r--r--configure.ac225
-rw-r--r--docs/include.am10
-rw-r--r--libhashkit-1.0/algorithm.h40
-rw-r--r--libhashkit-1.0/basic_string.h4
-rw-r--r--libhashkit-1.0/behavior.h43
-rw-r--r--libhashkit-1.0/configure.h.in44
-rw-r--r--libhashkit-1.0/digest.h43
-rw-r--r--libhashkit-1.0/function.h42
-rw-r--r--libhashkit-1.0/has.h8
-rw-r--r--libhashkit-1.0/hashkit.h5
-rw-r--r--libhashkit-1.0/hashkit.hpp7
-rw-r--r--libhashkit-1.0/strerror.h40
-rw-r--r--libhashkit-1.0/string.h4
-rw-r--r--libhashkit-1.0/types.h6
-rw-r--r--libhashkit/algorithm.cc2
-rw-r--r--libhashkit/behavior.cc39
-rw-r--r--libhashkit/common.h10
-rw-r--r--libhashkit/crc32.cc36
-rw-r--r--libhashkit/digest.cc39
-rw-r--r--libhashkit/fnv_32.cc2
-rw-r--r--libhashkit/fnv_64.cc2
-rw-r--r--libhashkit/has.cc6
-rw-r--r--libhashkit/hashkit.cc40
-rw-r--r--libhashkit/hsieh.cc37
-rw-r--r--libhashkit/jenkins.cc37
-rw-r--r--libhashkit/ketama.cc40
-rw-r--r--libhashkit/md5.cc37
-rw-r--r--libhashkit/murmur.cc37
-rw-r--r--libhashkit/one_at_a_time.cc40
-rw-r--r--libhashkit/rijndael.cc37
-rw-r--r--libhashkit/strerror.cc41
-rw-r--r--libhashkit/string.h2
-rw-r--r--libmemcached-1.2/platform.h20
-rw-r--r--libmemcached-1.2/return.h1
-rw-r--r--libmemcached-1.2/struct/server.h12
-rw-r--r--libmemcached/assert.hpp3
-rw-r--r--libmemcached/backtrace.cc4
-rw-r--r--libmemcached/behavior.cc4
-rw-r--r--libmemcached/byteorder.cc21
-rw-r--r--libmemcached/byteorder.h2
-rw-r--r--libmemcached/common.h78
-rw-r--r--libmemcached/connect.cc34
-rw-r--r--libmemcached/csl/include.am20
-rw-r--r--libmemcached/csl/parser.am16
-rw-r--r--libmemcached/csl/parser.cc2426
-rw-r--r--libmemcached/csl/parser.h123
-rw-r--r--libmemcached/csl/parser.yy14
-rw-r--r--libmemcached/csl/scanner.cc2935
-rw-r--r--libmemcached/csl/scanner.h375
-rw-r--r--libmemcached/csl/scanner.l11
-rw-r--r--libmemcached/csl/server.h5
-rw-r--r--libmemcached/do.cc4
-rw-r--r--libmemcached/error.cc19
-rw-r--r--libmemcached/instance.h12
-rw-r--r--libmemcached/io.cc2
-rw-r--r--libmemcached/memory.h2
-rw-r--r--libmemcached/response.cc12
-rw-r--r--libmemcached/server.hpp4
-rw-r--r--libmemcached/server_list.cc8
-rw-r--r--libmemcached/socket.hpp22
-rw-r--r--libmemcachedutil/common.h6
-rw-r--r--libtest/alarm.cc85
-rw-r--r--libtest/alarm.h46
-rw-r--r--libtest/binaries.cc2
-rw-r--r--libtest/blobslap_worker.cc2
-rw-r--r--libtest/client.cc301
-rw-r--r--libtest/client.hpp77
-rw-r--r--libtest/cmdline.cc318
-rw-r--r--libtest/cmdline.h32
-rw-r--r--libtest/collection.cc12
-rw-r--r--libtest/common.h27
-rw-r--r--libtest/comparison.cc12
-rw-r--r--libtest/comparison.hpp6
-rw-r--r--libtest/core.cc2
-rw-r--r--libtest/core_count.cc135
-rw-r--r--libtest/cpu.cc4
-rw-r--r--libtest/dns.cc2
-rw-r--r--libtest/dream.cc2
-rw-r--r--libtest/drizzled.cc2
-rw-r--r--libtest/failed.cc2
-rw-r--r--libtest/fatal.cc49
-rw-r--r--libtest/fatal.hpp89
-rw-r--r--libtest/formatter.cc2
-rw-r--r--libtest/framework.cc7
-rw-r--r--libtest/gearmand.cc34
-rw-r--r--libtest/gearmand.h2
-rw-r--r--libtest/has.cc12
-rw-r--r--libtest/http.cc21
-rw-r--r--libtest/include.am30
-rw-r--r--libtest/is_local.cc2
-rw-r--r--libtest/killpid.cc35
-rw-r--r--libtest/libtool.cc2
-rw-r--r--libtest/main.cc7
-rw-r--r--libtest/memcached.cc220
-rw-r--r--libtest/memcached.hpp6
-rw-r--r--libtest/port.cc77
-rw-r--r--libtest/runner.cc2
-rw-r--r--libtest/server.cc101
-rw-r--r--libtest/server.h2
-rw-r--r--libtest/server_container.cc76
-rw-r--r--libtest/signal.cc34
-rw-r--r--libtest/signal.h1
-rw-r--r--libtest/skiptest.cc2
-rw-r--r--libtest/socket.cc2
-rw-r--r--libtest/strerror.cc2
-rw-r--r--libtest/test.hpp13
-rw-r--r--libtest/timer.cc2
-rw-r--r--libtest/timer.hpp19
-rw-r--r--libtest/unittest.cc178
-rw-r--r--libtest/vchar.cc2
-rw-r--r--libtest/wait.cc2
-rw-r--r--m4/ax_assert.m418
-rw-r--r--m4/ax_compiler_vendor.m42
-rw-r--r--m4/ax_compiler_version.m476
-rw-r--r--m4/ax_debug.m414
-rw-r--r--m4/ax_endian.m42
-rw-r--r--m4/ax_harden_compiler_flags.m4378
-rw-r--r--m4/ax_hex_version.m45
-rw-r--r--m4/ax_libevent.m4125
-rw-r--r--m4/ax_libmemcached.m455
-rw-r--r--m4/ax_platform.m451
-rw-r--r--m4/ax_prog_sphinx_build.m439
-rw-r--r--m4/ax_pthread.m42
-rw-r--r--m4/ax_pthread_timedjoin_np.m455
-rw-r--r--m4/ax_uuid.m479
-rw-r--r--m4/ax_vcs_checkout.m433
-rw-r--r--m4/have_cinttypes.m46
-rw-r--r--m4/have_cstdint.m410
-rw-r--r--m4/socket_send_flags.m419
-rw-r--r--man/include.am246
-rw-r--r--poll/poll.c8
-rw-r--r--support/libmemcached.spec.in10
-rw-r--r--tests/cpp_example.cc2
-rw-r--r--tests/cycle.cc10
-rw-r--r--tests/failure.cc2
-rw-r--r--tests/hash_plus.cc2
-rw-r--r--tests/hashkit_functions.cc2
-rw-r--r--tests/libmemcached-1.0/all_tests.cc2
-rw-r--r--tests/libmemcached-1.0/all_tests.h2
-rw-r--r--tests/libmemcached-1.0/all_tests_socket.cc2
-rw-r--r--tests/libmemcached-1.0/atomsmasher.cc2
-rw-r--r--tests/libmemcached-1.0/basic.cc2
-rw-r--r--tests/libmemcached-1.0/callback_counter.cc2
-rw-r--r--tests/libmemcached-1.0/callbacks.cc2
-rw-r--r--tests/libmemcached-1.0/debug.cc2
-rw-r--r--tests/libmemcached-1.0/deprecated.cc2
-rw-r--r--tests/libmemcached-1.0/dump.cc2
-rw-r--r--tests/libmemcached-1.0/encoding_key.cc2
-rw-r--r--tests/libmemcached-1.0/error_conditions.cc2
-rw-r--r--tests/libmemcached-1.0/exist.cc2
-rw-r--r--tests/libmemcached-1.0/fetch_all_results.cc2
-rw-r--r--tests/libmemcached-1.0/generate.cc2
-rw-r--r--tests/libmemcached-1.0/haldenbrand.cc2
-rw-r--r--tests/libmemcached-1.0/include.am3
-rw-r--r--tests/libmemcached-1.0/internals.cc2
-rw-r--r--tests/libmemcached-1.0/ketama.cc2
-rw-r--r--tests/libmemcached-1.0/mem_functions.cc58
-rw-r--r--tests/libmemcached-1.0/mem_functions.h2
-rw-r--r--tests/libmemcached-1.0/memcached_fetch_execute.cc2
-rw-r--r--tests/libmemcached-1.0/memcached_get.cc2
-rw-r--r--tests/libmemcached-1.0/namespace.cc2
-rw-r--r--tests/libmemcached-1.0/parser.cc2
-rw-r--r--tests/libmemcached-1.0/plus.cpp2
-rw-r--r--tests/libmemcached-1.0/pool.cc2
-rw-r--r--tests/libmemcached-1.0/print.cc2
-rw-r--r--tests/libmemcached-1.0/replication.cc2
-rw-r--r--tests/libmemcached-1.0/sasl.cc2
-rw-r--r--tests/libmemcached-1.0/server_add.cc2
-rw-r--r--tests/libmemcached-1.0/setup_and_teardowns.cc2
-rw-r--r--tests/libmemcached-1.0/stat.cc2
-rw-r--r--tests/libmemcached-1.0/string.cc2
-rw-r--r--tests/libmemcached-1.0/touch.cc2
-rw-r--r--tests/libmemcached-1.0/virtual_buckets.cc2
-rw-r--r--tests/mem_udp.cc2
-rw-r--r--tests/memcapable.cc2
-rw-r--r--tests/memcat.cc2
-rw-r--r--tests/memcp.cc2
-rw-r--r--tests/memdump.cc7
-rw-r--r--tests/memerror.cc2
-rw-r--r--tests/memexist.cc2
-rw-r--r--tests/memflush.cc2
-rw-r--r--tests/memrm.cc2
-rw-r--r--tests/memslap.cc2
-rw-r--r--tests/memstat.cc2
-rw-r--r--tests/memtouch.cc2
-rw-r--r--tests/parser.cc2
-rw-r--r--util/daemon.cc2
-rw-r--r--util/instance.cc2
-rw-r--r--util/instance.hpp1
-rw-r--r--util/operation.cc2
-rw-r--r--util/signal.cc2
-rw-r--r--win32/wrappers.h43
219 files changed, 4367 insertions, 7907 deletions
diff --git a/.bootstrap b/.bootstrap
new file mode 100644
index 00000000..44b21cff
--- /dev/null
+++ b/.bootstrap
@@ -0,0 +1,2 @@
+BOOTSTRAP_SNAPSHOT=true
+BOOTSTRAP_SNAPSHOT_CHECK="man/memcached.3"
diff --git a/.bzrignore b/.bzrignore
index c89c1351..f2921e1d 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -1,6 +1,3 @@
-*.BASE
-*.OTHER
-*.THIS
*.exe
*.gz
*.lo
@@ -49,9 +46,9 @@ clients/memrm
clients/memslap
clients/memstat
clients/memtouch
-config.h
-config.h.in
-config.in
+mem_config.h
+mem_config.h.in
+mem_config.in
config.log
config.status
config/compile
@@ -63,7 +60,6 @@ config/ltmain.sh
config/missing
config/pandora_vc_revinfo
config/top.h
-configure
configure.scan
docs/*.[13]
docs/*.html
@@ -91,7 +87,6 @@ libtest/unittest
libtest/version.h
libtest/wait
libtool
-m4/.git
m4/libtool.m4
m4/libtool.m4
m4/ltoptions.m4
diff --git a/ChangeLog b/ChangeLog
index aa679851..bdcd68b3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,13 @@
1.1.0
* Enable MEMCACHED_BEHAVIOR_VERIFY_KEY by default
+1.0.14
+* CLIENT_ERROR fixed to not be treated as a fatal error.
+* Compiler fixes for older Ubuntu releases.
+
+1.0.13 Fri Oct 19 00:09:28 EDT 2012
+* Fix bug that caused version string to not be exported correctly.
+
1.0.12 Tue Oct 9 03:30:20 EDT 2012
* Added memcached_result_take_value().
* Added ax_libmemcached.m4
diff --git a/Makefile.am b/Makefile.am
index 0ad054e8..31052930 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
# vim:ft=automake
-ACLOCAL_AMFLAGS = -I m4 -I libtest/m4 --install -Wall -Werror
+ACLOCAL_AMFLAGS = -I m4 -I libtest/m4
# includes append to these:
SUFFIXES =
@@ -20,13 +20,14 @@ check_PROGRAMS =
EXTRA_HEADERS =
BUILT_SOURCES=
EXTRA_DIST=
+dist_man_MANS=
+MAINTAINERCLEANFILES=
#includes additional rules from aminclude.am
@INC_AMINCLUDE@
DISTCLEANFILES+= aminclude.am
-EXTRA_DIST+= ${srcdir}/m4/pandora_*.m4
EXTRA_DIST+= .quickly
EXTRA_DIST+= README.FIRST
EXTRA_DIST+= README.win32
@@ -59,8 +60,6 @@ include m4/include.am
TESTS += ${check_PROGRAMS}
-EXTRA_DIST+= ${man_MANS}
-
merge-clean:
@find ./ | $(GREP) \.gcda | xargs rm -f
@find ./ | $(GREP) \.gcno | xargs rm -f
@@ -95,6 +94,36 @@ lcov-clean: clean
DISTCLEANFILES+= config/top.h
+clean-local: clean-libtest-check clean-docs-check
+
+maintainer-clean-local:
+ find . -type f -name '*~' -exec rm -f '{}' \;
+ -rm -f @PACKAGE@-*.rpm
+ -rm -f @PACKAGE@-*.tar.gz
+ -rm -f man/*.1
+ -rm -f man/*.3
+ -rm -f man/*.8
+ -rm -rf man/.doctrees/
+ -rm -f Makefile.in
+ -rm -f aclocal.m4
+ -rm -f build-aux/compile
+ -rm -f build-aux/config.guess
+ -rm -f build-aux/config.sub
+ -rm -f build-aux/depcomp
+ -rm -f build-aux/install-sh
+ -rm -f build-aux/ltmain.sh
+ -rm -f build-aux/missing
+ -rm -f mem_config.in
+ -rm -f config.log
+ -rm -f config.status
+ -rm -f configure
+ -rm -f m4/libtool.m4
+ -rm -f m4/ltoptions.m4
+ -rm -f m4/ltsugar.m4
+ -rm -f m4/ltversion.m4
+ -rm -f m4/lt~obsolete.m4
+ -rmdir build-aux
+
install-website: html-local
- @rm -r -f /var/www/libmemcached/*
+ -rm -r -f /var/www/libmemcached/*
@cp -r docs/html /var/www/libmemcached
diff --git a/README.FIRST b/README.FIRST
index d7282df3..7c93b9b5 100644
--- a/README.FIRST
+++ b/README.FIRST
@@ -11,7 +11,7 @@ bzr branch lp:libmemcached
Once the tree is cloned you will need to build the "configure" script. You
can do this by running the script:
-./config/autorun.sh
+./bootstrap.sh autoreconf
It will set up all of the files you need to build libmemcached. At that
point it is just the typical "./configure; make; make test; make install"
diff --git a/bootstrap.sh b/bootstrap.sh
index b6da38cd..d822e592 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -31,393 +31,1288 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-die() { echo "$@"; exit 1; }
-command_exists () {
+# Environment Variables that will influence the build:
+# AUTOMAKE
+# AUTORECONF
+# LIBTOOLIZE
+# MAKE
+# PREFIX
+# TESTS_ENVIRONMENT
+# VERBOSE
+# WARNINGS
+#
+
+command_not_found_handle ()
+{
+ echo "Command not found: '$@'"
+ exit 127
+}
+
+function die ()
+{
+ echo "$BASH_SOURCE:$BASH_LINENO: $@" >&2
+ exit 1;
+}
+
+function nassert ()
+{
+ local param_name=\$"$1"
+ local param_value=`eval "expr \"$param_name\" "`
+
+ if [ -n "$param_value" ]; then
+ echo "$bash_source:$bash_lineno: assert($param_name) had value of "$param_value"" >&2
+ exit 1
+ fi
+}
+
+function assert ()
+{
+ local param_name=\$"$1"
+ local param_value=`eval "expr \"$param_name\" "`
+
+ if [ -z "$param_value" ]; then
+ echo "$bash_source:$bash_lineno: assert($param_name)" >&2
+ exit 1
+ fi
+}
+
+assert_file ()
+{
+ if [ ! -f "$1" ]; then
+ echo "$BASH_SOURCE:$BASH_LINENO: assert($1) does not exist: $2" >&2
+ exit 1;
+ fi
+}
+
+assert_no_file ()
+{
+ if [ -f "$1" ]; then
+ echo "$BASH_SOURCE:$BASH_LINENO: assert($1) file exists: $2" >&2
+ exit 1;
+ fi
+}
+
+assert_exec_file ()
+{
+ if [ ! -f "$1" ]; then
+ echo "$BASH_SOURCE:$BASH_LINENO: assert($1) does not exist: $2" >&2
+ exit 1;
+ fi
+
+ if [ ! -x "$1" ]; then
+ echo "$BASH_SOURCE:$BASH_LINENO: assert($1) exists but is not executable: $2" >&2
+ exit 1;
+ fi
+}
+
+command_exists ()
+{
type "$1" &> /dev/null ;
}
-determine_target_platform () {
- if [ $(uname) = "Darwin" ]; then
- PLATFORM="darwin"
- elif [[ -f "/etc/fedora-release" ]]; then
- PLATFORM="fedora"
- elif [[ -f "/etc/lsb-release" ]]; then
- debian_version=`cat /etc/lsb-release | grep DISTRIB_CODENAME | awk -F= ' { print $2 } '`
- case $debian_version in
- precise)
- PLATFORM="precise"
- ;;
- *)
- ;;
- esac
+rebuild_host_os ()
+{
+ HOST_OS="${UNAME_MACHINE_ARCH}-${VENDOR}-${VENDOR_DISTRIBUTION}-${VENDOR_RELEASE}-${UNAME_KERNEL}-${UNAME_KERNEL_RELEASE}"
+ if [ -z "$1" ]; then
+ if $VERBOSE; then
+ echo "HOST_OS=$HOST_OS"
+ fi
fi
+}
+
+# Valid values are: darwin,fedora,rhel,ubuntu
+set_VENDOR_DISTRIBUTION ()
+{
+ local dist=`echo "$1" | tr '[A-Z]' '[a-z]'`
+ case "$dist" in
+ darwin)
+ VENDOR_DISTRIBUTION='darwin'
+ ;;
+ fedora)
+ VENDOR_DISTRIBUTION='fedora'
+ ;;
+ rhel)
+ VENDOR_DISTRIBUTION='rhel'
+ ;;
+ ubuntu)
+ VENDOR_DISTRIBUTION='ubuntu'
+ ;;
+ opensuse)
+ VENDOR_DISTRIBUTION='opensuse'
+ ;;
+ *)
+ die "attempt to set an invalid VENDOR_DISTRIBUTION=$dist"
+ ;;
+ esac
+}
+
+set_VENDOR_RELEASE ()
+{
+ local release=`echo "$1" | tr '[A-Z]' '[a-z]'`
+ case "$VENDOR_DISTRIBUTION" in
+ darwin)
+ VENDOR_RELEASE='mountain'
+ ;;
+ fedora)
+ VENDOR_RELEASE="$release"
+ ;;
+ rhel)
+ VENDOR_RELEASE="$release"
+ ;;
+ ubuntu)
+ VENDOR_RELEASE="$release"
+ ;;
+ opensuse)
+ VENDOR_RELEASE="$release"
+ ;;
+ unknown)
+ die "attempt to set VENDOR_RELEASE without setting VENDOR_DISTRIBUTION"
+ ;;
+ *)
+ die "attempt to set with an invalid VENDOR_DISTRIBUTION=$VENDOR_DISTRIBUTION"
+ ;;
+ esac
+}
+
+
+# Valid values are: apple, redhat, centos, canonical
+set_VENDOR ()
+{
+ local vendor=`echo "$1" | tr '[A-Z]' '[a-z]'`
+
+ case $vendor in
+ apple)
+ VENDOR='apple'
+ ;;
+ redhat)
+ VENDOR='redhat'
+ ;;
+ centos)
+ VENDOR='centos'
+ ;;
+ canonical)
+ VENDOR='canonical'
+ ;;
+ suse)
+ VENDOR='suse'
+ ;;
+ *)
+ die "An attempt was made to set an invalid VENDOR=$_vendor"
+ ;;
+ esac
- PLATFORM_VERSION=`uname -r`
+ set_VENDOR_DISTRIBUTION $2
+ set_VENDOR_RELEASE $3
+}
- if [ "$PLATFORM" == "unknown" ]; then
- PLATFORM=`uname -s`
+determine_target_platform ()
+{
+ UNAME_MACHINE_ARCH=`(uname -m) 2>/dev/null` || UNAME_MACHINE_ARCH=unknown
+ UNAME_KERNEL=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+ UNAME_KERNEL_RELEASE=`(uname -r) 2>/dev/null` || UNAME_KERNEL_RELEASE=unknown
+
+ if [[ $(uname) == 'Darwin' ]]; then
+ set_VENDOR 'apple' 'darwin' 'mountain'
+ elif [[ -f '/etc/fedora-release' ]]; then
+ local fedora_version=`cat /etc/fedora-release | awk ' { print $3 } '`
+ set_VENDOR 'redhat' 'fedora' $fedora_version
+ if [[ "x$VENDOR_RELEASE" == 'x17' ]]; then
+ AUTORECONF_REBUILD_HOST=true
+ fi
+ elif [[ -f '/etc/centos-release' ]]; then
+ local centos_version=`cat /etc/centos-release | awk ' { print $7 } '`
+ set_VENDOR 'centos' 'rhel' $centos_version
+ elif [[ -f '/etc/SuSE-release' ]]; then
+ local suse_distribution=`head -1 /etc/SuSE-release | awk ' { print $1 } '`
+ local suse_version=`head -1 /etc/SuSE-release | awk ' { print $2 } '`
+ set_VENDOR 'suse' $suse_distribution $suse_version
+ elif [[ -f '/etc/redhat-release' ]]; then
+ local rhel_version=`cat /etc/redhat-release | awk ' { print $7 } '`
+ set_VENDOR 'redhat' 'rhel' $rhel_version
+ elif [[ -f '/etc/lsb-release' ]]; then
+ local debian_DISTRIB_ID=`cat /etc/lsb-release | grep DISTRIB_ID | awk -F= ' { print $2 } '`
+ local debian_version=`cat /etc/lsb-release | grep DISTRIB_CODENAME | awk -F= ' { print $2 } '`
+ set_VENDOR 'canonical' $debian_DISTRIB_ID $debian_version
+ if [[ "x$VENDOR_RELEASE" == 'xprecise' ]]; then
+ AUTORECONF_REBUILD_HOST=true
+ fi
fi
- TARGET_PLATFORM="$PLATFORM-$PLATFORM_VERSION"
+ rebuild_host_os
}
-configure_target_platform () {
+run_configure ()
+{
+ # We will run autoreconf if we are required
+ run_autoreconf_if_required
+
+ # We always begin at the root of our build
+ if [ ! popd ]; then
+ die "Programmer error, we entered run_configure with a stacked directory"
+ fi
+
+ local BUILD_DIR="$1"
+ if [[ -n "$BUILD_DIR" ]]; then
+ rm -r -f $BUILD_DIR
+ mkdir -p $BUILD_DIR
+ safe_pushd $BUILD_DIR
+ fi
+
+ # Arguments for configure
+ local CONFIGURE_ARG=
+
+ # Set ENV DEBUG in order to enable debugging
+ if $DEBUG; then
+ CONFIGURE_ARG='--enable-debug'
+ fi
+
+ # Set ENV ASSERT in order to enable assert
+ if [[ -n "$ASSERT" ]]; then
+ local ASSERT_ARG=
+ ASSERT_ARG='--enable-assert'
+ CONFIGURE_ARG="$ASSERT_ARG $CONFIGURE_ARG"
+ fi
+
# If we are executing on OSX use CLANG, otherwise only use it if we find it in the ENV
- case $TARGET_PLATFORM in
- darwin-*)
- CC=clang CXX=clang++ ./configure $DEBUG_ARG $ASSERT_ARG $PREFIX_ARG || die "Cannot execute CC=clang CXX=clang++ configure $DEBUG_ARG $ASSERT_ARG $PREFIX_ARG"
+ case $HOST_OS in
+ *-darwin-*)
+ CC=clang CXX=clang++ $top_srcdir/configure $CONFIGURE_ARG || die "Cannot execute CC=clang CXX=clang++ configure $CONFIGURE_ARG $PREFIX_ARG"
+ ;;
+ rhel-5*)
+ command_exists gcc44 || die "Could not locate gcc44"
+ CC=gcc44 CXX=gcc44 $top_srcdir/configure $CONFIGURE_ARG $PREFIX_ARG || die "Cannot execute CC=gcc44 CXX=gcc44 configure $CONFIGURE_ARG $PREFIX_ARG"
;;
*)
- ./configure $DEBUG_ARG $ASSERT_ARG $PREFIX_ARG || die "Cannot execute configure $DEBUG_ARG $ASSERT_ARG $PREFIX_ARG"
+ $top_srcdir/configure $CONFIGURE_ARG $PREFIX_ARG || die "Cannot execute configure $CONFIGURE_ARG $PREFIX_ARG"
;;
esac
+
+ if [ ! -f 'Makefile' ]; then
+ die "Programmer error, configure was run but no Makefile existed afterward"
+ fi
}
setup_gdb_command () {
GDB_TMPFILE=$(mktemp /tmp/gdb.XXXXXXXXXX)
- echo "set logging overwrite on" > $GDB_TMPFILE
- echo "set logging on" >> $GDB_TMPFILE
- echo "set environment LIBTEST_IN_GDB=1" >> $GDB_TMPFILE
- echo "run" >> $GDB_TMPFILE
- echo "thread apply all bt" >> $GDB_TMPFILE
- echo "quit" >> $GDB_TMPFILE
+ echo 'set logging overwrite on' > $GDB_TMPFILE
+ echo 'set logging on' >> $GDB_TMPFILE
+ echo 'set environment LIBTEST_IN_GDB=1' >> $GDB_TMPFILE
+ echo 'run' >> $GDB_TMPFILE
+ echo 'thread apply all bt' >> $GDB_TMPFILE
+ echo 'quit' >> $GDB_TMPFILE
GDB_COMMAND="gdb -f -batch -x $GDB_TMPFILE"
}
setup_valgrind_command () {
- VALGRIND_COMMAND="valgrind --error-exitcode=1 --leak-check=yes --show-reachable=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE"
+ VALGRIND_PROGRAM=`type -p valgrind`
+ if [[ -n "$VALGRIND_PROGRAM" ]]; then
+ VALGRIND_COMMAND="$VALGRIND_PROGRAM --error-exitcode=1 --leak-check=yes --show-reachable=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE"
+ fi
}
-make_valgrind () {
- if [ "$PLATFORM" = "darwin" ]; then
- make_darwin_malloc
+push_PREFIX_ARG ()
+{
+ if [[ -n "$PREFIX_ARG" ]]; then
+ OLD_PREFIX_ARG=$PREFIX_ARG
+ PREFIX_ARG=
+ fi
+
+ if [[ -n "$1" ]]; then
+ PREFIX_ARG="--prefix=$1"
+ fi
+}
+
+pop_PREFIX_ARG ()
+{
+ if [[ -n "$OLD_PREFIX_ARG" ]]; then
+ PREFIX_ARG=$OLD_TESTS_ENVIRONMENT
+ OLD_PREFIX_ARG=
else
- if command_exists valgrind; then
+ PREFIX_ARG=
+ fi
+}
- if [ -n "$TESTS_ENVIRONMENT" ]; then
- OLD_TESTS_ENVIRONMENT=$TESTS_ENVIRONMENT
- export -n TESTS_ENVIRONMENT
- fi
+push_TESTS_ENVIRONMENT ()
+{
+ if [[ -n "$OLD_TESTS_ENVIRONMENT" ]]; then
+ die "OLD_TESTS_ENVIRONMENT was set on push, programmer error!"
+ fi
- # Set ENV VALGRIND_COMMAND
- if [ -z "$VALGRIND_COMMAND" ]; then
- setup_valgrind_command
- fi
+ if [[ -n "$TESTS_ENVIRONMENT" ]]; then
+ OLD_TESTS_ENVIRONMENT=$TESTS_ENVIRONMENT
+ TESTS_ENVIRONMENT=
+ fi
+}
- if [[ -f libtool ]]; then
- TESTS_ENVIRONMENT="$LIBTOOL_COMMAND $VALGRIND_COMMAND"
- else
- TESTS_ENVIRONMENT="$VALGRIND_COMMAND"
- fi
- export TESTS_ENVIRONMENT
+pop_TESTS_ENVIRONMENT ()
+{
+ TESTS_ENVIRONMENT=
+ if [[ -n "$OLD_TESTS_ENVIRONMENT" ]]; then
+ TESTS_ENVIRONMENT=$OLD_TESTS_ENVIRONMENT
+ OLD_TESTS_ENVIRONMENT=
+ fi
+}
- export TESTS_ENVIRONMENT
- make_target check
- export -n TESTS_ENVIRONMENT
+function safe_pushd ()
+{
+ pushd $1 &> /dev/null ;
- if [ -n "$OLD_TESTS_ENVIRONMENT" ]; then
- TESTS_ENVIRONMENT=$OLD_TESTS_ENVIRONMENT
- export TESTS_ENVIRONMENT
- fi
+ if $VERBOSE -a test -n "$BUILD_DIR"; then
+ echo "BUILD_DIR=$BUILD_DIR"
+ fi
+}
+function safe_popd ()
+{
+ local directory_to_delete=`pwd`
+ popd &> /dev/null ;
+ if [ $? -eq 0 ]; then
+ if [[ "$top_srcdir" == "$directory_to_delete" ]]; then
+ die "We almost deleted top_srcdir($top_srcdir), programmer error"
fi
+
+ rm -r -f "$directory_to_delete"
fi
}
-make_install_system () {
- make_distclean
-
- INSTALL_LOCATION=$(mktemp -d /tmp/XXXXXXXXXX)
- PREFIX_ARG="--prefix=$INSTALL_LOCATION"
+function make_valgrind ()
+{
+ if [[ "$VENDOR_DISTRIBUTION" == 'darwin' ]]; then
+ make_darwin_malloc
+ return
+ fi
- configure_target_platform
+ # If the env VALGRIND_COMMAND is set then we assume it is valid
+ local valgrind_was_set=false
+ if [[ -z "$VALGRIND_COMMAND" ]]; then
+ setup_valgrind_command
+ if [[ -n "$VALGRIND_COMMAND" ]]; then
+ valgrind_was_set=true
+ fi
+ else
+ valgrind_was_set=true
+ fi
- if [ -n "$TESTS_ENVIRONMENT" ]; then
- OLD_TESTS_ENVIRONMENT=$TESTS_ENVIRONMENT
- export -n TESTS_ENVIRONMENT
+ # If valgrind_was_set is set to no we bail
+ if ! $valgrind_was_set; then
+ echo 'valgrind was not present'
+ return 1
fi
- make_target all
+ # If we are required to run configure, do so now
+ run_configure_if_required
+
+ push_TESTS_ENVIRONMENT
- make_target "install"
+ # If we don't have a configure, then most likely we will be missing libtool
+ assert_file 'configure'
+ if [[ -f 'libtool' ]]; then
+ TESTS_ENVIRONMENT="./libtool --mode=execute $VALGRIND_COMMAND"
+ else
+ TESTS_ENVIRONMENT="$VALGRIND_COMMAND"
+ fi
- make_target "installcheck"
+ make_target 'check' || return 1
- make_target "uninstall"
+ pop_TESTS_ENVIRONMENT
+}
- export -n TESTS_ENVIRONMENT
+function make_install_system ()
+{
+ local INSTALL_LOCATION=$(mktemp -d /tmp/XXXXXXXXXX)
+ push_PREFIX_ARG $INSTALL_LOCATION
- if [ -n "$OLD_TESTS_ENVIRONMENT" ]; then
- TESTS_ENVIRONMENT=$OLD_TESTS_ENVIRONMENT
- export TESTS_ENVIRONMENT
+ if [ ! -d $INSTALL_LOCATION ] ; then
+ die "ASSERT temp directory not found '$INSTALL_LOCATION'"
fi
+ run_configure #install_buid_dir
+
+ push_TESTS_ENVIRONMENT
+
+ make_target 'install'
+
+ make_target 'installcheck'
+
+ make_target 'uninstall'
+
+ pop_TESTS_ENVIRONMENT
+ pop_PREFIX_ARG
+
rm -r -f $INSTALL_LOCATION
+ make 'distclean'
+
+ if [ -f 'Makefile' ]; then
+ die "ASSERT Makefile should not exist"
+ fi
+
+ safe_popd
}
-make_darwin_malloc () {
+function make_darwin_malloc ()
+{
+ run_configure_if_required
+
+ old_MallocGuardEdges=$MallocGuardEdges
MallocGuardEdges=1
+ old_MallocErrorAbort=$MallocErrorAbort
MallocErrorAbort=1
+ old_MallocScribble=$MallocScribble
MallocScribble=1
- export MallocGuardEdges MallocErrorAbort MallocScribble
+
make_check
- export -n MallocGuardEdges MallocErrorAbort MallocScribble
+
+ MallocGuardEdges=$old_MallocGuardEdges
+ MallocErrorAbort=$old_MallocErrorAbort
+ MallocScribble=$old_MallocScribble
}
-make_local () {
- case $TARGET_PLATFORM in
- darwin-*)
- make_distcheck
- make_valgrind
- ;;
- *)
- make_target_platform
- ;;
- esac
+function snapshot_check ()
+{
+ if [ -n "$BOOTSTRAP_SNAPSHOT_CHECK" ]; then
+ assert_file "$BOOTSTRAP_SNAPSHOT_CHECK" 'snapshot check failed'
+ fi
+}
+
+# This will reset our environment, and make sure built files are available.
+function make_for_snapshot ()
+{
+ # Make sure it is clean
+ make_maintainer_clean
+
+ run_configure
+ make_target 'dist'
+ make_target 'distclean'
+
+ # We should have a configure, but no Makefile at the end of this exercise
+ assert_no_file 'Makefile'
+ assert_exec_file 'configure'
+
+ snapshot_check
}
-make_target_platform () {
- case $TARGET_PLATFORM in
- fedora-*)
+function make_for_mingw32 ()
+{
+ # Make sure it is clean
+ if [ -f Makefile -o -f configure ]; then
+ make_maintainer_clean
+ fi
+ assert_no_file 'Makefile'
+
+ if command_exists mingw32-configure; then
+ run_autoreconf
+
+ mingw32-configure || die 'mingw32-configure failed'
+ assert_file 'Makefile'
+
+ if command_exists mingw32-make; then
+ mingw32-make || die 'mingw32-make failed'
+ fi
+ fi
+}
+
+# If we are locally testing, we should make sure the environment is setup correctly
+function check_for_jenkins ()
+{
+ if ! $jenkins_build_environment; then
+ echo "Not inside of jenkins"
+
+ if [ -f 'configure' ]; then
+ make_maintainer_clean
+ fi
+
+ if $BOOTSTRAP_SNAPSHOT; then
+ make_for_snapshot
+ fi
+ fi
+}
+
+function make_universe ()
+{
+ make_for_snapshot
+ make_valgrind
+ make_gdb
+ make_rpm
+ make_for_mingw32
+ make_distcheck
+ make_install_system
+}
+
+function make_for_continuus_integration ()
+{
+ # Setup the environment if we are local
+ check_for_jenkins
+
+ # No matter then evironment, we should not have a Makefile at this point
+ assert_no_file 'Makefile'
+
+ # Platforms which require bootstrap should have some setup done before we hit this stage.
+ # If we are building locally, skip this step, unless we are just testing locally.
+ if $BOOTSTRAP_SNAPSHOT; then
+ snapshot_check
+ else
+ # If we didn't require a snapshot, then we should not have a configure
+ assert_no_file 'configure'
+
+ run_autoreconf
+ fi
+
+ assert_no_file 'Makefile' 'Programmer error, Makefile existed where build state should have been clean'
+
+ case $HOST_OS in
+ *-fedora-*)
+ run_configure
+
+ assert_exec_file 'configure'
+ assert_file 'Makefile'
+
# make rpm includes "make distcheck"
- if [ -f rpm.am ]; then
+ if [[ -f rpm.am ]]; then
+ make_rpm
+ elif [[ -d rpm ]]; then
make_rpm
else
make_distcheck
fi
+
+ assert_exec_file 'configure'
+ assert_file 'Makefile'
+
+ make_install_system
;;
- precise-*)
+ *-precise-*)
+ run_configure
+
+ assert_exec_file 'configure'
+ assert_file 'Makefile'
+
make_distcheck
+
+ assert_exec_file 'configure'
+ assert_file 'Makefile'
+
make_valgrind
- make_gdb
- ;;
- unknown-*)
- make_all
+
+ assert_exec_file 'configure'
+ assert_file 'Makefile'
+
+ make_install_system
;;
*)
- make_all
+ make_jenkins_default
;;
esac
- make_install_system
+ make_maintainer_clean
- make_distclean
+ safe_popd
}
-make_gdb () {
+# The point to this test is to test bootstrap.sh itself
+function self_test ()
+{
+ # We start off with a clean env
+ make_maintainer_clean
+
+ eval "./bootstrap.sh jenkins" || die "failed 'jenkins'"
+ eval "./bootstrap.sh all" || die "failed 'all'"
+ eval "./bootstrap.sh gdb" || die "failed 'gdb'"
+ eval "./bootstrap.sh maintainer-clean" || die "failed 'maintainer-clean'"
+}
+
+function make_gdb ()
+{
+ run_configure_if_required
+
if command_exists gdb; then
- if [ -n "$TESTS_ENVIRONMENT" ]; then
- OLD_TESTS_ENVIRONMENT=$TESTS_ENVIRONMENT
- export -n TESTS_ENVIRONMENT
- fi
+ push_TESTS_ENVIRONMENT
# Set ENV GDB_COMMAND
- if [ -z "$GDB_COMMAND" ]; then
+ if [[ -z "$GDB_COMMAND" ]]; then
setup_gdb_command
fi
- if [[ -f libtool ]]; then
- TESTS_ENVIRONMENT="$LIBTOOL_COMMAND $GDB_COMMAND"
+ # If we don't have a configure, then most likely we will be missing libtool
+ assert_file 'configure'
+ if [[ -f 'libtool' ]]; then
+ TESTS_ENVIRONMENT="./libtool --mode=execute $GDB_COMMAND"
else
TESTS_ENVIRONMENT="$GDB_COMMAND"
fi
- export TESTS_ENVIRONMENT
make_target check
- export -n TESTS_ENVIRONMENT
- MAKE_TARGET=
- if [[ -f gdb.txt ]]; then
- rm -f gdb.txt
+ if [ -f 'gdb.txt' ]; then
+ rm 'gdb.txt'
fi
- if [ -n "$OLD_TESTS_ENVIRONMENT" ]; then
- TESTS_ENVIRONMENT=$OLD_TESTS_ENVIRONMENT
- export TESTS_ENVIRONMENT
+ pop_TESTS_ENVIRONMENT
+
+ if [ -f '.gdb_history' ]; then
+ rm '.gdb_history'
fi
+ else
+ echo 'gdb was not present'
+ return 1
fi
}
-make_target () {
- if [ -n "$MAKE_TARGET" ]; then
- OLD_MAKE_TARGET=$MAKE_TARGET
+# $1 target to compile
+# $2 to die, or not to die, based on contents
+function make_target ()
+{
+ if [[ -z "$1" ]]; then
+ die "Programmer error, no target provided for make"
+ fi
+
+ if [ ! -f 'Makefile' ]; then
+ die "Programmer error, make was called before configure"
+ run_configure
+ fi
+
+ if [ -n "$TESTS_ENVIRONMENT" -a $VERBOSE ]; then
+ echo "TESTS_ENVIRONMENT=$TESTS_ENVIRONMENT"
fi
- MAKE_TARGET=$1
- run $MAKE $MAKE_TARGET || die "Cannot execute $MAKE $MAKE_TARGET"
+ if [[ -z "$MAKE" ]]; then
+ die "MAKE was not set"
+ fi
- if [ -n "$MAKE_TARGET" ]; then
- MAKE_TARGET=$OLD_MAKE_TARGET
+ if [[ -n "$2" ]]; then
+ run $MAKE $1 || return 1
+ else
+ run $MAKE $1 || die "Cannot execute $MAKE $1"
fi
}
-make_distcheck () {
- make_target distcheck
+function make_distcheck ()
+{
+ make_target 'distcheck'
}
-make_rpm () {
- make_target "rpm"
+function make_rpm ()
+{
+ if [ -f 'rpm.am' -o -d 'rpm' ]; then
+ run_configure_if_required
+ make_target 'rpm'
+ fi
}
-make_distclean () {
- make_target distclean
+function make_maintainer_clean ()
+{
+ run_configure_if_required
+ make_target 'maintainer-clean' 'no_error'
}
-make_maintainer_clean () {
- make_target maintainer-clean
+function make_check ()
+{
+ make_target 'check'
}
-make_check () {
- make_target check
+function make_jenkins_default ()
+{
+ run_configure
+ make_target 'all'
}
-make_all () {
- make_target all
+function make_default ()
+{
+ run_configure_if_required
+ make_target 'all'
}
-run() {
- if [ -n "$TESTS_ENVIRONMENT" ]; then
- echo "TESTS_ENVIRONMENT=$TESTS_ENVIRONMENT"
+function run_configure_if_required ()
+{
+ run_autoreconf_if_required
+
+ if [ ! -f 'Makefile' ]; then
+ run_configure
fi
- echo "\`$@' $ARGS"
- $@ $ARGS
-}
-parse_command_line_options() {
+ assert_file 'Makefile' 'configure did not produce a Makefile'
+}
- if ! options=$(getopt -o c --long configure -n 'bootstrap' -- "$@"); then
- exit 1
+function run_autoreconf_if_required ()
+{
+ if [ ! -x 'configure' ]; then
+ run_autoreconf
fi
- eval set -- "$options"
+ assert_exec_file 'configure'
+}
- while [ $# -gt 0 ]; do
- case $1 in
- -c | --configure )
- CONFIGURE_OPTION="yes" ; shift;;
- -- )
- shift; break;;
- -* )
- echo "$0: error - unrecognized option $1" 1>&2; exit 1;;
- *)
- break;;
- esac
- done
+function run_autoreconf ()
+{
+ if [[ -z "$AUTORECONF" ]]; then
+ die "Programmer error, tried to call run_autoreconf () but AUTORECONF was not set"
+ fi
+
+ run $AUTORECONF || die "Cannot execute $AUTORECONF"
+
+ eval 'bash -n configure' || die "autoreconf generated a malformed configure"
}
+function run ()
+{
+ if $VERBOSE; then
+ echo "\`$@' $ARGS"
+ fi
+
+ eval $@ $ARGS
+}
+parse_command_line_options ()
+{
+ local SHORTOPTS=':apcmt:dvh'
-bootstrap() {
- parse_command_line_options $@
- determine_target_platform
+ nassert MAKE_TARGET
+
+ while getopts "$SHORTOPTS" opt; do
+ case $opt in
+ a) #--autoreconf
+ AUTORECONF_OPTION=true
+ MAKE_TARGET='autoreconf'
+ ;;
+ p) #--print-env
+ PRINT_SETUP_OPTION=true
+ ;;
+ c) # --configure
+ CONFIGURE_OPTION=true
+ MAKE_TARGET='configure'
+ ;;
+ m) # maintainer-clean
+ CLEAN_OPTION=true
+ MAKE_TARGET='clean_op'
+ ;;
+ t) # target
+ TARGET_OPTION=true
+ TARGET_OPTION_ARG="$OPTARG"
+ MAKE_TARGET="$OPTARG"
+ ;;
+ d) # debug
+ DEBUG_OPTION=true
+ enable_debug
+ ;;
+ h) # help
+ echo "bootstrap.sh [options] optional_target ..."
+ exit
+ ;;
+ v) # verbose
+ VERBOSE_OPTION=true
+ VERBOSE=true
+ ;;
+ :)
+ echo "Option -$OPTARG requires an argument." >&2
+ exit 1
+ ;;
+ *)
+ echo "$0: error - unrecognized option $1" 1>&2
+ exit 1
+ ;;
+ esac
+ done
+
+ shift $((OPTIND-1))
- DEFAULT_DEV_AUTORECONF_FLAGS="--install --force --verbose -Wall -Werror"
- DEFAULT_AUTORECONF_FLAGS="--install --force --verbose -Wall"
+ if [ -n "$1" ]; then
+ MAKE_TARGET="$@"
+ fi
+}
- if [ -d .git ]; then
- AUTORECONF_FLAGS=$DEFAULT_DEV_AUTORECONF_FLAGS
+determine_vcs ()
+{
+ if [[ -d '.git' ]]; then
VCS_CHECKOUT=git
- elif [ -d .bzr ]; then
- AUTORECONF_FLAGS=$DEFAULT_DEV_AUTORECONF_FLAGS
+ elif [[ -d '.bzr' ]]; then
VCS_CHECKOUT=bzr
- elif [ -d .svn ]; then
- AUTORECONF_FLAGS=$DEFAULT_DEV_AUTORECONF_FLAGS
+ elif [[ -d '.svn' ]]; then
VCS_CHECKOUT=svn
- elif [ -d .hg ]; then
- AUTORECONF_FLAGS=$DEFAULT_DEV_AUTORECONF_FLAGS
+ elif [[ -d '.hg' ]]; then
VCS_CHECKOUT=hg
- else
- AUTORECONF_FLAGS=$DEFAULT_AUTORECONF_FLAGS
fi
- if [ -z "$LIBTOOLIZE_FLAGS" ]; then
- LIBTOOLIZE_FLAGS="--force --verbose --install"
+ if [[ -n "$VCS_CHECKOUT" ]]; then
+ VERBOSE=true
+ fi
+}
+
+autoreconf_setup ()
+{
+ # Set ENV MAKE in order to override "make"
+ if [[ -z "$MAKE" ]]; then
+ if command_exists gmake; then
+ MAKE=`type -p gmake`
+ else
+ if command_exists make; then
+ MAKE=`type -p make`
+ fi
+ fi
+
+ if [ "$VCS_CHECKOUT" ]; then
+ if $DEBUG; then
+ MAKE="$MAKE --warn-undefined-variables"
+ fi
+ fi
+
+ if $DEBUG; then
+ MAKE="$MAKE -d"
+ fi
+ fi
+
+ if [[ -z "$GNU_BUILD_FLAGS" ]]; then
+ GNU_BUILD_FLAGS="--install --force"
fi
- if [ "$PLATFORM" = "darwin" ]; then
- LIBTOOLIZE=glibtoolize
- elif [ -z "$LIBTOOLIZE" ]; then
- LIBTOOLIZE=libtoolize
+ if $VERBOSE; then
+ GNU_BUILD_FLAGS="$GNU_BUILD_FLAGS --verbose"
fi
- AUTORECONF=autoreconf
+ if [ -z "$ACLOCAL_PATH" ]; then
+ ACLOCAL_PATH="/usr/local/share/aclocal $ACLOCAL_PATH"
+ fi
- # Set ENV DEBUG in order to enable debugging
- if [ -n "$DEBUG" ]; then
- DEBUG_ARG="--enable-debug"
+ if [[ -z "$WARNINGS" ]]; then
+ if [[ -n "$VCS_CHECKOUT" ]]; then
+ WARNINGS="all,error"
+ else
+ WARNINGS="all"
+ fi
fi
- # Set ENV ASSERT in order to enable assert
- if [ -n "$ASSERT" ]; then
- ASSERT_ARG="--enable-assert"
+ if [[ -z "$LIBTOOLIZE" ]]; then
+ # If we are using OSX, we first check to see glibtoolize is available
+ if [[ "$VENDOR_DISTRIBUTION" == "darwin" ]]; then
+ LIBTOOLIZE=`type -p glibtoolize`
+
+ if [[ -z "$LIBTOOLIZE" ]]; then
+ echo "Couldn't find glibtoolize, it is required on OSX"
+ fi
+ fi
fi
- # Set ENV MAKE in order to override "make"
- if [ -z "$MAKE" ]; then
- MAKE="make"
+ # Test the ENV AUTOMAKE if it exists
+ if [[ -n "$AUTOMAKE" ]]; then
+ run $AUTOMAKE '--help' &> /dev/null || die "Failed to run AUTOMAKE:$AUTOMAKE"
fi
- # Set ENV PREFIX in order to set --prefix for ./configure
- if [ -n "$PREFIX" ]; then
- PREFIX_ARG="--prefix=$PREFIX"
+ # Test the ENV AUTOCONF if it exists
+ if [[ -n "$AUTOCONF" ]]; then
+ run $AUTOCONF '--help' &> /dev/null || die "Failed to run AUTOCONF:$AUTOCONF"
fi
- if [ -f Makefile ]; then
- make_maintainer_clean
- rm -f Makefile.in
- rm -f aminclude.am
+ # Test the ENV AUTOHEADER if it exists
+ if [[ -n "$AUTOHEADER" ]]; then
+ run $AUTOHEADER '--help' &> /dev/null || die "Failed to run AUTOHEADER:$AUTOHEADER"
+ fi
+
+ # Test the ENV AUTOM4TE if it exists
+ if [[ -n "$AUTOM4TE" ]]; then
+ run $AUTOM4TE '--help' &> /dev/null || die "Failed to run AUTOM4TE:$AUTOM4TE"
+ fi
+
+ if [[ -z "$AUTORECONF" ]]; then
+ AUTORECONF=`type -p autoreconf`
+
+ if [[ -z "$AUTORECONF" ]]; then
+ die "Couldn't find autoreconf"
+ fi
+
+ if [[ -n "$GNU_BUILD_FLAGS" ]]; then
+ AUTORECONF="$AUTORECONF $GNU_BUILD_FLAGS"
+ fi
+ fi
+
+ run $AUTORECONF '--help' &> /dev/null || die "Failed to run AUTORECONF:$AUTORECONF"
+}
+
+print_setup ()
+{
+ saved_debug_status=$DEBUG
+ if $DEBUG; then
+ disable_debug
+ fi
+
+ echo '----------------------------------------------'
+ echo 'BOOTSTRAP ENV'
+ echo "AUTORECONF=$AUTORECONF"
+ echo "HOST_OS=$HOST_OS"
+
+ echo "getopt()"
+ if $AUTORECONF_OPTION; then
+ echo "--autoreconf"
+ fi
+
+ if $CLEAN_OPTION; then
+ echo "--clean"
+ fi
+
+ if $CONFIGURE_OPTION; then
+ echo "--configure"
+ fi
+
+ if $DEBUG_OPTION; then
+ echo "--debug"
fi
- run $LIBTOOLIZE $LIBTOOLIZE_FLAGS || die "Cannot execute $LIBTOOLIZE $LIBTOOLIZE_FLAGS"
- run $AUTORECONF $AUTORECONF_FLAGS || die "Cannot execute $AUTORECONF $AUTORECONF_FLAGS"
+ if $PRINT_SETUP_OPTION; then
+ echo "--print-env"
+ fi
+
+ if $TARGET_OPTION; then
+ echo "--target=$TARGET_OPTION_ARG"
+ fi
+
+ if $VERBOSE_OPTION; then
+ echo "--verbose"
+ fi
+
+ if [[ -n "$MAKE" ]]; then
+ echo "MAKE=$MAKE"
+ fi
+
+ if [[ -n "$MAKE_TARGET" ]]; then
+ echo "MAKE_TARGET=$MAKE_TARGET"
+ fi
- configure_target_platform
-
- if [ "$CONFIGURE_OPTION" == "yes" ]; then
- exit
+ if [[ -n "$PREFIX" ]]; then
+ echo "PREFIX=$PREFIX"
+ fi
+
+ if [[ -n "$TESTS_ENVIRONMENT" ]]; then
+ echo "TESTS_ENVIRONMENT=$TESTS_ENVIRONMENT"
fi
- # Backwards compatibility
- if [ -n "$VALGRIND" ]; then
- MAKE_TARGET="valgrind"
+ if [[ -n "$VCS_CHECKOUT" ]]; then
+ echo "VCS_CHECKOUT=$VCS_CHECKOUT"
fi
- # Setup LIBTOOL_COMMAND if we need it
- if [[ -f libtool ]]; then
- LIBTOOL_COMMAND="./libtool --mode=execute"
+ if $VERBOSE; then
+ echo "VERBOSE=true"
fi
- if [ -f docs/conf.py ]; then
- if command_exists sphinx-build; then
- make_target "man"
+ if $DEBUG; then
+ echo "DEBUG=true"
+ fi
+
+ if [[ -n "$WARNINGS" ]]; then
+ echo "WARNINGS=$WARNINGS"
+ fi
+ echo '----------------------------------------------'
+
+ if $saved_debug_status; then
+ enable_debug
+ fi
+}
+
+make_clean_option ()
+{
+ run_configure_if_required
+
+ make_maintainer_clean
+
+ if [[ "$VCS_CHECKOUT" == 'git' ]]; then
+ run "$VCS_CHECKOUT" status --ignored
+ elif [[ -n "$VCS_CHECKOUT" ]]; then
+ run "$VCS_CHECKOUT" status
+ fi
+}
+
+make_for_autoreconf ()
+{
+ if [ -f 'Makefile' ]; then
+ make_maintainer_clean
+ fi
+
+ run_autoreconf
+
+ assert_no_file 'Makefile'
+}
+
+check_make_target()
+{
+ case $1 in
+ 'self')
+ ;;
+ 'gdb')
+ ;;
+ 'clean_op')
+ ;;
+ 'autoreconf')
+ ;;
+ 'install-system')
+ ;;
+ 'configure')
+ ;;
+ 'distcheck')
+ ;;
+ 'check')
+ ;;
+ 'snapshot')
+ ;;
+ 'mingw')
+ ;;
+ 'universe')
+ ;;
+ 'valgrind')
+ ;;
+ 'jenkins')
+ ;;
+ 'distclean')
+ ;;
+ 'maintainer-clean')
+ ;;
+ 'install')
+ ;;
+ 'all')
+ ;;
+ 'test-*')
+ ;;
+ 'valgrind-*')
+ ;;
+ 'gdb-*')
+ ;;
+ 'dist')
+ ;;
+ *)
+ die "Unknown MAKE_TARGET option: $1"
+ ;;
+ esac
+}
+
+function bootstrap ()
+{
+ determine_target_platform
+
+ determine_vcs
+
+ # Set up whatever we need to do to use autoreconf later
+ autoreconf_setup
+
+ if [ -z "$MAKE_TARGET" ]; then
+ MAKE_TARGET="make_default"
+ fi
+
+ if $PRINT_SETUP_OPTION -o $DEBUG; then
+ echo
+ print_setup
+ echo
+
+ # Exit if all we were looking for were the currently used options
+ if $PRINT_SETUP_OPTION; then
+ exit
fi
fi
+ # Use OLD_TESTS_ENVIRONMENT for tracking the state of the variable
+ local OLD_TESTS_ENVIRONMENT=
+
+ # Set ENV PREFIX in order to set --prefix for ./configure
+ if [[ -n "$PREFIX" ]]; then
+ push_PREFIX_ARG $PREFIX
+ fi
+
+ # We should always have a target by this point
+ assert MAKE_TARGET
+
+ local MAKE_TARGET_ARRAY=($MAKE_TARGET)
+
+ for target in "${MAKE_TARGET_ARRAY[@]}"
+ do
+ # If we are running inside of Jenkins, we want to only run some of the possible tests
+ if $jenkins_build_environment; then
+ check_make_target $target
+ fi
+
+ case $target in
+ 'self')
+ self_test
+ ;;
+ 'gdb')
+ make_gdb
+ ;;
+ 'clean_op')
+ make_clean_option
+ ;;
+ 'autoreconf')
+ make_for_autoreconf
+ ;;
+ 'install-system')
+ make_install_system
+ ;;
+ 'configure')
+ run_configure
+ ;;
+ 'default')
+ make
+ run_configure
+ ;;
+ 'mingw')
+ make_for_mingw32
+ ;;
+ 'snapshot')
+ make_for_snapshot
+ ;;
+ 'rpm')
+ make_rpm
+ ;;
+ 'valgrind')
+ make_valgrind
+ ;;
+ 'universe')
+ make_universe
+ ;;
+ 'jenkins')
+ make_for_continuus_integration
+ ;;
+ *)
+ run_configure_if_required
+ make_target "$target"
+ ;;
+ esac
+ done
+}
+
+main ()
+{
+ # Variables we export
+ declare -x VCS_CHECKOUT=
+
+ # Variables we control globally
+ local MAKE_TARGET=
+
+ # Options for getopt
+ local AUTORECONF_OPTION=false
+ local CLEAN_OPTION=false
+ local CONFIGURE_OPTION=false
+ local DEBUG_OPTION=false
+ local PRINT_SETUP_OPTION=false
+ local TARGET_OPTION=false
+ local TARGET_OPTION_ARG=
+ local VERBOSE_OPTION=false
+
+ # If we call autoreconf on the platform or not
+ local AUTORECONF_REBUILD_HOST=false
+ local AUTORECONF_REBUILD=false
+
+ local -r top_srcdir=`pwd`
+
+ # Variables for determine_target_platform () and rebuild_host_os ()
+ # UNAME_MACHINE_ARCH= uname -m
+ # VENDOR= apple, redhat, centos, canonical
+ # VENDOR_RELEASE=
+ # RHEL{rhel,Tikanga,Santiago}
+ # Ubuntu{ubuntu,Lucid,Maverick,Natty,Oneiric,Precise,Quantal}
+ # Fedora{fedora,Verne,Beefy}
+ # OSX{osx,lion,snow,mountain}
+ # VENDOR_DISTRIBUTION= darwin,fedora,rhel,ubuntu
+ # UNAME_KERNEL= Linux, Darwin,...
+ # UNAME_KERNEL_RELEASE= Linux, Darwin,...
+ local UNAME_MACHINE_ARCH=unknown
+ local VENDOR=unknown
+ local VENDOR_RELEASE=unknown
+ local VENDOR_DISTRIBUTION=unknown
+ local UNAME_KERNEL=unknown
+ local UNAME_KERNEL_RELEASE=unknown
+ local HOST_OS=
+
+ rebuild_host_os no_output
+
+ parse_command_line_options $@
+
# If we are running under Jenkins we predetermine what tests we will run against
- if [[ -n "$JENKINS_HOME" ]]; then
- make_target_platform
- elif [ "$MAKE_TARGET" == "gdb" ]; then
- make_gdb
- elif [ "$MAKE_TARGET" == "valgrind" ]; then
- make_valgrind
- elif [ "$MAKE_TARGET" == "jenkins" ]; then
- # Set ENV MAKE_TARGET in order to override default of "all"
- make_target_platform
- elif [ -z "$MAKE_TARGET" ]; then
- make_local
- else
- make_target $MAKE_TARGET
+ # This MAKE_TARGET can be overridden by parse_command_line_options based MAKE_TARGET changes.
+ # We don't want Jenkins overriding other variables, so we NULL them.
+ if [ -z "$MAKE_TARGET" -a $jenkins_build_environment ]; then
+ MAKE_TARGET='jenkins'
fi
+
+ bootstrap
+
+ jobs -l
+ wait
+
+ exit 0
}
-export -n VCS_CHECKOUT
-export -n PLATFORM
-export -n TARGET_PLATFORM
-CONFIGURE_OPTION=no
-VCS_CHECKOUT=
-PLATFORM=unknown
-TARGET_PLATFORM=unknown
+enable_debug ()
+{
+ if ! $DEBUG; then
+ local caller_loc=`caller`
+ if [ -n $1 ]; then
+ echo "$caller_loc Enabling debug: $1"
+ else
+ echo "$caller_loc Enabling debug"
+ fi
+ set -x
+ DEBUG=true
+ fi
+}
+
+disable_debug ()
+{
+ set +x
+ DEBUG=true
+}
+
+# Script begins here
+
+env_debug_enabled=false
+if [[ -n "$JENKINS_HOME" ]]; then
+ declare -r jenkins_build_environment=true
+else
+ declare -r jenkins_build_environment=false
+fi
+
+export AUTOCONF
+export AUTOHEADER
+export AUTOM4TE
+export AUTOMAKE
+export AUTORECONF
+export DEBUG
+export GNU_BUILD_FLAGS
+export MAKE
+export TESTS_ENVIRONMENT
+export VERBOSE
+export WARNINGS
+
+case $OSTYPE in
+ darwin*)
+ export MallocGuardEdges
+ export MallocErrorAbort
+ export MallocScribble
+ ;;
+esac
+
+# We check for DEBUG twice, once before we source the config file, and once afterward
+env_debug_enabled=false
+if [[ -n "$DEBUG" ]]; then
+ env_debug_enabled=true
+ enable_debug
+ print_setup
+fi
+
+# Variables which only can be set by .bootstrap
+BOOTSTRAP_SNAPSHOT=false
+BOOTSTRAP_SNAPSHOT_CHECK=
+
+if [ -f '.bootstrap' ]; then
+ source '.bootstrap'
+fi
+
+if $env_debug_enabled; then
+ enable_debug
+else
+ if [[ -n "$DEBUG" ]]; then
+ enable_debug "Enabling DEBUG from '.bootstrap'"
+ print_setup
+ fi
+fi
+
+# We do this in order to protect the case where DEBUG
+if ! $env_debug_enabled; then
+ DEBUG=false
+fi
-bootstrap $@
+main $@
diff --git a/clients/execute.cc b/clients/execute.cc
index cf7779e5..3e9e4802 100644
--- a/clients/execute.cc
+++ b/clients/execute.cc
@@ -15,7 +15,7 @@
Return the number of rows set.
*/
-#include <config.h>
+#include <mem_config.h>
#include "clients/execute.h"
unsigned int execute_set(memcached_st *memc, pairs_st *pairs, unsigned int number_of)
diff --git a/clients/generator.cc b/clients/generator.cc
index e41d9c58..b2ba67ca 100644
--- a/clients/generator.cc
+++ b/clients/generator.cc
@@ -10,7 +10,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <stdint.h>
diff --git a/clients/memaslap.c b/clients/memaslap.c
index 8053775c..764707b5 100644
--- a/clients/memaslap.c
+++ b/clients/memaslap.c
@@ -18,15 +18,13 @@
#include <stdlib.h>
#include <getopt.h>
#include <limits.h>
-#if TIME_WITH_SYS_TIME
+
+#if defined(HAVE_SYS_TIME_H)
# include <sys/time.h>
+#endif
+
+#if defined(HAVE_TIME_H)
# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-# include <sys/time.h>
-# else
-# include <time.h>
-# endif
#endif
diff --git a/clients/memcapable.cc b/clients/memcapable.cc
index 980e3392..5dd78306 100644
--- a/clients/memcapable.cc
+++ b/clients/memcapable.cc
@@ -13,7 +13,7 @@
/* -*- Mode: C; tab-width: 2; c-basic-offset: 2; indent-tabs-mode: nil -*- */
#undef NDEBUG
-#include <config.h>
+#include <mem_config.h>
#ifdef HAVE_POLL_H
#include <poll.h>
diff --git a/clients/memcat.cc b/clients/memcat.cc
index bc66edf3..9aaa09af 100644
--- a/clients/memcat.cc
+++ b/clients/memcat.cc
@@ -10,7 +10,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <cstdio>
#include <cstring>
diff --git a/clients/memcp.cc b/clients/memcp.cc
index 11a5a3d0..da0f6eea 100644
--- a/clients/memcp.cc
+++ b/clients/memcp.cc
@@ -10,7 +10,7 @@
*
*/
-#include "config.h"
+#include "mem_config.h"
#include <cerrno>
#include <climits>
diff --git a/clients/memdump.cc b/clients/memdump.cc
index 26cf02ae..c9deb752 100644
--- a/clients/memdump.cc
+++ b/clients/memdump.cc
@@ -10,7 +10,7 @@
*
*/
-#include "config.h"
+#include "mem_config.h"
#include <cerrno>
#include <cstdio>
diff --git a/clients/memerror.cc b/clients/memerror.cc
index a8d4a007..654db143 100644
--- a/clients/memerror.cc
+++ b/clients/memerror.cc
@@ -9,7 +9,7 @@
* Summary:
*
*/
-#include "config.h"
+#include "mem_config.h"
#include <cerrno>
#include <cstdio>
diff --git a/clients/memexist.cc b/clients/memexist.cc
index 36d2066d..cf3f9d7f 100644
--- a/clients/memexist.cc
+++ b/clients/memexist.cc
@@ -9,7 +9,7 @@
* Summary:
*
*/
-#include "config.h"
+#include "mem_config.h"
#include <cstdio>
#include <cstring>
diff --git a/clients/memflush.cc b/clients/memflush.cc
index 02179fe5..0d798202 100644
--- a/clients/memflush.cc
+++ b/clients/memflush.cc
@@ -9,7 +9,7 @@
* Summary:
*
*/
-#include "config.h"
+#include "mem_config.h"
#include <cstdio>
#include <cstring>
diff --git a/clients/memparse.cc b/clients/memparse.cc
index 351f785c..3d65e219 100644
--- a/clients/memparse.cc
+++ b/clients/memparse.cc
@@ -35,7 +35,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <cstdio>
#include <cstring>
diff --git a/clients/memping.cc b/clients/memping.cc
index f316212d..13c87f93 100644
--- a/clients/memping.cc
+++ b/clients/memping.cc
@@ -9,7 +9,7 @@
* Summary:
*
*/
-#include "config.h"
+#include "mem_config.h"
#include <stdio.h>
#include <unistd.h>
diff --git a/clients/memrm.cc b/clients/memrm.cc
index 3bf4141a..80c53f00 100644
--- a/clients/memrm.cc
+++ b/clients/memrm.cc
@@ -9,7 +9,7 @@
* Summary:
*
*/
-#include "config.h"
+#include "mem_config.h"
#include <cstdio>
#include <cstring>
diff --git a/clients/memslap.cc b/clients/memslap.cc
index 419a25b4..88d5bed3 100644
--- a/clients/memslap.cc
+++ b/clients/memslap.cc
@@ -36,7 +36,7 @@
*/
-#include <config.h>
+#include <mem_config.h>
#include <cassert>
#include <cstdio>
diff --git a/clients/memstat.cc b/clients/memstat.cc
index 3eb3c0c0..6b80e582 100644
--- a/clients/memstat.cc
+++ b/clients/memstat.cc
@@ -12,7 +12,7 @@
* Brian Aker
* Toru Maesaka
*/
-#include <config.h>
+#include <mem_config.h>
#include <cstdio>
#include <cstring>
diff --git a/clients/memtouch.cc b/clients/memtouch.cc
index 8f9d7b28..49d154e3 100644
--- a/clients/memtouch.cc
+++ b/clients/memtouch.cc
@@ -10,7 +10,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <cstdio>
#include <cstring>
diff --git a/clients/ms_conn.c b/clients/ms_conn.c
index b4d5f673..2a65f6cf 100644
--- a/clients/ms_conn.c
+++ b/clients/ms_conn.c
@@ -20,16 +20,15 @@
#include <netinet/tcp.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-#if TIME_WITH_SYS_TIME
+
+#if defined(HAVE_SYS_TIME_H)
# include <sys/time.h>
+#endif
+
+#if defined(HAVE_TIME_H)
# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-# include <sys/time.h>
-# else
-# include <time.h>
-# endif
#endif
+
#include "ms_setting.h"
#include "ms_thread.h"
#include "ms_atomic.h"
diff --git a/clients/ms_task.c b/clients/ms_task.c
index 7e7921fc..083b46f4 100644
--- a/clients/ms_task.c
+++ b/clients/ms_task.c
@@ -11,16 +11,12 @@
#include "config.h"
-#include <inttypes.h>
-#if TIME_WITH_SYS_TIME
+#if defined(HAVE_SYS_TIME_H)
# include <sys/time.h>
+#endif
+
+#if defined(HAVE_TIME_H)
# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-# include <sys/time.h>
-# else
-# include <time.h>
-# endif
#endif
#include "ms_thread.h"
diff --git a/clients/ms_thread.c b/clients/ms_thread.c
index 1efe5cfb..2405e6ad 100644
--- a/clients/ms_thread.c
+++ b/clients/ms_thread.c
@@ -11,16 +11,14 @@
#include "config.h"
-#if TIME_WITH_SYS_TIME
+#if defined(HAVE_SYS_TIME_H)
# include <sys/time.h>
+#endif
+
+#if defined(HAVE_TIME_H)
# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-# include <sys/time.h>
-# else
-# include <time.h>
-# endif
#endif
+
#include "ms_thread.h"
#include "ms_setting.h"
#include "ms_atomic.h"
diff --git a/clients/utilities.cc b/clients/utilities.cc
index ddc83eda..5f5958e2 100644
--- a/clients/utilities.cc
+++ b/clients/utilities.cc
@@ -9,7 +9,7 @@
* Summary:
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <clients/utilities.h>
diff --git a/clients/utilities.h b/clients/utilities.h
index 2aed219a..d7ad9084 100644
--- a/clients/utilities.h
+++ b/clients/utilities.h
@@ -15,17 +15,15 @@
#include <libmemcached-1.2/memcached.h>
#include "clients/client_options.h"
-#if TIME_WITH_SYS_TIME
+#if defined(HAVE_SYS_TIME_H)
# include <sys/time.h>
+#endif
+
+#if defined(HAVE_TIME_H)
# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-# include <sys/time.h>
-# else
-# include <time.h>
-# endif
#endif
+
#ifdef __sun
/* For some odd reason the option struct on solaris defines the argument
* as char* and not const char*
diff --git a/configure.ac b/configure.ac
index afeb970d..c356db4a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -14,11 +14,11 @@ AC_CANONICAL_TARGET
AC_ARG_PROGRAM
AC_USE_SYSTEM_EXTENSIONS
-AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability subdir-objects foreign tar-ustar])
+AM_INIT_AUTOMAKE([1.11 color-tests -Wno-portability subdir-objects foreign tar-ustar])
AC_PREREQ([2.61])
-AC_CONFIG_HEADERS([config.h:config.in])dnl Keep filename to 8.3 for MS-DOS.
+AC_CONFIG_HEADERS([mem_config.h:mem_config.in])dnl Keep filename to 8.3 for MS-DOS.
AC_CONFIG_SRCDIR([libmemcached/memcached.cc])
#shared library versioning
@@ -48,15 +48,29 @@ LT_PREREQ([2.2])
LT_INIT
LT_LANG([C++])
+AX_ASSERT
+
AX_PLATFORM
-gl_VISIBILITY
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
AX_CXX_HEADER_STDCXX_98
-AS_IF([ test "$ax_cv_cxx_stdcxx_98" = no ],[
- AC_MSG_ERROR([Your system lacks a new enough C++ compiler])
- ])
+AS_IF([test "x$ax_cv_cxx_stdcxx_98" = "xno"],
+ [AC_MSG_ERROR([Your system lacks a new enough C++ compiler])])
+
+AC_DEFUN([LIBMEMCACHED_PROTOCOL],
+ [AC_ARG_ENABLE([libmemcachedprotocol],
+ [AS_HELP_STRING([--enable-libmemcachedprotocol],
+ [Enable libmemcachedprotocol])],
+ [ax_enable_libmemcachedprotocol=yes],
+ [ax_enable_libmemcachedprotocol=no])
+
+ AM_CONDITIONAL([BUILD_LIBMEMCACHED_PROTOCOL],[test "$ax_enable_libmemcachedprotocol" = "yes"])
+
+ AC_MSG_CHECKING([for libmemcachedprotocol])
+ AC_MSG_RESULT([$ax_enable_libmemcachedprotocol])
+ ])
+LIBMEMCACHED_PROTOCOL
# Adding support for libtest
m4_include([libtest/yatl.m4])
@@ -85,52 +99,66 @@ PROTOCOL_BINARY_TEST
ENABLE_DEPRECATED
# Checks for programs.
-AC_CHECK_PROGS([LEX], ['flex'], [:])
-AC_CHECK_PROGS([YACC], ['bison'], [:])
+AC_CHECK_PROGS([LEX],['flex'],[:])
+AC_CHECK_PROGS([YACC],['bison'],[:])
AX_PROG_SPHINX_BUILD
# Checks for libraries.
-AC_SEARCH_LIBS(getopt_long, gnugetopt)
-AC_SEARCH_LIBS(gethostbyname, nsl)
+AC_SEARCH_LIBS([getopt_long],[gnugetopt])
+AC_SEARCH_LIBS([gethostbyname],[nsl])
# Checks for header files.
-AC_CHECK_HEADERS([arpa/inet.h])
-AC_CHECK_HEADERS([errno.h])
-AC_CHECK_HEADERS([dlfcn.h])
-AC_CHECK_HEADERS([execinfo.h])
-AC_CHECK_HEADERS([fcntl.h])
-AC_CHECK_HEADERS([inttypes.h])
-AC_CHECK_HEADERS([libintl.h])
-AC_CHECK_HEADERS([limits.h])
-AC_CHECK_HEADERS([malloc.h])
-AC_CHECK_HEADERS([math.h])
-AC_CHECK_HEADERS([netdb.h])
-AC_CHECK_HEADERS([netinet/in.h])
-AC_CHECK_HEADERS([netinet/tcp.h])
-AC_CHECK_HEADERS([pthread.h])
-AC_CHECK_HEADERS([stdarg.h])
-AC_CHECK_HEADERS([stddef.h])
-AC_CHECK_HEADERS([stdio.h])
-AC_CHECK_HEADERS([stdlib.h])
-AC_CHECK_HEADERS([sys/socket.h])
-AC_CHECK_HEADERS([sys/sysctl.h])
-AC_CHECK_HEADERS([sys/time.h])
-AC_CHECK_HEADERS([time.h])
-AC_CHECK_HEADERS([unistd.h])
-AC_HEADER_TIME
+AC_CHECK_HEADERS_ONCE([arpa/inet.h])
+AC_CHECK_HEADERS_ONCE([dlfcn.h])
+AC_CHECK_HEADERS_ONCE([errno.h])
+AC_CHECK_HEADERS_ONCE([execinfo.h])
+AC_CHECK_HEADERS_ONCE([fcntl.h])
+AC_CHECK_HEADERS_ONCE([inttypes.h])
+AC_CHECK_HEADERS_ONCE([libintl.h])
+AC_CHECK_HEADERS_ONCE([limits.h])
+AC_CHECK_HEADERS_ONCE([mach/mach.h])
+AC_CHECK_HEADERS_ONCE([malloc.h])
+AC_CHECK_HEADERS_ONCE([math.h])
+AC_CHECK_HEADERS_ONCE([netdb.h])
+AC_CHECK_HEADERS_ONCE([netinet/in.h])
+AC_CHECK_HEADERS_ONCE([netinet/tcp.h])
+AC_CHECK_HEADERS_ONCE([pthread.h])
+AC_CHECK_HEADERS_ONCE([spawn.h])
+AC_CHECK_HEADERS_ONCE([stdarg.h])
+AC_CHECK_HEADERS_ONCE([stddef.h])
+AC_CHECK_HEADERS_ONCE([stdio.h])
+AC_CHECK_HEADERS_ONCE([stdlib.h])
+AC_CHECK_HEADERS_ONCE([sys/socket.h])
+AC_CHECK_HEADERS_ONCE([sys/sysctl.h])
+AC_CHECK_HEADERS_ONCE([sys/time.h])
+AC_CHECK_HEADERS_ONCE([sys/un.h])
+AC_CHECK_HEADERS_ONCE([syslog.h])
+AC_CHECK_HEADERS_ONCE([time.h])
+AC_CHECK_HEADERS_ONCE([unistd.h])
+
+# Windows only
+AC_CHECK_HEADERS([winsock2.h])
+AC_CHECK_HEADERS([ws2tcpip.h])
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_CHECK_FUNCS([alarm])
+AC_CHECK_FUNCS([atexit])
+AC_CHECK_FUNCS([clock_gettime])
AC_CHECK_FUNCS([dup2])
+AC_CHECK_FUNCS([fcntl])
+AC_CHECK_FUNCS([floor])
+AC_CHECK_FUNCS([getcwd])
AC_CHECK_FUNCS([getline])
AC_CHECK_FUNCS([gettimeofday])
+AC_CHECK_FUNCS([inet_ntoa])
AC_CHECK_FUNCS([memchr])
AC_CHECK_FUNCS([memmove])
AC_CHECK_FUNCS([memset])
AC_CHECK_FUNCS([pipe2])
+AC_CHECK_FUNCS([putenv])
AC_CHECK_FUNCS([select])
AC_CHECK_FUNCS([setenv])
AC_CHECK_FUNCS([socket])
@@ -139,26 +167,25 @@ AC_CHECK_FUNCS([strcasecmp])
AC_CHECK_FUNCS([strchr])
AC_CHECK_FUNCS([strdup])
AC_CHECK_FUNCS([strerror])
+AC_CHECK_FUNCS([strstr])
AC_CHECK_FUNCS([strtol])
AC_CHECK_FUNCS([strtoul])
AC_CHECK_FUNCS([strtoull])
AC_FUNC_ALLOCA
AC_FUNC_ERROR_AT_LINE
AC_FUNC_FORK
-AC_FUNC_MALLOC
-AC_FUNC_REALLOC
AC_FUNC_STRERROR_R
-AC_CHECK_HEADER(umem.h, [
- AC_DEFINE([HAVE_UMEM_H], 1,
- [Define this if you have umem.h])
- build_cache=no
-], [build_cache=yes])
+AC_CHECK_HEADER([umem.h],
+ [AC_DEFINE([HAVE_UMEM_H],[1],[Define this if you have umem.h])
+ build_cache=no],
+ [build_cache=yes])
-AM_CONDITIONAL([BUILD_CACHE], [test "x$build_cache" = "xyes"])
+AM_CONDITIONAL([BUILD_CACHE],[test "x$build_cache" = "xyes"])
AX_COMPILER_VENDOR
+AC_CHECK_TYPES([ptrdiff_t])
AC_HEADER_STDBOOL
AC_TYPE_INT16_T
AC_TYPE_INT32_T
@@ -183,52 +210,44 @@ AX_CXX_GCC_ABI_DEMANGLE
AX_SASL_CHECK
AX_LIBEVENT
-dnl
-dnl The sasl functions should only be visible if we build with sasl support
-dnl
-AS_IF([test "x$ac_enable_sasl" = "xyes"], [
- [ LIBMEMCACHED_WITH_SASL_SUPPORT="#define LIBMEMCACHED_WITH_SASL_SUPPORT 1" ]
- ],[ LIBMEMCACHED_WITH_SASL_SUPPORT="#define LIBMEMCACHED_WITH_SASL_SUPPORT 0" ])
-AC_SUBST(LIBMEMCACHED_WITH_SASL_SUPPORT)
+#
+# The sasl functions should only be visible if we build with sasl support
+#
+AS_IF([test "x$ac_enable_sasl" = "xyes"],
+ [LIBMEMCACHED_WITH_SASL_SUPPORT="#define LIBMEMCACHED_WITH_SASL_SUPPORT 1"],
+ [LIBMEMCACHED_WITH_SASL_SUPPORT="#define LIBMEMCACHED_WITH_SASL_SUPPORT 0"])
+AC_SUBST([LIBMEMCACHED_WITH_SASL_SUPPORT])
-AC_CHECK_LIB([rt], [clock_gettime], [
- RT_LIB="-lrt"
+AC_CHECK_LIB([rt],[clock_gettime],
+ [RT_LIB="-lrt"
AC_SUBST(RT_LIB)
- AC_DEFINE([HAVE_CLOCK_GETTIME], [ 1 ], [Have clock_gettime])
- ],[
- AC_DEFINE([HAVE_CLOCK_GETTIME], [ 0 ], [Have clock_gettime])
- ])
+ AC_DEFINE([HAVE_CLOCK_GETTIME], [ 1 ], [Have clock_gettime])],
+ [AC_DEFINE([HAVE_CLOCK_GETTIME], [ 0 ], [Have clock_gettime])])
# Check for the ability to call dlopen
-AC_CHECK_LIB([dl], [dlopen], [
- DL_LIB="-ldl"
- AC_SUBST([DL_LIB])
- AC_DEFINE([HAVE_LIBDL],[1],[Have dlopen])
- ],[
- AC_DEFINE([HAVE_LIBDL], [0], [Have dlopen])
- ])
-
-AC_CHECK_LIB([m], [floor])
+AS_IF([test "x$enable_static" = "xyes"],
+ [AC_CHECK_LIB([dl],[dlopen],
+ [DL_LIB="-ldl"
+ AC_SUBST([DL_LIB])
+ AC_DEFINE([HAVE_LIBDL],[1],[Have dlopen])])],
+ [AC_DEFINE([HAVE_LIBDL], [0], [Have dlopen])])
+
+AC_CHECK_LIB([m],[floor])
AC_CHECK_FUNCS([sigignore])
AC_CHECK_HEADERS([atomic.h])
-AS_IF([test "x$ac_cv_header_atomic_h" = "xyes"],[
- AC_CHECK_FUNCS([atomic_add_64])
+AS_IF([test "x$ac_cv_header_atomic_h" = "xyes"],
+ [AC_CHECK_FUNCS([atomic_add_64])
AC_CHECK_FUNCS([atomic_add_32])
- AS_IF([test "x$ac_cv_func_atomic_add_64" = "xyes" -a "x$ac_cv_func_atomic_add_32" = "xyes"],[
- AC_DEFINE([USE_ATOMIC_H],
- [1],
- [Define to true if you want to use functions from atomic.h])])])
-
-AC_DEFINE([HAVE_LIBDRIZZLE], [0], [Support for libdrizzle])
-AC_DEFINE([HAVE_DRIZZLED_BINARY], [0], [Support for DrizzleD])
-AC_DEFINE([DRIZZLED_BINARY], [0], [Support for DrizzleD])
-AC_DEFINE([GEARMAND_BLOBSLAP_WORKER], [0], [Support for Gearman Blobslap worker])
-AC_DEFINE([HAVE_LIBPQ], [0], [Support for Postgres])
-AC_DEFINE([HAVE_LIBCURL], [0], [Support for libcurl])
+ AS_IF([test "x$ac_cv_func_atomic_add_64" = "xyes" -a "x$ac_cv_func_atomic_add_32" = "xyes"],
+ [AC_DEFINE([USE_ATOMIC_H],[1],[Define to true if you want to use functions from atomic.h])])])
-AC_DEFINE([HAVE_MEMCACHED_LIGHT_BINARY], [1], [Support for memcached_light])
-AC_DEFINE([MEMCACHED_LIGHT_BINARY], ["example/memcached_light"], [Support for memcached_light])
+AC_DEFINE([HAVE_LIBDRIZZLE],[0],[Support for libdrizzle])
+AC_DEFINE([HAVE_DRIZZLED_BINARY],[0],[Support for DrizzleD])
+AC_DEFINE([DRIZZLED_BINARY],[0],[Support for DrizzleD])
+AC_DEFINE([GEARMAND_BLOBSLAP_WORKER],[0],[Support for Gearman Blobslap worker])
+AC_DEFINE([HAVE_LIBPQ],[0],[Support for Postgres])
+AC_DEFINE([HAVE_LIBCURL],[0],[Support for libcurl])
dnl Check for the requirements for running memcached with less privileges
dnl than the default privilege set. On Solaris we need setppriv and priv.h
@@ -236,22 +255,22 @@ dnl If you want to add support for other platforms you should check for
dnl your requirements, define HAVE_DROP_PRIVILEGES, and make sure you add
dnl the source file containing the implementation into memcached_SOURCE
dnl in Makefile.am
-AC_CHECK_FUNCS([setppriv], [
- AC_CHECK_HEADER([priv.h], [
- AC_DEFINE([HAVE_DROP_PRIVILEGES], 1,
- [Define this if you have an implementation of drop_privileges()])
- build_solaris_privs=yes
- ], [])
-],[])
-
-AC_CHECK_HEADERS_ONCE(winsock2.h poll.h sys/wait.h fnmatch.h)
-AM_CONDITIONAL(BUILD_POLL, test "x$ac_cv_header_poll_h" = "xno")
-AM_CONDITIONAL(BUILD_WIN32_WRAPPERS, test "x$ac_cv_header_winsock2_h" = "xyes")
-AS_IF(test "x$ac_cv_header_winsock2_h" = "xyes",
+AC_CHECK_FUNCS([setppriv],
+ [AC_CHECK_HEADER([priv.h],
+ [AC_DEFINE([HAVE_DROP_PRIVILEGES],
+ [1],
+ [Define this if you have an implementation of drop_privileges()])
+ build_solaris_privs=yes])
+ ])
+
+AC_CHECK_HEADERS_ONCE([winsock2.h poll.h sys/wait.h fnmatch.h])
+AM_CONDITIONAL([BUILD_POLL],[test "x$ac_cv_header_poll_h" = "xno"])
+AM_CONDITIONAL([BUILD_WIN32_WRAPPERS],[test "x$ac_cv_header_winsock2_h" = "xyes"])
+AS_IF([test "x$ac_cv_header_winsock2_h" = "xyes"],
[AM_LDFLAGS="$AM_LDFLAGS -lws2_32"
AM_CFLAGS="$AM_CFLAGS $NO_WERROR"
AM_CXXFLAGS="$AM_CXXFLAGS $NO_WERROR"
- ])
+ ])
SOCKET_SEND_FLAGS
AX_UUID_GENERATE_TIME_SAFE
@@ -260,22 +279,23 @@ AX_UUID_GENERATE_TIME_SAFE
AX_PTHREAD(, [AC_MSG_ERROR([could not find libpthread])])
AX_PTHREAD_TIMEDJOIN_NP
+# backtrace() does not work with static builds.
+AS_IF([test "x$enable_static" = "xyes"],
+ [AC_DEFINE([AX_ENABLE_BACKTRACE],[1],[Support for backtrace().])])
+
PANDORA_ENABLE_DTRACE
AX_ENDIAN
-AX_HEX_VERSION
AX_ASSERT
-AX_CXX_COMPILER_VERSION
AX_HARDEN_COMPILER_FLAGS
AX_AM_JOBSERVER([yes])
-AC_CONFIG_FILES([
- Makefile
- docs/conf.py
- libmemcached-1.2/configure.h
- support/libmemcached.pc
- support/libmemcached.spec
- ])
+AC_CONFIG_FILES([Makefile
+ docs/conf.py
+ libmemcached-1.2/configure.h
+ support/libmemcached.pc
+ support/libmemcached.spec
+ ])
AC_OUTPUT
echo "---"
@@ -289,10 +309,13 @@ echo " * C Flags: $CFLAGS"
echo " * C++ Compiler: $CXX_VERSION"
echo " * C++ Flags: $CXXFLAGS"
echo " * CPP Flags: $CPPFLAGS"
+echo " * LIB Flags: $LIB"
echo " * Assertions enabled: $ax_enable_assert"
echo " * Debug enabled: $ax_enable_debug"
echo " * Warnings as failure: $ac_cv_warnings_as_errors"
echo " * SASL support: $ac_enable_sasl"
+echo " * make -j: $enable_jobserver"
+echo " * VCS checkout: $ac_cv_vcs_checkout"
echo ""
echo "---"
diff --git a/docs/include.am b/docs/include.am
index 9ff08438..d4b8140d 100644
--- a/docs/include.am
+++ b/docs/include.am
@@ -12,7 +12,11 @@ SPHINX_BUILDDIR = ${top_builddir}/docs
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
-ALLSPHINXOPTS = -d $(SPHINX_BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) ${top_srcdir}/docs
+ALLSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(SPHINX_BUILDDIR)
+
+.PHONY: clean-docs-check
+clean-docs-check:
+ -rm -rf docs/_build docs/doctrees man/.doctrees/
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest
@@ -114,9 +118,7 @@ text: docs/conf.py
if HAVE_RECENT_SPHINX
man:
- PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) ${top_srcdir}/man
- @echo
- @echo "Build finished. The manual pages are in ${top_srcdir}/man."
+ PYTHONPATH=$(SPHINX_BUILDDIR)/docs $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) ${top_builddir}/man
else
diff --git a/libhashkit-1.0/algorithm.h b/libhashkit-1.0/algorithm.h
index fa5f3ae5..b29e9c3e 100644
--- a/libhashkit-1.0/algorithm.h
+++ b/libhashkit-1.0/algorithm.h
@@ -1,11 +1,41 @@
-/* HashKit
- * Copyright (C) 2009 Brian Aker
- * All rights reserved.
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * HashKit library
+ *
+ * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2009 Brian Aker All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * Use and distribution licensed under the BSD license. See
- * the COPYING file in the parent directory for full text.
*/
+
/**
* @file
* @brief HashKit Header
diff --git a/libhashkit-1.0/basic_string.h b/libhashkit-1.0/basic_string.h
index f6819144..1cb17e38 100644
--- a/libhashkit-1.0/basic_string.h
+++ b/libhashkit-1.0/basic_string.h
@@ -1,6 +1,6 @@
/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
*
- * Libhashkit library
+ * HashKit library
*
* Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
*
@@ -34,6 +34,8 @@
*
*/
+
+
#pragma once
// No assumptions of NULL should be made
diff --git a/libhashkit-1.0/behavior.h b/libhashkit-1.0/behavior.h
index 0fb22588..8cc57092 100644
--- a/libhashkit-1.0/behavior.h
+++ b/libhashkit-1.0/behavior.h
@@ -1,11 +1,44 @@
-/* HashKit
- * Copyright (C) 2009 Brian Aker
- * All rights reserved.
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * HashKit library
+ *
+ * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2009 Brian Aker All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * Use and distribution licensed under the BSD license. See
- * the COPYING file in the parent directory for full text.
*/
+
+
+
+
/**
* @file
* @brief HashKit Header
diff --git a/libhashkit-1.0/configure.h.in b/libhashkit-1.0/configure.h.in
index 4fab993d..a2f70f92 100644
--- a/libhashkit-1.0/configure.h.in
+++ b/libhashkit-1.0/configure.h.in
@@ -1,12 +1,44 @@
-/* HashKit
- * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
- * Copyright (C) 2009-2010 Brian Aker
- * All rights reserved.
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * HashKit library
+ *
+ * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2009-2010 Brian Aker All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * Use and distribution licensed under the BSD license. See
- * the COPYING file in the parent directory for full text.
*/
+
+
+
+
#pragma once
#define LIBHASHKIT_VERSION_STRING "@LIBHASHKIT_VERSION_STRING@"
diff --git a/libhashkit-1.0/digest.h b/libhashkit-1.0/digest.h
index 5a226b01..c34dc8a7 100644
--- a/libhashkit-1.0/digest.h
+++ b/libhashkit-1.0/digest.h
@@ -1,11 +1,44 @@
-/* HashKit
- * Copyright (C) 2010 Brian Aker
- * All rights reserved.
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * HashKit library
+ *
+ * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2009-2010 Brian Aker All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * Use and distribution licensed under the BSD license. See
- * the COPYING file in the parent directory for full text.
*/
+
+
+
+
#pragma once
#ifdef __cplusplus
diff --git a/libhashkit-1.0/function.h b/libhashkit-1.0/function.h
index 215d978b..664a008d 100644
--- a/libhashkit-1.0/function.h
+++ b/libhashkit-1.0/function.h
@@ -1,11 +1,43 @@
-/* HashKit
- * Copyright (C) 2010 Brian Aker
- * All rights reserved.
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * HashKit library
+ *
+ * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2009-2010 Brian Aker All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * Use and distribution licensed under the BSD license. See
- * the COPYING file in the parent directory for full text.
*/
+
+
+
#pragma once
#ifdef __cplusplus
diff --git a/libhashkit-1.0/has.h b/libhashkit-1.0/has.h
index 8975c7a8..35e86163 100644
--- a/libhashkit-1.0/has.h
+++ b/libhashkit-1.0/has.h
@@ -1,8 +1,9 @@
/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
*
- * Libmemcached library
+ * HashKit library
*
- * Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2009-2010 Brian Aker All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -34,6 +35,9 @@
*
*/
+
+
+
#pragma once
#ifdef __cplusplus
diff --git a/libhashkit-1.0/hashkit.h b/libhashkit-1.0/hashkit.h
index 560763a7..da9bd363 100644
--- a/libhashkit-1.0/hashkit.h
+++ b/libhashkit-1.0/hashkit.h
@@ -2,7 +2,7 @@
*
* HashKit library
*
- * Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
* Copyright (C) 2009-2010 Brian Aker All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -36,6 +36,9 @@
*/
+
+
+
#pragma once
diff --git a/libhashkit-1.0/hashkit.hpp b/libhashkit-1.0/hashkit.hpp
index a865bf96..a953d72d 100644
--- a/libhashkit-1.0/hashkit.hpp
+++ b/libhashkit-1.0/hashkit.hpp
@@ -1,9 +1,9 @@
/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
*
- * Libmemcached library
+ * HashKit library
*
- * Copyright (C) 2011 Data Differential, http://datadifferential.com/
- * Copyright (C) 2006-2009 Brian Aker All rights reserved.
+ * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2006-2010 Brian Aker All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -35,6 +35,7 @@
*
*/
+
#pragma once
#include <libhashkit-1.0/hashkit.h>
diff --git a/libhashkit-1.0/strerror.h b/libhashkit-1.0/strerror.h
index 0785f0cc..79eb145f 100644
--- a/libhashkit-1.0/strerror.h
+++ b/libhashkit-1.0/strerror.h
@@ -1,11 +1,41 @@
-/* HashKit
- * Copyright (C) 2009 Brian Aker
- * All rights reserved.
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * HashKit library
+ *
+ * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2009-2010 Brian Aker All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * Use and distribution licensed under the BSD license. See
- * the COPYING file in the parent directory for full text.
*/
+
#pragma once
#ifdef __cplusplus
diff --git a/libhashkit-1.0/string.h b/libhashkit-1.0/string.h
index a0f23eb4..90cb3aeb 100644
--- a/libhashkit-1.0/string.h
+++ b/libhashkit-1.0/string.h
@@ -1,8 +1,9 @@
/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
*
- * Libhashkit library
+ * HashKit library
*
* Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2009-2010 Brian Aker All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -34,6 +35,7 @@
*
*/
+
#pragma once
#ifdef __cplusplus
diff --git a/libhashkit-1.0/types.h b/libhashkit-1.0/types.h
index 5a975375..b2ce4278 100644
--- a/libhashkit-1.0/types.h
+++ b/libhashkit-1.0/types.h
@@ -1,9 +1,9 @@
/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
*
- * HashKit
+ * HashKit library
*
- * Copyright (C) 2011 Data Differential, http://datadifferential.com/
- * Copyright (C) 2009 Brian Aker All rights reserved.
+ * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2009-2010 Brian Aker All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/libhashkit/algorithm.cc b/libhashkit/algorithm.cc
index 015370fd..0462df0b 100644
--- a/libhashkit/algorithm.cc
+++ b/libhashkit/algorithm.cc
@@ -2,7 +2,7 @@
*
* HashKit library
*
- * Copyright (C) 2006-2011 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2006-2012 Data Differential, http://datadifferential.com/
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/libhashkit/behavior.cc b/libhashkit/behavior.cc
index ee0efcf3..6c7a9aca 100644
--- a/libhashkit/behavior.cc
+++ b/libhashkit/behavior.cc
@@ -1,9 +1,38 @@
-/* HashKit
- * Copyright (C) 2009 Brian Aker
- * All rights reserved.
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * HashKit library
+ *
+ * Copyright (C) 2009-2012 Data Differential, http://datadifferential.com/
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * Use and distribution licensed under the BSD license. See
- * the COPYING file in the parent directory for full text.
*/
+
#include <libhashkit/common.h>
diff --git a/libhashkit/common.h b/libhashkit/common.h
index 5b0b8e0b..7affeb36 100644
--- a/libhashkit/common.h
+++ b/libhashkit/common.h
@@ -37,7 +37,7 @@
#pragma once
-#include <config.h>
+#include <mem_config.h>
#include <assert.h>
#include <errno.h>
@@ -45,6 +45,12 @@
#include <stdlib.h>
#include <math.h>
+#ifndef __WORDSIZE
+# ifdef __MINGW32__
+# define __WORDSIZE 32
+# endif
+#endif
+
#include <libhashkit-1.0/hashkit.h>
#include <libhashkit/is.h>
#include <libhashkit/string.h>
@@ -54,10 +60,8 @@
extern "C" {
#endif
-HASHKIT_LOCAL
void md5_signature(const unsigned char *key, unsigned int length, unsigned char *result);
-HASHKIT_LOCAL
int update_continuum(hashkit_st *hashkit);
#ifdef __cplusplus
diff --git a/libhashkit/crc32.cc b/libhashkit/crc32.cc
index f07958ca..fe9fe711 100644
--- a/libhashkit/crc32.cc
+++ b/libhashkit/crc32.cc
@@ -1,3 +1,39 @@
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * HashKit library
+ *
+ * Copyright (C) 2009-2012 Data Differential, http://datadifferential.com/
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
/* The crc32 functions and data was originally written by Spencer
* Garrett <srg@quick.com> and was gleaned from the PostgreSQL source
* tree via the files contrib/ltree/crc32.[ch] and from FreeBSD at
diff --git a/libhashkit/digest.cc b/libhashkit/digest.cc
index ce94cc76..3b220d08 100644
--- a/libhashkit/digest.cc
+++ b/libhashkit/digest.cc
@@ -1,11 +1,40 @@
-/* HashKit
- * Copyright (C) 2010 Brian Aker
- * All rights reserved.
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * HashKit library
+ *
+ * Copyright (C) 2010-2012 Data Differential, http://datadifferential.com/
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * Use and distribution licensed under the BSD license. See
- * the COPYING file in the parent directory for full text.
*/
+
#include <libhashkit/common.h>
uint32_t hashkit_digest(const hashkit_st *self, const char *key, size_t key_length)
diff --git a/libhashkit/fnv_32.cc b/libhashkit/fnv_32.cc
index 5c885164..52eea80d 100644
--- a/libhashkit/fnv_32.cc
+++ b/libhashkit/fnv_32.cc
@@ -2,7 +2,7 @@
*
* HashKit library
*
- * Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
* Copyright (C) 2009 Brian Aker All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/libhashkit/fnv_64.cc b/libhashkit/fnv_64.cc
index 302215a0..68e4dd07 100644
--- a/libhashkit/fnv_64.cc
+++ b/libhashkit/fnv_64.cc
@@ -2,7 +2,7 @@
*
* HashKit library
*
- * Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
* Copyright (C) 2009 Brian Aker All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/libhashkit/has.cc b/libhashkit/has.cc
index 111e7153..2230a56a 100644
--- a/libhashkit/has.cc
+++ b/libhashkit/has.cc
@@ -1,8 +1,9 @@
/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
*
- * Libmemcached library
+ * HashKit library
*
- * Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2009 Brian Aker All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -34,6 +35,7 @@
*
*/
+
#include <libhashkit/common.h>
bool libhashkit_has_algorithm(const hashkit_hash_algorithm_t algo)
diff --git a/libhashkit/hashkit.cc b/libhashkit/hashkit.cc
index e397871f..e2528b97 100644
--- a/libhashkit/hashkit.cc
+++ b/libhashkit/hashkit.cc
@@ -1,11 +1,41 @@
-/* HashKit
- * Copyright (C) 2006-2009 Brian Aker
- * All rights reserved.
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * HashKit library
+ *
+ * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2006-2009 Brian Aker All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * Use and distribution licensed under the BSD license. See
- * the COPYING file in the parent directory for full text.
*/
+
#include <libhashkit/common.h>
static inline void _hashkit_init(hashkit_st *self)
diff --git a/libhashkit/hsieh.cc b/libhashkit/hsieh.cc
index f7067909..ca88f8d6 100644
--- a/libhashkit/hsieh.cc
+++ b/libhashkit/hsieh.cc
@@ -1,3 +1,40 @@
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * HashKit library
+ *
+ * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2006-2009 Brian Aker All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
/* By Paul Hsieh (C) 2004, 2005. Covered under the Paul Hsieh
* derivative license.
* See: http://www.azillionmonkeys.com/qed/weblicense.html for license
diff --git a/libhashkit/jenkins.cc b/libhashkit/jenkins.cc
index 5f85ad62..77f99f0d 100644
--- a/libhashkit/jenkins.cc
+++ b/libhashkit/jenkins.cc
@@ -1,3 +1,40 @@
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * HashKit library
+ *
+ * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2006-2009 Brian Aker All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
/*
*
* By Bob Jenkins, 2006. bob_jenkins@burtleburtle.net. You may use this
diff --git a/libhashkit/ketama.cc b/libhashkit/ketama.cc
index 45052c22..eaa8442c 100644
--- a/libhashkit/ketama.cc
+++ b/libhashkit/ketama.cc
@@ -1,11 +1,41 @@
-/* HashKit
- * Copyright (C) 2006-2009 Brian Aker
- * All rights reserved.
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * HashKit library
+ *
+ * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2006-2009 Brian Aker All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * Use and distribution licensed under the BSD license. See
- * the COPYING file in the parent directory for full text.
*/
+
#include <libhashkit/common.h>
#include <math.h>
diff --git a/libhashkit/md5.cc b/libhashkit/md5.cc
index 86822f54..71069dbd 100644
--- a/libhashkit/md5.cc
+++ b/libhashkit/md5.cc
@@ -1,3 +1,40 @@
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * HashKit library
+ *
+ * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2006-2009 Brian Aker All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
/*
This Library has been modified from its original form by
Brian Aker (brian@tangent.org)
diff --git a/libhashkit/murmur.cc b/libhashkit/murmur.cc
index d30e850d..e15e5108 100644
--- a/libhashkit/murmur.cc
+++ b/libhashkit/murmur.cc
@@ -1,3 +1,40 @@
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * HashKit library
+ *
+ * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2006-2009 Brian Aker All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
/*
"Murmur" hash provided by Austin, tanjent@gmail.com
http://murmurhash.googlepages.com/
diff --git a/libhashkit/one_at_a_time.cc b/libhashkit/one_at_a_time.cc
index aeb11b12..647f3c18 100644
--- a/libhashkit/one_at_a_time.cc
+++ b/libhashkit/one_at_a_time.cc
@@ -1,11 +1,41 @@
-/* HashKit
- * Copyright (C) 2009 Brian Aker
- * All rights reserved.
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * HashKit library
+ *
+ * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2006-2009 Brian Aker All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * Use and distribution licensed under the BSD license. See
- * the COPYING file in the parent directory for full text.
*/
+
/*
This has is Jenkin's "One at A time Hash".
http://en.wikipedia.org/wiki/Jenkins_hash_function
diff --git a/libhashkit/rijndael.cc b/libhashkit/rijndael.cc
index 1ce2d2e5..24b73628 100644
--- a/libhashkit/rijndael.cc
+++ b/libhashkit/rijndael.cc
@@ -1,3 +1,40 @@
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * HashKit library
+ *
+ * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+
/**
* rijndael-alg-fst.c
*
diff --git a/libhashkit/strerror.cc b/libhashkit/strerror.cc
index 8d7246c6..f67e5c5d 100644
--- a/libhashkit/strerror.cc
+++ b/libhashkit/strerror.cc
@@ -1,11 +1,42 @@
-/* HashKit
- * Copyright (C) 2009 Brian Aker
- * All rights reserved.
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * HashKit library
+ *
+ * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2009 Data Differential, http://datadifferential.com/
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * Use and distribution licensed under the BSD license. See
- * the COPYING file in the parent directory for full text.
*/
+
+
#include <libhashkit/common.h>
const char *hashkit_strerror(hashkit_st *ptr, hashkit_return_t rc)
diff --git a/libhashkit/string.h b/libhashkit/string.h
index a36d23c9..8aee89e5 100644
--- a/libhashkit/string.h
+++ b/libhashkit/string.h
@@ -1,6 +1,6 @@
/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
*
- * Libhashkit library
+ * Hashkit library
*
* Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
*
diff --git a/libmemcached-1.2/platform.h b/libmemcached-1.2/platform.h
index 763febaa..01ce276c 100644
--- a/libmemcached-1.2/platform.h
+++ b/libmemcached-1.2/platform.h
@@ -38,19 +38,21 @@
#pragma once
-#ifdef WIN32
+#if defined(WIN32) || defined(__MINGW32__)
+# include <winsock2.h>
+# include <ws2tcpip.h>
-#include <winsock2.h>
-#include <ws2tcpip.h>
typedef short in_port_t;
typedef SOCKET memcached_socket_t;
+
#else
+# include <sys/socket.h>
+# include <netinet/in.h>
+# include <arpa/inet.h>
+# include <netdb.h>
+# include <sys/un.h>
+# include <netinet/tcp.h>
+
typedef int memcached_socket_t;
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <sys/un.h>
-#include <netinet/tcp.h>
#endif /* WIN32 */
diff --git a/libmemcached-1.2/return.h b/libmemcached-1.2/return.h
index 65dc63af..781603b8 100644
--- a/libmemcached-1.2/return.h
+++ b/libmemcached-1.2/return.h
@@ -63,6 +63,7 @@ static inline bool memcached_fatal(memcached_return_t rc)
{
return (
rc != MEMCACHED_BUFFERED &&
+ rc != MEMCACHED_CLIENT_ERROR &&
rc != MEMCACHED_DATA_EXISTS &&
rc != MEMCACHED_DELETED &&
rc != MEMCACHED_E2BIG &&
diff --git a/libmemcached-1.2/struct/server.h b/libmemcached-1.2/struct/server.h
index a8a30565..33bdc049 100644
--- a/libmemcached-1.2/struct/server.h
+++ b/libmemcached-1.2/struct/server.h
@@ -38,20 +38,20 @@
#pragma once
-#ifndef WIN32
-#include <netdb.h>
+#ifdef HAVE_NETDB_H
+# include <netdb.h>
#endif
#ifdef NI_MAXHOST
-#define MEMCACHED_NI_MAXHOST NI_MAXHOST
+# define MEMCACHED_NI_MAXHOST NI_MAXHOST
#else
-#define MEMCACHED_NI_MAXHOST 1025
+# define MEMCACHED_NI_MAXHOST 1025
#endif
#ifdef NI_MAXSERV
-#define MEMCACHED_NI_MAXSERV NI_MAXSERV
+# define MEMCACHED_NI_MAXSERV NI_MAXSERV
#else
-#define MEMCACHED_NI_MAXSERV 32
+# define MEMCACHED_NI_MAXSERV 32
#endif
enum memcached_server_state_t {
diff --git a/libmemcached/assert.hpp b/libmemcached/assert.hpp
index 6858879c..28948c3c 100644
--- a/libmemcached/assert.hpp
+++ b/libmemcached/assert.hpp
@@ -37,9 +37,6 @@
#pragma once
-#include <cstdlib>
-#include <cstdio>
-
#ifdef NDEBUG
#define assert_msg(__expr, __mesg) (void)(__expr); (void)(__mesg);
#else
diff --git a/libmemcached/backtrace.cc b/libmemcached/backtrace.cc
index 81cfddef..d2979016 100644
--- a/libmemcached/backtrace.cc
+++ b/libmemcached/backtrace.cc
@@ -37,10 +37,6 @@
#include <libmemcached/common.h>
-#include <cstring>
-#include <cstdlib>
-#include <cstdio>
-
#ifdef HAVE_EXECINFO_H
# include <execinfo.h>
#endif
diff --git a/libmemcached/behavior.cc b/libmemcached/behavior.cc
index c381a513..d9a7cf60 100644
--- a/libmemcached/behavior.cc
+++ b/libmemcached/behavior.cc
@@ -427,7 +427,7 @@ uint64_t memcached_behavior_get(memcached_st *ptr,
return 0;
}
- if (getsockopt(instance->fd, SOL_SOCKET, SO_SNDBUF, &sock_size, &sock_length) < 0)
+ if (getsockopt(instance->fd, SOL_SOCKET, SO_SNDBUF, (char*)&sock_size, &sock_length) < 0)
{
memcached_set_errno(*ptr, get_socket_errno(), MEMCACHED_AT);
return 0; /* Zero means error */
@@ -463,7 +463,7 @@ uint64_t memcached_behavior_get(memcached_st *ptr,
return 0;
}
- if (getsockopt(instance->fd, SOL_SOCKET, SO_RCVBUF, &sock_size, &sock_length) < 0)
+ if (getsockopt(instance->fd, SOL_SOCKET, SO_RCVBUF, (char*)&sock_size, &sock_length) < 0)
{
memcached_set_errno(*ptr, get_socket_errno(), MEMCACHED_AT);
return 0; /* Zero means error */
diff --git a/libmemcached/byteorder.cc b/libmemcached/byteorder.cc
index 7e141756..1a96d987 100644
--- a/libmemcached/byteorder.cc
+++ b/libmemcached/byteorder.cc
@@ -58,28 +58,21 @@ static inline uint64_t swap64(uint64_t in)
}
#endif
-#ifdef HAVE_HTONLL
uint64_t memcached_ntohll(uint64_t value)
{
+#ifdef HAVE_HTONLL
return ntohll(value);
-}
-
-uint64_t memcached_htonll(uint64_t value)
-{
- return htonll(value);
-}
-
-#else // HAVE_HTONLL
-
-uint64_t memcached_ntohll(uint64_t value)
-{
+#else
return swap64(value);
+#endif
}
uint64_t memcached_htonll(uint64_t value)
{
+#ifdef HAVE_HTONLL
+ return htonll(value);
+#else
return swap64(value);
+#endif
}
-
-#endif // HAVE_HTONLL
diff --git a/libmemcached/byteorder.h b/libmemcached/byteorder.h
index 92687c1d..a7d108d3 100644
--- a/libmemcached/byteorder.h
+++ b/libmemcached/byteorder.h
@@ -41,10 +41,8 @@
extern "C" {
#endif
-LIBMEMCACHED_LOCAL
uint64_t memcached_ntohll(uint64_t);
-LIBMEMCACHED_LOCAL
uint64_t memcached_htonll(uint64_t);
#ifdef __cplusplus
diff --git a/libmemcached/common.h b/libmemcached/common.h
index 935bd12c..3dfa947e 100644
--- a/libmemcached/common.h
+++ b/libmemcached/common.h
@@ -42,51 +42,69 @@
#pragma once
-#include <config.h>
+#include <mem_config.h>
#ifdef __cplusplus
-# include <cstdio>
-# include <cstdlib>
-# include <cstring>
-# include <ctime>
-# include <cctype>
-# include <cerrno>
-# include <climits>
+# include <cstddef>
+# include <cstdio>
+# include <cstdlib>
+# include <cstring>
+# include <ctime>
+# include <cctype>
+# include <cerrno>
+# include <climits>
#else
-# ifdef HAVE_STDLIB_H
-# include <stdio.h>
-# endif
-# ifdef HAVE_STDLIB_H
-# include <stdlib.h>
-# endif
-# include <string.h>
+# ifdef HAVE_STDDEF_H
+# include <stddef.h>
+# endif
+# ifdef HAVE_STDLIB_H
+# include <stdio.h>
+# endif
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+# include <string.h>
+# ifdef HAVE_TIME_H
# include <time.h>
-# ifdef HAVE_ERRNO_H
-# include <errno.h>
-# endif
-# ifdef HAVE_LIMITS_H
-# include <limits.h>
-# endif
+# endif
+# ifdef HAVE_ERRNO_H
+# include <errno.h>
+# endif
+# ifdef HAVE_LIMITS_H
+# include <limits.h>
+# endif
+#endif
+
+#ifdef HAVE_SYS_UN_H
+# include <sys/un.h>
+#endif
+
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
#endif
#ifdef HAVE_FCNTL_H
-# include <fcntl.h>
+# include <fcntl.h>
#endif
#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
+# include <sys/types.h>
#endif
#ifdef HAVE_UNISTD_H
-# include <unistd.h>
+# include <unistd.h>
+#endif
+
+#ifdef HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
#endif
#ifdef HAVE_STRINGS_H
-# include <strings.h>
+# include <strings.h>
#endif
#ifdef HAVE_DLFCN_H
-# include <dlfcn.h>
+# include <dlfcn.h>
#endif
#include <libmemcached-1.2/memcached.h>
@@ -102,6 +120,14 @@
# include "poll/poll.h"
#endif
+#ifndef POLLHUP
+# define POLLHUP 0x0010
+#endif
+
+#ifndef POLLNVAL
+# define POLLNVAL 0x0020
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/libmemcached/connect.cc b/libmemcached/connect.cc
index 65be51a0..da6cf802 100644
--- a/libmemcached/connect.cc
+++ b/libmemcached/connect.cc
@@ -39,15 +39,13 @@
#include <libmemcached/common.h>
#include <cassert>
-#include <ctime>
-#include <sys/time.h>
#ifndef SOCK_CLOEXEC
# define SOCK_CLOEXEC 0
#endif
#ifndef SOCK_NONBLOCK
-# define SOCK_NONBLOCK 0
+# define SOCK_NONBLOCK 0
#endif
#ifndef FD_CLOEXEC
@@ -95,7 +93,7 @@ static memcached_return_t connect_poll(org::libmemcached::Instance* server)
{
int err;
socklen_t len= sizeof(err);
- if (getsockopt(server->fd, SOL_SOCKET, SO_ERROR, &err, &len) == 0)
+ if (getsockopt(server->fd, SOL_SOCKET, SO_ERROR, (char*)&err, &len) == 0)
{
if (err == 0)
{
@@ -126,7 +124,7 @@ static memcached_return_t connect_poll(org::libmemcached::Instance* server)
{
int err;
socklen_t len= sizeof (err);
- if (getsockopt(fds[0].fd, SOL_SOCKET, SO_ERROR, &err, &len) == 0)
+ if (getsockopt(fds[0].fd, SOL_SOCKET, SO_ERROR, (char*)&err, &len) == 0)
{
// We check the value to see what happened wth the socket.
if (err == 0)
@@ -300,7 +298,7 @@ static void set_socket_options(org::libmemcached::Instance* server)
waittime.tv_usec= server->root->snd_timeout % 1000000;
int error= setsockopt(server->fd, SOL_SOCKET, SO_SNDTIMEO,
- &waittime, (socklen_t)sizeof(struct timeval));
+ (char*)&waittime, (socklen_t)sizeof(struct timeval));
(void)error;
assert(error == 0);
}
@@ -315,7 +313,7 @@ static void set_socket_options(org::libmemcached::Instance* server)
waittime.tv_usec= server->root->rcv_timeout % 1000000;
int error= setsockopt(server->fd, SOL_SOCKET, SO_RCVTIMEO,
- &waittime, (socklen_t)sizeof(struct timeval));
+ (char*)&waittime, (socklen_t)sizeof(struct timeval));
(void)(error);
assert(error == 0);
}
@@ -346,7 +344,7 @@ static void set_socket_options(org::libmemcached::Instance* server)
linger.l_onoff= 1;
linger.l_linger= 0; /* By default on close() just drop the socket */
int error= setsockopt(server->fd, SOL_SOCKET, SO_LINGER,
- &linger, (socklen_t)sizeof(struct linger));
+ (char*)&linger, (socklen_t)sizeof(struct linger));
(void)(error);
assert(error == 0);
}
@@ -356,7 +354,7 @@ static void set_socket_options(org::libmemcached::Instance* server)
int flag= 1;
int error= setsockopt(server->fd, IPPROTO_TCP, TCP_NODELAY,
- &flag, (socklen_t)sizeof(int));
+ (char*)&flag, (socklen_t)sizeof(int));
(void)(error);
assert(error == 0);
}
@@ -366,7 +364,7 @@ static void set_socket_options(org::libmemcached::Instance* server)
int flag= 1;
int error= setsockopt(server->fd, SOL_SOCKET, SO_KEEPALIVE,
- &flag, (socklen_t)sizeof(int));
+ (char*)&flag, (socklen_t)sizeof(int));
(void)(error);
assert(error == 0);
}
@@ -375,7 +373,7 @@ static void set_socket_options(org::libmemcached::Instance* server)
if (server->root->tcp_keepidle > 0)
{
int error= setsockopt(server->fd, IPPROTO_TCP, TCP_KEEPIDLE,
- &server->root->tcp_keepidle, (socklen_t)sizeof(int));
+ (char*)&server->root->tcp_keepidle, (socklen_t)sizeof(int));
(void)(error);
assert(error == 0);
}
@@ -384,7 +382,7 @@ static void set_socket_options(org::libmemcached::Instance* server)
if (server->root->send_size > 0)
{
int error= setsockopt(server->fd, SOL_SOCKET, SO_SNDBUF,
- &server->root->send_size, (socklen_t)sizeof(int));
+ (char*)&server->root->send_size, (socklen_t)sizeof(int));
(void)(error);
assert(error == 0);
}
@@ -392,7 +390,7 @@ static void set_socket_options(org::libmemcached::Instance* server)
if (server->root->recv_size > 0)
{
int error= setsockopt(server->fd, SOL_SOCKET, SO_RCVBUF,
- &server->root->recv_size, (socklen_t)sizeof(int));
+ (char*)&server->root->recv_size, (socklen_t)sizeof(int));
(void)(error);
assert(error == 0);
}
@@ -512,13 +510,16 @@ static memcached_return_t network_connect(org::libmemcached::Instance* server)
type|= SOCK_NONBLOCK;
}
- if ((server->fd= socket(server->address_info_next->ai_family,
- type,
- server->address_info_next->ai_protocol)) < 0)
+ server->fd= socket(server->address_info_next->ai_family,
+ type,
+ server->address_info_next->ai_protocol);
+
+ if (int(server->fd) == SOCKET_ERROR)
{
return memcached_set_errno(*server, get_socket_errno(), NULL);
}
+#ifdef HAVE_FCNTL
// If SOCK_CLOEXEC exists then we don't need to call the following
if (SOCK_CLOEXEC == 0)
{
@@ -531,6 +532,7 @@ static memcached_return_t network_connect(org::libmemcached::Instance* server)
} while (rval == -1 && (errno == EINTR or errno == EAGAIN));
}
}
+#endif
set_socket_options(server);
diff --git a/libmemcached/csl/include.am b/libmemcached/csl/include.am
index f6aeedac..fe77aa7d 100644
--- a/libmemcached/csl/include.am
+++ b/libmemcached/csl/include.am
@@ -15,4 +15,22 @@ libmemcached_libmemcached_la_SOURCES+= libmemcached/csl/context.cc
libmemcached_libmemcached_la_SOURCES+= libmemcached/csl/parser.cc
libmemcached_libmemcached_la_SOURCES+= libmemcached/csl/scanner.cc
-include libmemcached/csl/parser.am
+EXTRA_DIST+= libmemcached/csl/parser.yy
+EXTRA_DIST+= libmemcached/csl/scanner.l
+
+MAINTAINERCLEANFILES+= libmemcached/csl/parser.h
+MAINTAINERCLEANFILES+= libmemcached/csl/parser.cc
+MAINTAINERCLEANFILES+= libmemcached/csl/scanner.h
+MAINTAINERCLEANFILES+= libmemcached/csl/scanner.cc
+
+BUILT_SOURCES+= libmemcached/csl/parser.h libmemcached/csl/scanner.h
+
+libmemcached/csl/parser.h: libmemcached/csl/parser.cc
+
+libmemcached/csl/parser.cc: libmemcached/csl/parser.yy libmemcached/csl/scanner.l libmemcached/csl/scanner.h
+ $(AM_V_YACC)$(am__skipyacc) $(YACC) $(YLFLAGS) $(AM_YFLAGS) -o $@ $<
+
+libmemcached/csl/scanner.h: libmemcached/csl/scanner.cc
+
+libmemcached/csl/scanner.cc: libmemcached/csl/scanner.l libmemcached/csl/parser.yy
+ $(AM_V_GEN)$(LEX) $<
diff --git a/libmemcached/csl/parser.am b/libmemcached/csl/parser.am
deleted file mode 100644
index 13160d09..00000000
--- a/libmemcached/csl/parser.am
+++ /dev/null
@@ -1,16 +0,0 @@
-# vim:ft=automake
-# included from Top Level Makefile.am
-# All paths should be given relative to the root
-
-EXTRA_DIST+= libmemcached/csl/parser.yy
-EXTRA_DIST+= libmemcached/csl/scanner.l
-
-libmemcached/csl/parser.h: libmemcached/csl/parser.cc
-
-libmemcached/csl/parser.cc: libmemcached/csl/parser.yy libmemcached/csl/scanner.l libmemcached/csl/scanner.h
- $(AM_V_YACC)$(am__skipyacc) $(YACC) $(YLFLAGS) $(AM_YFLAGS) -o $@ $<
-
-libmemcached/csl/scanner.h: libmemcached/csl/scanner.cc
-
-libmemcached/csl/scanner.cc: libmemcached/csl/scanner.l libmemcached/csl/parser.yy
- $(AM_V_GEN)$(LEX) $<
diff --git a/libmemcached/csl/parser.cc b/libmemcached/csl/parser.cc
deleted file mode 100644
index 6653819b..00000000
--- a/libmemcached/csl/parser.cc
+++ /dev/null
@@ -1,2426 +0,0 @@
-/* A Bison parser, made by GNU Bison 2.5. */
-
-/* Bison implementation for Yacc-like parsers in C
-
- Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* As a special exception, you may create a larger work that contains
- part or all of the Bison parser skeleton and distribute that work
- under terms of your choice, so long as that work isn't itself a
- parser generator using the skeleton or a modified version thereof
- as a parser skeleton. Alternatively, if you modify or redistribute
- the parser skeleton itself, you may (at your option) remove this
- special exception, which will cause the skeleton and the resulting
- Bison output files to be licensed under the GNU General Public
- License without this special exception.
-
- This special exception was added by the Free Software Foundation in
- version 2.2 of Bison. */
-
-/* C LALR(1) parser skeleton written by Richard Stallman, by
- simplifying the original so-called "semantic" parser. */
-
-/* All symbols defined below should begin with yy or YY, to avoid
- infringing on user name space. This should be done even for local
- variables, as they might otherwise be expanded by user macros.
- There are some unavoidable exceptions within include files to
- define necessary library symbols; they are noted "INFRINGES ON
- USER NAME SPACE" below. */
-
-/* Identify Bison output. */
-#define YYBISON 1
-
-/* Bison version. */
-#define YYBISON_VERSION "2.5"
-
-/* Skeleton name. */
-#define YYSKELETON_NAME "yacc.c"
-
-/* Pure parsers. */
-#define YYPURE 1
-
-/* Push parsers. */
-#define YYPUSH 0
-
-/* Pull parsers. */
-#define YYPULL 1
-
-/* Using locations. */
-#define YYLSP_NEEDED 0
-
-/* Substitute the variable and function names. */
-#define yyparse config_parse
-#define yylex config_lex
-#define yyerror config_error
-#define yylval config_lval
-#define yychar config_char
-#define yydebug config_debug
-#define yynerrs config_nerrs
-
-
-/* Copy the first part of user declarations. */
-
-/* Line 268 of yacc.c */
-#line 52 "libmemcached/csl/parser.yy"
-
-
-#include <libmemcached/csl/common.h>
-#include <libmemcached/options.hpp>
-
-#include <libmemcached/csl/context.h>
-#include <libmemcached/csl/symbol.h>
-#include <libmemcached/csl/scanner.h>
-
-#ifndef __INTEL_COMPILER
-#pragma GCC diagnostic ignored "-Wold-style-cast"
-#endif
-
-#ifndef __INTEL_COMPILER
-#ifndef __clang__
-#pragma GCC diagnostic ignored "-Wlogical-op"
-#endif
-#endif
-
-int conf_lex(YYSTYPE* lvalp, void* scanner);
-
-#define select_yychar(__context) yychar == UNKNOWN ? ( (__context)->previous_token == END ? UNKNOWN : (__context)->previous_token ) : yychar
-
-#define stryytname(__yytokentype) ((__yytokentype) < YYNTOKENS ) ? yytname[(__yytokentype)] : ""
-
-#define parser_abort(__context, __error_message) do { (__context)->abort((__error_message), yytokentype(select_yychar(__context)), stryytname(YYTRANSLATE(select_yychar(__context)))); YYABORT; } while (0)
-
-// This is bison calling error.
-inline void __config_error(Context *context, yyscan_t *scanner, const char *error, int last_token, const char *last_token_str)
-{
- if (not context->end())
- {
- context->error(error, yytokentype(last_token), last_token_str);
- }
- else
- {
- context->error(error, yytokentype(last_token), last_token_str);
- }
-}
-
-#define config_error(__context, __scanner, __error_msg) do { __config_error((__context), (__scanner), (__error_msg), select_yychar(__context), stryytname(YYTRANSLATE(select_yychar(__context)))); } while (0)
-
-
-
-
-/* Line 268 of yacc.c */
-#line 125 "libmemcached/csl/parser.cc"
-
-/* Enabling traces. */
-#ifndef YYDEBUG
-# define YYDEBUG 1
-#endif
-
-/* Enabling verbose error messages. */
-#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
-#else
-# define YYERROR_VERBOSE 1
-#endif
-
-/* Enabling the token table. */
-#ifndef YYTOKEN_TABLE
-# define YYTOKEN_TABLE 0
-#endif
-
-
-/* Tokens. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- COMMENT = 258,
- END = 259,
- ERROR = 260,
- RESET = 261,
- PARSER_DEBUG = 262,
- INCLUDE = 263,
- CONFIGURE_FILE = 264,
- EMPTY_LINE = 265,
- SERVER = 266,
- SOCKET = 267,
- SERVERS = 268,
- SERVERS_OPTION = 269,
- UNKNOWN_OPTION = 270,
- UNKNOWN = 271,
- BINARY_PROTOCOL = 272,
- BUFFER_REQUESTS = 273,
- CONNECT_TIMEOUT = 274,
- DISTRIBUTION = 275,
- HASH = 276,
- HASH_WITH_NAMESPACE = 277,
- IO_BYTES_WATERMARK = 278,
- IO_KEY_PREFETCH = 279,
- IO_MSG_WATERMARK = 280,
- KETAMA_HASH = 281,
- KETAMA_WEIGHTED = 282,
- NOREPLY = 283,
- NUMBER_OF_REPLICAS = 284,
- POLL_TIMEOUT = 285,
- RANDOMIZE_REPLICA_READ = 286,
- RCV_TIMEOUT = 287,
- REMOVE_FAILED_SERVERS = 288,
- RETRY_TIMEOUT = 289,
- SND_TIMEOUT = 290,
- SOCKET_RECV_SIZE = 291,
- SOCKET_SEND_SIZE = 292,
- SORT_HOSTS = 293,
- SUPPORT_CAS = 294,
- USER_DATA = 295,
- USE_UDP = 296,
- VERIFY_KEY = 297,
- _TCP_KEEPALIVE = 298,
- _TCP_KEEPIDLE = 299,
- _TCP_NODELAY = 300,
- FETCH_VERSION = 301,
- NAMESPACE = 302,
- POOL_MIN = 303,
- POOL_MAX = 304,
- MD5 = 305,
- CRC = 306,
- FNV1_64 = 307,
- FNV1A_64 = 308,
- FNV1_32 = 309,
- FNV1A_32 = 310,
- HSIEH = 311,
- MURMUR = 312,
- JENKINS = 313,
- CONSISTENT = 314,
- MODULA = 315,
- RANDOM = 316,
- TRUE = 317,
- FALSE = 318,
- FLOAT = 319,
- NUMBER = 320,
- PORT = 321,
- WEIGHT_START = 322,
- IPADDRESS = 323,
- HOSTNAME = 324,
- STRING = 325,
- QUOTED_STRING = 326,
- FILE_PATH = 327
- };
-#endif
-
-
-
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
-# define YYSTYPE_IS_DECLARED 1
-#endif
-
-
-/* Copy the second part of user declarations. */
-
-
-/* Line 343 of yacc.c */
-#line 238 "libmemcached/csl/parser.cc"
-
-#ifdef short
-# undef short
-#endif
-
-#ifdef YYTYPE_UINT8
-typedef YYTYPE_UINT8 yytype_uint8;
-#else
-typedef unsigned char yytype_uint8;
-#endif
-
-#ifdef YYTYPE_INT8
-typedef YYTYPE_INT8 yytype_int8;
-#elif (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-typedef signed char yytype_int8;
-#else
-typedef short int yytype_int8;
-#endif
-
-#ifdef YYTYPE_UINT16
-typedef YYTYPE_UINT16 yytype_uint16;
-#else
-typedef unsigned short int yytype_uint16;
-#endif
-
-#ifdef YYTYPE_INT16
-typedef YYTYPE_INT16 yytype_int16;
-#else
-typedef short int yytype_int16;
-#endif
-
-#ifndef YYSIZE_T
-# ifdef __SIZE_TYPE__
-# define YYSIZE_T __SIZE_TYPE__
-# elif defined size_t
-# define YYSIZE_T size_t
-# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
-# define YYSIZE_T size_t
-# else
-# define YYSIZE_T unsigned int
-# endif
-#endif
-
-#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
-
-#ifndef YY_
-# if defined YYENABLE_NLS && YYENABLE_NLS
-# if ENABLE_NLS
-# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
-# define YY_(msgid) dgettext ("bison-runtime", msgid)
-# endif
-# endif
-# ifndef YY_
-# define YY_(msgid) msgid
-# endif
-#endif
-
-/* Suppress unused-variable warnings by "using" E. */
-#if ! defined lint || defined __GNUC__
-# define YYUSE(e) ((void) (e))
-#else
-# define YYUSE(e) /* empty */
-#endif
-
-/* Identity function, used to suppress warnings about constant conditions. */
-#ifndef lint
-# define YYID(n) (n)
-#else
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static int
-YYID (int yyi)
-#else
-static int
-YYID (yyi)
- int yyi;
-#endif
-{
- return yyi;
-}
-#endif
-
-#if ! defined yyoverflow || YYERROR_VERBOSE
-
-/* The parser invokes alloca or malloc; define the necessary symbols. */
-
-# ifdef YYSTACK_USE_ALLOCA
-# if YYSTACK_USE_ALLOCA
-# ifdef __GNUC__
-# define YYSTACK_ALLOC __builtin_alloca
-# elif defined __BUILTIN_VA_ARG_INCR
-# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
-# elif defined _AIX
-# define YYSTACK_ALLOC __alloca
-# elif defined _MSC_VER
-# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
-# define alloca _alloca
-# else
-# define YYSTACK_ALLOC alloca
-# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# ifndef EXIT_SUCCESS
-# define EXIT_SUCCESS 0
-# endif
-# endif
-# endif
-# endif
-# endif
-
-# ifdef YYSTACK_ALLOC
- /* Pacify GCC's `empty if-body' warning. */
-# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
-# ifndef YYSTACK_ALLOC_MAXIMUM
- /* The OS might guarantee only one guard page at the bottom of the stack,
- and a page size can be as small as 4096 bytes. So we cannot safely
- invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
- to allow for a few compiler-allocated temporary stack slots. */
-# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
-# endif
-# else
-# define YYSTACK_ALLOC YYMALLOC
-# define YYSTACK_FREE YYFREE
-# ifndef YYSTACK_ALLOC_MAXIMUM
-# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
-# endif
-# if (defined __cplusplus && ! defined EXIT_SUCCESS \
- && ! ((defined YYMALLOC || defined malloc) \
- && (defined YYFREE || defined free)))
-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# ifndef EXIT_SUCCESS
-# define EXIT_SUCCESS 0
-# endif
-# endif
-# ifndef YYMALLOC
-# define YYMALLOC malloc
-# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
-# endif
-# endif
-# ifndef YYFREE
-# define YYFREE free
-# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-void free (void *); /* INFRINGES ON USER NAME SPACE */
-# endif
-# endif
-# endif
-#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
-
-
-#if (! defined yyoverflow \
- && (! defined __cplusplus \
- || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
-
-/* A type that is properly aligned for any stack member. */
-union yyalloc
-{
- yytype_int16 yyss_alloc;
- YYSTYPE yyvs_alloc;
-};
-
-/* The size of the maximum gap between one aligned stack and the next. */
-# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
-
-/* The size of an array large to enough to hold all stacks, each with
- N elements. */
-# define YYSTACK_BYTES(N) \
- ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
- + YYSTACK_GAP_MAXIMUM)
-
-# define YYCOPY_NEEDED 1
-
-/* Relocate STACK from its old location to the new one. The
- local variables YYSIZE and YYSTACKSIZE give the old and new number of
- elements in the stack, and YYPTR gives the new location of the
- stack. Advance YYPTR to a properly aligned location for the next
- stack. */
-# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
- do \
- { \
- YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
- Stack = &yyptr->Stack_alloc; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
- yyptr += yynewbytes / sizeof (*yyptr); \
- } \
- while (YYID (0))
-
-#endif
-
-#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
-/* Copy COUNT objects from FROM to TO. The source and destination do
- not overlap. */
-# ifndef YYCOPY
-# if defined __GNUC__ && 1 < __GNUC__
-# define YYCOPY(To, From, Count) \
- __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
-# else
-# define YYCOPY(To, From, Count) \
- do \
- { \
- YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (To)[yyi] = (From)[yyi]; \
- } \
- while (YYID (0))
-# endif
-# endif
-#endif /* !YYCOPY_NEEDED */
-
-/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 72
-/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 75
-
-/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 76
-/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 12
-/* YYNRULES -- Number of rules. */
-#define YYNRULES 68
-/* YYNRULES -- Number of states. */
-#define YYNSTATES 86
-
-/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
-#define YYUNDEFTOK 2
-#define YYMAXUTOK 327
-
-#define YYTRANSLATE(YYX) \
- ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-
-/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
-static const yytype_uint8 yytranslate[] =
-{
- 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 75, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 64, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 65, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
- 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
- 55, 56, 57, 58, 59, 60, 61, 62, 63, 66,
- 67, 68, 69, 70, 71, 72, 73, 74
-};
-
-#if YYDEBUG
-/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
- YYRHS. */
-static const yytype_uint8 yyprhs[] =
-{
- 0, 0, 3, 5, 9, 11, 13, 15, 17, 19,
- 21, 23, 27, 32, 37, 41, 44, 47, 50, 52,
- 55, 57, 60, 65, 68, 71, 73, 75, 77, 79,
- 81, 83, 85, 87, 89, 91, 93, 95, 97, 99,
- 101, 103, 105, 107, 109, 111, 113, 115, 117, 119,
- 121, 123, 124, 126, 127, 129, 131, 133, 135, 137,
- 139, 141, 143, 145, 147, 149, 151, 153, 155
-};
-
-/* YYRHS -- A `-1'-separated list of the rules' RHS. */
-static const yytype_int8 yyrhs[] =
-{
- 77, 0, -1, 78, -1, 77, 75, 78, -1, 79,
- -1, 3, -1, 10, -1, 4, -1, 5, -1, 6,
- -1, 7, -1, 8, 75, 86, -1, 11, 71, 83,
- 84, -1, 11, 70, 83, 84, -1, 12, 86, 84,
- -1, 9, 86, -1, 48, 67, -1, 49, 67, -1,
- 80, -1, 47, 86, -1, 46, -1, 20, 87, -1,
- 20, 87, 64, 85, -1, 21, 85, -1, 81, 67,
- -1, 82, -1, 40, -1, 33, -1, 19, -1, 25,
- -1, 23, -1, 24, -1, 29, -1, 30, -1, 32,
- -1, 34, -1, 35, -1, 36, -1, 37, -1, 17,
- -1, 18, -1, 22, -1, 28, -1, 31, -1, 38,
- -1, 39, -1, 45, -1, 43, -1, 44, -1, 41,
- -1, 42, -1, -1, 68, -1, -1, 69, -1, 50,
- -1, 51, -1, 52, -1, 53, -1, 54, -1, 55,
- -1, 56, -1, 57, -1, 58, -1, 72, -1, 73,
- -1, 59, -1, 60, -1, 61, -1
-};
-
-/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
-static const yytype_uint16 yyrline[] =
-{
- 0, 195, 195, 196, 200, 202, 204, 206, 211, 216,
- 220, 224, 235, 245, 255, 264, 268, 272, 276, 280,
- 292, 296, 309, 322, 329, 336, 345, 351, 355, 359,
- 363, 367, 371, 375, 379, 383, 387, 391, 395, 402,
- 406, 410, 414, 418, 422, 426, 430, 434, 438, 442,
- 446, 453, 454, 459, 460, 465, 469, 473, 477, 481,
- 485, 489, 493, 497, 504, 508, 515, 519, 523
-};
-#endif
-
-#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
-/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
- First, the terminals, then, starting at YYNTOKENS, nonterminals. */
-static const char *const yytname[] =
-{
- "$end", "error", "$undefined", "COMMENT", "END", "ERROR", "RESET",
- "PARSER_DEBUG", "INCLUDE", "CONFIGURE_FILE", "EMPTY_LINE", "SERVER",
- "SOCKET", "SERVERS", "SERVERS_OPTION", "UNKNOWN_OPTION", "UNKNOWN",
- "BINARY_PROTOCOL", "BUFFER_REQUESTS", "CONNECT_TIMEOUT", "DISTRIBUTION",
- "HASH", "HASH_WITH_NAMESPACE", "IO_BYTES_WATERMARK", "IO_KEY_PREFETCH",
- "IO_MSG_WATERMARK", "KETAMA_HASH", "KETAMA_WEIGHTED", "NOREPLY",
- "NUMBER_OF_REPLICAS", "POLL_TIMEOUT", "RANDOMIZE_REPLICA_READ",
- "RCV_TIMEOUT", "REMOVE_FAILED_SERVERS", "RETRY_TIMEOUT", "SND_TIMEOUT",
- "SOCKET_RECV_SIZE", "SOCKET_SEND_SIZE", "SORT_HOSTS", "SUPPORT_CAS",
- "USER_DATA", "USE_UDP", "VERIFY_KEY", "_TCP_KEEPALIVE", "_TCP_KEEPIDLE",
- "_TCP_NODELAY", "FETCH_VERSION", "NAMESPACE", "POOL_MIN", "POOL_MAX",
- "MD5", "CRC", "FNV1_64", "FNV1A_64", "FNV1_32", "FNV1A_32", "HSIEH",
- "MURMUR", "JENKINS", "CONSISTENT", "MODULA", "RANDOM", "TRUE", "FALSE",
- "','", "'='", "FLOAT", "NUMBER", "PORT", "WEIGHT_START", "IPADDRESS",
- "HOSTNAME", "STRING", "QUOTED_STRING", "FILE_PATH", "' '", "$accept",
- "begin", "statement", "expression", "behaviors", "behavior_number",
- "behavior_boolean", "optional_port", "optional_weight", "hash", "string",
- "distribution", 0
-};
-#endif
-
-# ifdef YYPRINT
-/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
- token YYLEX-NUM. */
-static const yytype_uint16 yytoknum[] =
-{
- 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
- 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
- 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
- 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
- 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
- 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
- 315, 316, 317, 318, 44, 61, 319, 320, 321, 322,
- 323, 324, 325, 326, 327, 32
-};
-# endif
-
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const yytype_uint8 yyr1[] =
-{
- 0, 76, 77, 77, 78, 78, 78, 78, 78, 78,
- 78, 78, 79, 79, 79, 79, 79, 79, 79, 80,
- 80, 80, 80, 80, 80, 80, 80, 81, 81, 81,
- 81, 81, 81, 81, 81, 81, 81, 81, 81, 82,
- 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
- 82, 83, 83, 84, 84, 85, 85, 85, 85, 85,
- 85, 85, 85, 85, 86, 86, 87, 87, 87
-};
-
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
-static const yytype_uint8 yyr2[] =
-{
- 0, 2, 1, 3, 1, 1, 1, 1, 1, 1,
- 1, 3, 4, 4, 3, 2, 2, 2, 1, 2,
- 1, 2, 4, 2, 2, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 0, 1, 0, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1
-};
-
-/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
- Performed when YYTABLE doesn't specify something else to do. Zero
- means the default is an error. */
-static const yytype_uint8 yydefact[] =
-{
- 0, 5, 7, 8, 9, 10, 0, 0, 6, 0,
- 0, 39, 40, 28, 0, 0, 41, 30, 31, 29,
- 42, 32, 33, 43, 34, 27, 35, 36, 37, 38,
- 44, 45, 26, 49, 50, 47, 48, 46, 20, 0,
- 0, 0, 0, 2, 4, 18, 0, 25, 0, 64,
- 65, 15, 51, 51, 53, 66, 67, 68, 21, 55,
- 56, 57, 58, 59, 60, 61, 62, 63, 23, 19,
- 16, 17, 1, 0, 24, 11, 52, 53, 53, 54,
- 14, 0, 3, 13, 12, 22
-};
-
-/* YYDEFGOTO[NTERM-NUM]. */
-static const yytype_int8 yydefgoto[] =
-{
- -1, 42, 43, 44, 45, 46, 47, 77, 80, 68,
- 51, 58
-};
-
-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
-#define YYPACT_NINF -62
-static const yytype_int8 yypact[] =
-{
- -2, -62, -62, -62, -62, -62, -61, -24, -62, -20,
- -24, -62, -62, -62, -48, 13, -62, -62, -62, -62,
- -62, -62, -62, -62, -62, -62, -62, -62, -62, -62,
- -62, -62, -62, -62, -62, -62, -62, -62, -62, -24,
- -42, -15, 0, -62, -62, -62, -11, -62, -24, -62,
- -62, -62, -10, -10, -12, -62, -62, -62, -5, -62,
- -62, -62, -62, -62, -62, -62, -62, -62, -62, -62,
- -62, -62, -62, -2, -62, -62, -62, -12, -12, -62,
- -62, 13, -62, -62, -62, -62
-};
-
-/* YYPGOTO[NTERM-NUM]. */
-static const yytype_int8 yypgoto[] =
-{
- -62, -62, -13, -62, -62, -62, -62, 8, -23, -9,
- 14, -62
-};
-
-/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
- positive, shift that token. If negative, reduce the rule which
- number is the opposite. If YYTABLE_NINF, syntax error. */
-#define YYTABLE_NINF -1
-static const yytype_uint8 yytable[] =
-{
- 72, 1, 2, 3, 4, 5, 6, 7, 8, 9,
- 10, 55, 56, 57, 48, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 54, 70, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
- 34, 35, 36, 37, 38, 39, 40, 41, 49, 50,
- 52, 53, 71, 69, 83, 84, 74, 79, 76, 81,
- 82, 78, 75, 59, 60, 61, 62, 63, 64, 65,
- 66, 67, 85, 0, 0, 73
-};
-
-#define yypact_value_is_default(yystate) \
- ((yystate) == (-62))
-
-#define yytable_value_is_error(yytable_value) \
- YYID (0)
-
-static const yytype_int8 yycheck[] =
-{
- 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
- 12, 59, 60, 61, 75, 17, 18, 19, 20, 21,
- 22, 23, 24, 25, 10, 67, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
- 42, 43, 44, 45, 46, 47, 48, 49, 72, 73,
- 70, 71, 67, 39, 77, 78, 67, 69, 68, 64,
- 73, 53, 48, 50, 51, 52, 53, 54, 55, 56,
- 57, 58, 81, -1, -1, 75
-};
-
-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
-static const yytype_uint8 yystos[] =
-{
- 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
- 12, 17, 18, 19, 20, 21, 22, 23, 24, 25,
- 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
- 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 77, 78, 79, 80, 81, 82, 75, 72,
- 73, 86, 70, 71, 86, 59, 60, 61, 87, 50,
- 51, 52, 53, 54, 55, 56, 57, 58, 85, 86,
- 67, 67, 0, 75, 67, 86, 68, 83, 83, 69,
- 84, 64, 78, 84, 84, 85
-};
-
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY (-2)
-#define YYEOF 0
-
-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrorlab
-
-
-/* Like YYERROR except do call yyerror. This remains here temporarily
- to ease the transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. However,
- YYFAIL appears to be in use. Nevertheless, it is formally deprecated
- in Bison 2.4.2's NEWS entry, where a plan to phase it out is
- discussed. */
-
-#define YYFAIL goto yyerrlab
-#if defined YYFAIL
- /* This is here to suppress warnings from the GCC cpp's
- -Wunused-macros. Normally we don't worry about that warning, but
- some users do, and we want to make it easy for users to remove
- YYFAIL uses, which will produce warnings from Bison 2.5. */
-#endif
-
-#define YYRECOVERING() (!!yyerrstatus)
-
-#define YYBACKUP(Token, Value) \
-do \
- if (yychar == YYEMPTY && yylen == 1) \
- { \
- yychar = (Token); \
- yylval = (Value); \
- YYPOPSTACK (1); \
- goto yybackup; \
- } \
- else \
- { \
- yyerror (context, scanner, YY_("syntax error: cannot back up")); \
- YYERROR; \
- } \
-while (YYID (0))
-
-
-#define YYTERROR 1
-#define YYERRCODE 256
-
-
-/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
- If N is 0, then set CURRENT to the empty location which ends
- the previous symbol: RHS[0] (always defined). */
-
-#define YYRHSLOC(Rhs, K) ((Rhs)[K])
-#ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N) \
- do \
- if (YYID (N)) \
- { \
- (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
- (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
- (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
- (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
- } \
- else \
- { \
- (Current).first_line = (Current).last_line = \
- YYRHSLOC (Rhs, 0).last_line; \
- (Current).first_column = (Current).last_column = \
- YYRHSLOC (Rhs, 0).last_column; \
- } \
- while (YYID (0))
-#endif
-
-
-/* This macro is provided for backward compatibility. */
-
-#ifndef YY_LOCATION_PRINT
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-#endif
-
-
-/* YYLEX -- calling `yylex' with the right arguments. */
-
-#ifdef YYLEX_PARAM
-# define YYLEX yylex (&yylval, YYLEX_PARAM)
-#else
-# define YYLEX yylex (&yylval, scanner)
-#endif
-
-/* Enable debugging if requested. */
-#if YYDEBUG
-
-# ifndef YYFPRINTF
-# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
-# define YYFPRINTF fprintf
-# endif
-
-# define YYDPRINTF(Args) \
-do { \
- if (yydebug) \
- YYFPRINTF Args; \
-} while (YYID (0))
-
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
-do { \
- if (yydebug) \
- { \
- YYFPRINTF (stderr, "%s ", Title); \
- yy_symbol_print (stderr, \
- Type, Value, context, scanner); \
- YYFPRINTF (stderr, "\n"); \
- } \
-} while (YYID (0))
-
-
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
-
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, Context *context, yyscan_t *scanner)
-#else
-static void
-yy_symbol_value_print (yyoutput, yytype, yyvaluep, context, scanner)
- FILE *yyoutput;
- int yytype;
- YYSTYPE const * const yyvaluep;
- Context *context;
- yyscan_t *scanner;
-#endif
-{
- if (!yyvaluep)
- return;
- YYUSE (context);
- YYUSE (scanner);
-# ifdef YYPRINT
- if (yytype < YYNTOKENS)
- YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# else
- YYUSE (yyoutput);
-# endif
- switch (yytype)
- {
- default:
- break;
- }
-}
-
-
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
-
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, Context *context, yyscan_t *scanner)
-#else
-static void
-yy_symbol_print (yyoutput, yytype, yyvaluep, context, scanner)
- FILE *yyoutput;
- int yytype;
- YYSTYPE const * const yyvaluep;
- Context *context;
- yyscan_t *scanner;
-#endif
-{
- if (yytype < YYNTOKENS)
- YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
- else
- YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
-
- yy_symbol_value_print (yyoutput, yytype, yyvaluep, context, scanner);
- YYFPRINTF (yyoutput, ")");
-}
-
-/*------------------------------------------------------------------.
-| yy_stack_print -- Print the state stack from its BOTTOM up to its |
-| TOP (included). |
-`------------------------------------------------------------------*/
-
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
-#else
-static void
-yy_stack_print (yybottom, yytop)
- yytype_int16 *yybottom;
- yytype_int16 *yytop;
-#endif
-{
- YYFPRINTF (stderr, "Stack now");
- for (; yybottom <= yytop; yybottom++)
- {
- int yybot = *yybottom;
- YYFPRINTF (stderr, " %d", yybot);
- }
- YYFPRINTF (stderr, "\n");
-}
-
-# define YY_STACK_PRINT(Bottom, Top) \
-do { \
- if (yydebug) \
- yy_stack_print ((Bottom), (Top)); \
-} while (YYID (0))
-
-
-/*------------------------------------------------.
-| Report that the YYRULE is going to be reduced. |
-`------------------------------------------------*/
-
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yy_reduce_print (YYSTYPE *yyvsp, int yyrule, Context *context, yyscan_t *scanner)
-#else
-static void
-yy_reduce_print (yyvsp, yyrule, context, scanner)
- YYSTYPE *yyvsp;
- int yyrule;
- Context *context;
- yyscan_t *scanner;
-#endif
-{
- int yynrhs = yyr2[yyrule];
- int yyi;
- unsigned long int yylno = yyrline[yyrule];
- YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
- yyrule - 1, yylno);
- /* The symbols being reduced. */
- for (yyi = 0; yyi < yynrhs; yyi++)
- {
- YYFPRINTF (stderr, " $%d = ", yyi + 1);
- yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
- &(yyvsp[(yyi + 1) - (yynrhs)])
- , context, scanner);
- YYFPRINTF (stderr, "\n");
- }
-}
-
-# define YY_REDUCE_PRINT(Rule) \
-do { \
- if (yydebug) \
- yy_reduce_print (yyvsp, Rule, context, scanner); \
-} while (YYID (0))
-
-/* Nonzero means print parse trace. It is left uninitialized so that
- multiple parsers can coexist. */
-int yydebug;
-#else /* !YYDEBUG */
-# define YYDPRINTF(Args)
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
-# define YY_STACK_PRINT(Bottom, Top)
-# define YY_REDUCE_PRINT(Rule)
-#endif /* !YYDEBUG */
-
-
-/* YYINITDEPTH -- initial size of the parser's stacks. */
-#ifndef YYINITDEPTH
-# define YYINITDEPTH 200
-#endif
-
-/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
- if the built-in stack extension method is used).
-
- Do not make this value too large; the results are undefined if
- YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
- evaluated with infinite-precision integer arithmetic. */
-
-#ifndef YYMAXDEPTH
-# define YYMAXDEPTH 10000
-#endif
-
-
-#if YYERROR_VERBOSE
-
-# ifndef yystrlen
-# if defined __GLIBC__ && defined _STRING_H
-# define yystrlen strlen
-# else
-/* Return the length of YYSTR. */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static YYSIZE_T
-yystrlen (const char *yystr)
-#else
-static YYSIZE_T
-yystrlen (yystr)
- const char *yystr;
-#endif
-{
- YYSIZE_T yylen;
- for (yylen = 0; yystr[yylen]; yylen++)
- continue;
- return yylen;
-}
-# endif
-# endif
-
-# ifndef yystpcpy
-# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
-# define yystpcpy stpcpy
-# else
-/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
- YYDEST. */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static char *
-yystpcpy (char *yydest, const char *yysrc)
-#else
-static char *
-yystpcpy (yydest, yysrc)
- char *yydest;
- const char *yysrc;
-#endif
-{
- char *yyd = yydest;
- const char *yys = yysrc;
-
- while ((*yyd++ = *yys++) != '\0')
- continue;
-
- return yyd - 1;
-}
-# endif
-# endif
-
-# ifndef yytnamerr
-/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
- quotes and backslashes, so that it's suitable for yyerror. The
- heuristic is that double-quoting is unnecessary unless the string
- contains an apostrophe, a comma, or backslash (other than
- backslash-backslash). YYSTR is taken from yytname. If YYRES is
- null, do not copy; instead, return the length of what the result
- would have been. */
-static YYSIZE_T
-yytnamerr (char *yyres, const char *yystr)
-{
- if (*yystr == '"')
- {
- YYSIZE_T yyn = 0;
- char const *yyp = yystr;
-
- for (;;)
- switch (*++yyp)
- {
- case '\'':
- case ',':
- goto do_not_strip_quotes;
-
- case '\\':
- if (*++yyp != '\\')
- goto do_not_strip_quotes;
- /* Fall through. */
- default:
- if (yyres)
- yyres[yyn] = *yyp;
- yyn++;
- break;
-
- case '"':
- if (yyres)
- yyres[yyn] = '\0';
- return yyn;
- }
- do_not_strip_quotes: ;
- }
-
- if (! yyres)
- return yystrlen (yystr);
-
- return yystpcpy (yyres, yystr) - yyres;
-}
-# endif
-
-/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
- about the unexpected token YYTOKEN for the state stack whose top is
- YYSSP.
-
- Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
- not large enough to hold the message. In that case, also set
- *YYMSG_ALLOC to the required number of bytes. Return 2 if the
- required number of bytes is too large to store. */
-static int
-yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
- yytype_int16 *yyssp, int yytoken)
-{
- YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
- YYSIZE_T yysize = yysize0;
- YYSIZE_T yysize1;
- enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
- /* Internationalized format string. */
- const char *yyformat = 0;
- /* Arguments of yyformat. */
- char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
- /* Number of reported tokens (one for the "unexpected", one per
- "expected"). */
- int yycount = 0;
-
- /* There are many possibilities here to consider:
- - Assume YYFAIL is not used. It's too flawed to consider. See
- <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
- for details. YYERROR is fine as it does not invoke this
- function.
- - If this state is a consistent state with a default action, then
- the only way this function was invoked is if the default action
- is an error action. In that case, don't check for expected
- tokens because there are none.
- - The only way there can be no lookahead present (in yychar) is if
- this state is a consistent state with a default action. Thus,
- detecting the absence of a lookahead is sufficient to determine
- that there is no unexpected or expected token to report. In that
- case, just report a simple "syntax error".
- - Don't assume there isn't a lookahead just because this state is a
- consistent state with a default action. There might have been a
- previous inconsistent state, consistent state with a non-default
- action, or user semantic action that manipulated yychar.
- - Of course, the expected token list depends on states to have
- correct lookahead information, and it depends on the parser not
- to perform extra reductions after fetching a lookahead from the
- scanner and before detecting a syntax error. Thus, state merging
- (from LALR or IELR) and default reductions corrupt the expected
- token list. However, the list is correct for canonical LR with
- one exception: it will still contain any token that will not be
- accepted due to an error action in a later state.
- */
- if (yytoken != YYEMPTY)
- {
- int yyn = yypact[*yyssp];
- yyarg[yycount++] = yytname[yytoken];
- if (!yypact_value_is_default (yyn))
- {
- /* Start YYX at -YYN if negative to avoid negative indexes in
- YYCHECK. In other words, skip the first -YYN actions for
- this state because they are default actions. */
- int yyxbegin = yyn < 0 ? -yyn : 0;
- /* Stay within bounds of both yycheck and yytname. */
- int yychecklim = YYLAST - yyn + 1;
- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
- int yyx;
-
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
- && !yytable_value_is_error (yytable[yyx + yyn]))
- {
- if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
- {
- yycount = 1;
- yysize = yysize0;
- break;
- }
- yyarg[yycount++] = yytname[yyx];
- yysize1 = yysize + yytnamerr (0, yytname[yyx]);
- if (! (yysize <= yysize1
- && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
- return 2;
- yysize = yysize1;
- }
- }
- }
-
- switch (yycount)
- {
-# define YYCASE_(N, S) \
- case N: \
- yyformat = S; \
- break
- YYCASE_(0, YY_("syntax error"));
- YYCASE_(1, YY_("syntax error, unexpected %s"));
- YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
- YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
- YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
- YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
-# undef YYCASE_
- }
-
- yysize1 = yysize + yystrlen (yyformat);
- if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
- return 2;
- yysize = yysize1;
-
- if (*yymsg_alloc < yysize)
- {
- *yymsg_alloc = 2 * yysize;
- if (! (yysize <= *yymsg_alloc
- && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
- *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
- return 1;
- }
-
- /* Avoid sprintf, as that infringes on the user's name space.
- Don't have undefined behavior even if the translation
- produced a string with the wrong number of "%s"s. */
- {
- char *yyp = *yymsg;
- int yyi = 0;
- while ((*yyp = *yyformat) != '\0')
- if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
- {
- yyp += yytnamerr (yyp, yyarg[yyi++]);
- yyformat += 2;
- }
- else
- {
- yyp++;
- yyformat++;
- }
- }
- return 0;
-}
-#endif /* YYERROR_VERBOSE */
-
-/*-----------------------------------------------.
-| Release the memory associated to this symbol. |
-`-----------------------------------------------*/
-
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, Context *context, yyscan_t *scanner)
-#else
-static void
-yydestruct (yymsg, yytype, yyvaluep, context, scanner)
- const char *yymsg;
- int yytype;
- YYSTYPE *yyvaluep;
- Context *context;
- yyscan_t *scanner;
-#endif
-{
- YYUSE (yyvaluep);
- YYUSE (context);
- YYUSE (scanner);
-
- if (!yymsg)
- yymsg = "Deleting";
- YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
-
- switch (yytype)
- {
-
- default:
- break;
- }
-}
-
-
-/* Prevent warnings from -Wmissing-prototypes. */
-#ifdef YYPARSE_PARAM
-#if defined __STDC__ || defined __cplusplus
-int yyparse (void *YYPARSE_PARAM);
-#else
-int yyparse ();
-#endif
-#else /* ! YYPARSE_PARAM */
-#if defined __STDC__ || defined __cplusplus
-int yyparse (Context *context, yyscan_t *scanner);
-#else
-int yyparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
-
-
-/*----------.
-| yyparse. |
-`----------*/
-
-#ifdef YYPARSE_PARAM
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-int
-yyparse (void *YYPARSE_PARAM)
-#else
-int
-yyparse (YYPARSE_PARAM)
- void *YYPARSE_PARAM;
-#endif
-#else /* ! YYPARSE_PARAM */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-int
-yyparse (Context *context, yyscan_t *scanner)
-#else
-int
-yyparse (context, scanner)
- Context *context;
- yyscan_t *scanner;
-#endif
-#endif
-{
-/* The lookahead symbol. */
-int yychar;
-
-/* The semantic value of the lookahead symbol. */
-YYSTYPE yylval;
-
- /* Number of syntax errors so far. */
- int yynerrs;
-
- int yystate;
- /* Number of tokens to shift before error messages enabled. */
- int yyerrstatus;
-
- /* The stacks and their tools:
- `yyss': related to states.
- `yyvs': related to semantic values.
-
- Refer to the stacks thru separate pointers, to allow yyoverflow
- to reallocate them elsewhere. */
-
- /* The state stack. */
- yytype_int16 yyssa[YYINITDEPTH];
- yytype_int16 *yyss;
- yytype_int16 *yyssp;
-
- /* The semantic value stack. */
- YYSTYPE yyvsa[YYINITDEPTH];
- YYSTYPE *yyvs;
- YYSTYPE *yyvsp;
-
- YYSIZE_T yystacksize;
-
- int yyn;
- int yyresult;
- /* Lookahead token as an internal (translated) token number. */
- int yytoken;
- /* The variables used to return semantic value and location from the
- action routines. */
- YYSTYPE yyval;
-
-#if YYERROR_VERBOSE
- /* Buffer for error messages, and its allocated size. */
- char yymsgbuf[128];
- char *yymsg = yymsgbuf;
- YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
-#endif
-
-#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
-
- /* The number of symbols on the RHS of the reduced rule.
- Keep to zero when no symbol should be popped. */
- int yylen = 0;
-
- yytoken = 0;
- yyss = yyssa;
- yyvs = yyvsa;
- yystacksize = YYINITDEPTH;
-
- YYDPRINTF ((stderr, "Starting parse\n"));
-
- yystate = 0;
- yyerrstatus = 0;
- yynerrs = 0;
- yychar = YYEMPTY; /* Cause a token to be read. */
-
- /* Initialize stack pointers.
- Waste one element of value and location stack
- so that they stay on the same level as the state stack.
- The wasted elements are never initialized. */
- yyssp = yyss;
- yyvsp = yyvs;
-
- goto yysetstate;
-
-/*------------------------------------------------------------.
-| yynewstate -- Push a new state, which is found in yystate. |
-`------------------------------------------------------------*/
- yynewstate:
- /* In all cases, when you get here, the value and location stacks
- have just been pushed. So pushing a state here evens the stacks. */
- yyssp++;
-
- yysetstate:
- *yyssp = yystate;
-
- if (yyss + yystacksize - 1 <= yyssp)
- {
- /* Get the current used size of the three stacks, in elements. */
- YYSIZE_T yysize = yyssp - yyss + 1;
-
-#ifdef yyoverflow
- {
- /* Give user a chance to reallocate the stack. Use copies of
- these so that the &'s don't force the real ones into
- memory. */
- YYSTYPE *yyvs1 = yyvs;
- yytype_int16 *yyss1 = yyss;
-
- /* Each stack pointer address is followed by the size of the
- data in use in that stack, in bytes. This used to be a
- conditional around just the two extra args, but that might
- be undefined if yyoverflow is a macro. */
- yyoverflow (YY_("memory exhausted"),
- &yyss1, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
- &yystacksize);
-
- yyss = yyss1;
- yyvs = yyvs1;
- }
-#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
- goto yyexhaustedlab;
-# else
- /* Extend the stack our own way. */
- if (YYMAXDEPTH <= yystacksize)
- goto yyexhaustedlab;
- yystacksize *= 2;
- if (YYMAXDEPTH < yystacksize)
- yystacksize = YYMAXDEPTH;
-
- {
- yytype_int16 *yyss1 = yyss;
- union yyalloc *yyptr =
- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
- if (! yyptr)
- goto yyexhaustedlab;
- YYSTACK_RELOCATE (yyss_alloc, yyss);
- YYSTACK_RELOCATE (yyvs_alloc, yyvs);
-# undef YYSTACK_RELOCATE
- if (yyss1 != yyssa)
- YYSTACK_FREE (yyss1);
- }
-# endif
-#endif /* no yyoverflow */
-
- yyssp = yyss + yysize - 1;
- yyvsp = yyvs + yysize - 1;
-
- YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
-
- if (yyss + yystacksize - 1 <= yyssp)
- YYABORT;
- }
-
- YYDPRINTF ((stderr, "Entering state %d\n", yystate));
-
- if (yystate == YYFINAL)
- YYACCEPT;
-
- goto yybackup;
-
-/*-----------.
-| yybackup. |
-`-----------*/
-yybackup:
-
- /* Do appropriate processing given the current state. Read a
- lookahead token if we need one and don't already have one. */
-
- /* First try to decide what to do without reference to lookahead token. */
- yyn = yypact[yystate];
- if (yypact_value_is_default (yyn))
- goto yydefault;
-
- /* Not known => get a lookahead token if don't already have one. */
-
- /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
- if (yychar == YYEMPTY)
- {
- YYDPRINTF ((stderr, "Reading a token: "));
- yychar = YYLEX;
- }
-
- if (yychar <= YYEOF)
- {
- yychar = yytoken = YYEOF;
- YYDPRINTF ((stderr, "Now at end of input.\n"));
- }
- else
- {
- yytoken = YYTRANSLATE (yychar);
- YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
- }
-
- /* If the proper action on seeing token YYTOKEN is to reduce or to
- detect an error, take that action. */
- yyn += yytoken;
- if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
- goto yydefault;
- yyn = yytable[yyn];
- if (yyn <= 0)
- {
- if (yytable_value_is_error (yyn))
- goto yyerrlab;
- yyn = -yyn;
- goto yyreduce;
- }
-
- /* Count tokens shifted since error; after three, turn off error
- status. */
- if (yyerrstatus)
- yyerrstatus--;
-
- /* Shift the lookahead token. */
- YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
-
- /* Discard the shifted token. */
- yychar = YYEMPTY;
-
- yystate = yyn;
- *++yyvsp = yylval;
-
- goto yynewstate;
-
-
-/*-----------------------------------------------------------.
-| yydefault -- do the default action for the current state. |
-`-----------------------------------------------------------*/
-yydefault:
- yyn = yydefact[yystate];
- if (yyn == 0)
- goto yyerrlab;
- goto yyreduce;
-
-
-/*-----------------------------.
-| yyreduce -- Do a reduction. |
-`-----------------------------*/
-yyreduce:
- /* yyn is the number of a rule to reduce with. */
- yylen = yyr2[yyn];
-
- /* If YYLEN is nonzero, implement the default value of the action:
- `$$ = $1'.
-
- Otherwise, the following line sets YYVAL to garbage.
- This behavior is undocumented and Bison
- users should not rely upon it. Assigning to YYVAL
- unconditionally makes the parser a bit smaller, and it avoids a
- GCC warning that YYVAL may be used uninitialized. */
- yyval = yyvsp[1-yylen];
-
-
- YY_REDUCE_PRINT (yyn);
- switch (yyn)
- {
- case 4:
-
-/* Line 1806 of yacc.c */
-#line 201 "libmemcached/csl/parser.yy"
- { }
- break;
-
- case 5:
-
-/* Line 1806 of yacc.c */
-#line 203 "libmemcached/csl/parser.yy"
- { }
- break;
-
- case 6:
-
-/* Line 1806 of yacc.c */
-#line 205 "libmemcached/csl/parser.yy"
- { }
- break;
-
- case 7:
-
-/* Line 1806 of yacc.c */
-#line 207 "libmemcached/csl/parser.yy"
- {
- context->set_end();
- YYACCEPT;
- }
- break;
-
- case 8:
-
-/* Line 1806 of yacc.c */
-#line 212 "libmemcached/csl/parser.yy"
- {
- context->rc= MEMCACHED_PARSE_USER_ERROR;
- parser_abort(context, "ERROR called directly");
- }
- break;
-
- case 9:
-
-/* Line 1806 of yacc.c */
-#line 217 "libmemcached/csl/parser.yy"
- {
- memcached_reset(context->memc);
- }
- break;
-
- case 10:
-
-/* Line 1806 of yacc.c */
-#line 221 "libmemcached/csl/parser.yy"
- {
- yydebug= 1;
- }
- break;
-
- case 11:
-
-/* Line 1806 of yacc.c */
-#line 225 "libmemcached/csl/parser.yy"
- {
- if ((context->rc= memcached_parse_configure_file(*context->memc, (yyvsp[(3) - (3)].string).c_str, (yyvsp[(3) - (3)].string).size)) != MEMCACHED_SUCCESS)
- {
- parser_abort(context, "Failed to parse configuration file");
- }
- }
- break;
-
- case 12:
-
-/* Line 1806 of yacc.c */
-#line 236 "libmemcached/csl/parser.yy"
- {
- if (memcached_failed(context->rc= memcached_server_add_with_weight(context->memc, (yyvsp[(2) - (4)].server).c_str, (yyvsp[(3) - (4)].number), uint32_t((yyvsp[(4) - (4)].number)))))
- {
- char buffer[1024];
- snprintf(buffer, sizeof(buffer), "Failed to add server: %s:%u", (yyvsp[(2) - (4)].server).c_str, uint32_t((yyvsp[(3) - (4)].number)));
- parser_abort(context, buffer);
- }
- context->unset_server();
- }
- break;
-
- case 13:
-
-/* Line 1806 of yacc.c */
-#line 246 "libmemcached/csl/parser.yy"
- {
- if (memcached_failed(context->rc= memcached_server_add_with_weight(context->memc, (yyvsp[(2) - (4)].server).c_str, (yyvsp[(3) - (4)].number), uint32_t((yyvsp[(4) - (4)].number)))))
- {
- char buffer[1024];
- snprintf(buffer, sizeof(buffer), "Failed to add server: %s:%u", (yyvsp[(2) - (4)].server).c_str, uint32_t((yyvsp[(3) - (4)].number)));
- parser_abort(context, buffer);
- }
- context->unset_server();
- }
- break;
-
- case 14:
-
-/* Line 1806 of yacc.c */
-#line 256 "libmemcached/csl/parser.yy"
- {
- if (memcached_failed(context->rc= memcached_server_add_unix_socket_with_weight(context->memc, (yyvsp[(2) - (3)].string).c_str, uint32_t((yyvsp[(3) - (3)].number)))))
- {
- char buffer[1024];
- snprintf(buffer, sizeof(buffer), "Failed to add socket: %s", (yyvsp[(2) - (3)].string).c_str);
- parser_abort(context, buffer);
- }
- }
- break;
-
- case 15:
-
-/* Line 1806 of yacc.c */
-#line 265 "libmemcached/csl/parser.yy"
- {
- memcached_set_configuration_file(context->memc, (yyvsp[(2) - (2)].string).c_str, (yyvsp[(2) - (2)].string).size);
- }
- break;
-
- case 16:
-
-/* Line 1806 of yacc.c */
-#line 269 "libmemcached/csl/parser.yy"
- {
- context->memc->configure.initial_pool_size= uint32_t((yyvsp[(2) - (2)].number));
- }
- break;
-
- case 17:
-
-/* Line 1806 of yacc.c */
-#line 273 "libmemcached/csl/parser.yy"
- {
- context->memc->configure.max_pool_size= uint32_t((yyvsp[(2) - (2)].number));
- }
- break;
-
- case 19:
-
-/* Line 1806 of yacc.c */
-#line 281 "libmemcached/csl/parser.yy"
- {
- if (memcached_callback_get(context->memc, MEMCACHED_CALLBACK_PREFIX_KEY, NULL))
- {
- parser_abort(context, "--NAMESPACE can only be called once");
- }
-
- if ((context->rc= memcached_set_namespace(context->memc, (yyvsp[(2) - (2)].string).c_str, (yyvsp[(2) - (2)].string).size)) != MEMCACHED_SUCCESS)
- {
- parser_abort(context, memcached_last_error_message(context->memc));
- }
- }
- break;
-
- case 20:
-
-/* Line 1806 of yacc.c */
-#line 293 "libmemcached/csl/parser.yy"
- {
- memcached_flag(*context->memc, MEMCACHED_FLAG_IS_FETCHING_VERSION, true);
- }
- break;
-
- case 21:
-
-/* Line 1806 of yacc.c */
-#line 297 "libmemcached/csl/parser.yy"
- {
- // Check to see if DISTRIBUTION has already been set
- if ((context->rc= memcached_behavior_set(context->memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, (yyvsp[(2) - (2)].distribution))) != MEMCACHED_SUCCESS)
- {
- parser_abort(context, "--DISTRIBUTION can only be called once");
- }
-
- if ((context->rc= memcached_behavior_set(context->memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, (yyvsp[(2) - (2)].distribution))) != MEMCACHED_SUCCESS)
- {
- parser_abort(context, memcached_last_error_message(context->memc));;
- }
- }
- break;
-
- case 22:
-
-/* Line 1806 of yacc.c */
-#line 310 "libmemcached/csl/parser.yy"
- {
- // Check to see if DISTRIBUTION has already been set
- if ((context->rc= memcached_behavior_set(context->memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, (yyvsp[(2) - (4)].distribution))) != MEMCACHED_SUCCESS)
- {
- parser_abort(context, "--DISTRIBUTION can only be called once");
- }
-
- if ((context->rc= memcached_behavior_set_distribution_hash(context->memc, (yyvsp[(4) - (4)].hash))) != MEMCACHED_SUCCESS)
- {
- parser_abort(context, "Unable to set the hash for the DISTRIBUTION requested");
- }
- }
- break;
-
- case 23:
-
-/* Line 1806 of yacc.c */
-#line 323 "libmemcached/csl/parser.yy"
- {
- if (context->set_hash((yyvsp[(2) - (2)].hash)) == false)
- {
- parser_abort(context, "--HASH can only be set once");
- }
- }
- break;
-
- case 24:
-
-/* Line 1806 of yacc.c */
-#line 330 "libmemcached/csl/parser.yy"
- {
- if ((context->rc= memcached_behavior_set(context->memc, (yyvsp[(1) - (2)].behavior), (yyvsp[(2) - (2)].number))) != MEMCACHED_SUCCESS)
- {
- parser_abort(context, "Unable to set behavior");
- }
- }
- break;
-
- case 25:
-
-/* Line 1806 of yacc.c */
-#line 337 "libmemcached/csl/parser.yy"
- {
- if ((context->rc= memcached_behavior_set(context->memc, (yyvsp[(1) - (1)].behavior), true)) != MEMCACHED_SUCCESS)
- {
- char buffer[1024];
- snprintf(buffer, sizeof(buffer), "Could not set: %s", libmemcached_string_behavior((yyvsp[(1) - (1)].behavior)));
- parser_abort(context, buffer);
- }
- }
- break;
-
- case 26:
-
-/* Line 1806 of yacc.c */
-#line 346 "libmemcached/csl/parser.yy"
- {
- }
- break;
-
- case 27:
-
-/* Line 1806 of yacc.c */
-#line 352 "libmemcached/csl/parser.yy"
- {
- (yyval.behavior)= MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS;
- }
- break;
-
- case 28:
-
-/* Line 1806 of yacc.c */
-#line 356 "libmemcached/csl/parser.yy"
- {
- (yyval.behavior)= MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT;
- }
- break;
-
- case 29:
-
-/* Line 1806 of yacc.c */
-#line 360 "libmemcached/csl/parser.yy"
- {
- (yyval.behavior)= MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK;
- }
- break;
-
- case 30:
-
-/* Line 1806 of yacc.c */
-#line 364 "libmemcached/csl/parser.yy"
- {
- (yyval.behavior)= MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK;
- }
- break;
-
- case 31:
-
-/* Line 1806 of yacc.c */
-#line 368 "libmemcached/csl/parser.yy"
- {
- (yyval.behavior)= MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH;
- }
- break;
-
- case 32:
-
-/* Line 1806 of yacc.c */
-#line 372 "libmemcached/csl/parser.yy"
- {
- (yyval.behavior)= MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS;
- }
- break;
-
- case 33:
-
-/* Line 1806 of yacc.c */
-#line 376 "libmemcached/csl/parser.yy"
- {
- (yyval.behavior)= MEMCACHED_BEHAVIOR_POLL_TIMEOUT;
- }
- break;
-
- case 34:
-
-/* Line 1806 of yacc.c */
-#line 380 "libmemcached/csl/parser.yy"
- {
- (yyval.behavior)= MEMCACHED_BEHAVIOR_RCV_TIMEOUT;
- }
- break;
-
- case 35:
-
-/* Line 1806 of yacc.c */
-#line 384 "libmemcached/csl/parser.yy"
- {
- (yyval.behavior)= MEMCACHED_BEHAVIOR_RETRY_TIMEOUT;
- }
- break;
-
- case 36:
-
-/* Line 1806 of yacc.c */
-#line 388 "libmemcached/csl/parser.yy"
- {
- (yyval.behavior)= MEMCACHED_BEHAVIOR_SND_TIMEOUT;
- }
- break;
-
- case 37:
-
-/* Line 1806 of yacc.c */
-#line 392 "libmemcached/csl/parser.yy"
- {
- (yyval.behavior)= MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE;
- }
- break;
-
- case 38:
-
-/* Line 1806 of yacc.c */
-#line 396 "libmemcached/csl/parser.yy"
- {
- (yyval.behavior)= MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE;
- }
- break;
-
- case 39:
-
-/* Line 1806 of yacc.c */
-#line 403 "libmemcached/csl/parser.yy"
- {
- (yyval.behavior)= MEMCACHED_BEHAVIOR_BINARY_PROTOCOL;
- }
- break;
-
- case 40:
-
-/* Line 1806 of yacc.c */
-#line 407 "libmemcached/csl/parser.yy"
- {
- (yyval.behavior)= MEMCACHED_BEHAVIOR_BUFFER_REQUESTS;
- }
- break;
-
- case 41:
-
-/* Line 1806 of yacc.c */
-#line 411 "libmemcached/csl/parser.yy"
- {
- (yyval.behavior)= MEMCACHED_BEHAVIOR_HASH_WITH_PREFIX_KEY;
- }
- break;
-
- case 42:
-
-/* Line 1806 of yacc.c */
-#line 415 "libmemcached/csl/parser.yy"
- {
- (yyval.behavior)= MEMCACHED_BEHAVIOR_NOREPLY;
- }
- break;
-
- case 43:
-
-/* Line 1806 of yacc.c */
-#line 419 "libmemcached/csl/parser.yy"
- {
- (yyval.behavior)= MEMCACHED_BEHAVIOR_RANDOMIZE_REPLICA_READ;
- }
- break;
-
- case 44:
-
-/* Line 1806 of yacc.c */
-#line 423 "libmemcached/csl/parser.yy"
- {
- (yyval.behavior)= MEMCACHED_BEHAVIOR_SORT_HOSTS;
- }
- break;
-
- case 45:
-
-/* Line 1806 of yacc.c */
-#line 427 "libmemcached/csl/parser.yy"
- {
- (yyval.behavior)= MEMCACHED_BEHAVIOR_SUPPORT_CAS;
- }
- break;
-
- case 46:
-
-/* Line 1806 of yacc.c */
-#line 431 "libmemcached/csl/parser.yy"
- {
- (yyval.behavior)= MEMCACHED_BEHAVIOR_TCP_NODELAY;
- }
- break;
-
- case 47:
-
-/* Line 1806 of yacc.c */
-#line 435 "libmemcached/csl/parser.yy"
- {
- (yyval.behavior)= MEMCACHED_BEHAVIOR_TCP_KEEPALIVE;
- }
- break;
-
- case 48:
-
-/* Line 1806 of yacc.c */
-#line 439 "libmemcached/csl/parser.yy"
- {
- (yyval.behavior)= MEMCACHED_BEHAVIOR_TCP_KEEPIDLE;
- }
- break;
-
- case 49:
-
-/* Line 1806 of yacc.c */
-#line 443 "libmemcached/csl/parser.yy"
- {
- (yyval.behavior)= MEMCACHED_BEHAVIOR_USE_UDP;
- }
- break;
-
- case 50:
-
-/* Line 1806 of yacc.c */
-#line 447 "libmemcached/csl/parser.yy"
- {
- (yyval.behavior)= MEMCACHED_BEHAVIOR_VERIFY_KEY;
- }
- break;
-
- case 51:
-
-/* Line 1806 of yacc.c */
-#line 453 "libmemcached/csl/parser.yy"
- { (yyval.number)= MEMCACHED_DEFAULT_PORT;}
- break;
-
- case 52:
-
-/* Line 1806 of yacc.c */
-#line 455 "libmemcached/csl/parser.yy"
- { }
- break;
-
- case 53:
-
-/* Line 1806 of yacc.c */
-#line 459 "libmemcached/csl/parser.yy"
- { (yyval.number)= 1; }
- break;
-
- case 54:
-
-/* Line 1806 of yacc.c */
-#line 461 "libmemcached/csl/parser.yy"
- { }
- break;
-
- case 55:
-
-/* Line 1806 of yacc.c */
-#line 466 "libmemcached/csl/parser.yy"
- {
- (yyval.hash)= MEMCACHED_HASH_MD5;
- }
- break;
-
- case 56:
-
-/* Line 1806 of yacc.c */
-#line 470 "libmemcached/csl/parser.yy"
- {
- (yyval.hash)= MEMCACHED_HASH_CRC;
- }
- break;
-
- case 57:
-
-/* Line 1806 of yacc.c */
-#line 474 "libmemcached/csl/parser.yy"
- {
- (yyval.hash)= MEMCACHED_HASH_FNV1_64;
- }
- break;
-
- case 58:
-
-/* Line 1806 of yacc.c */
-#line 478 "libmemcached/csl/parser.yy"
- {
- (yyval.hash)= MEMCACHED_HASH_FNV1A_64;
- }
- break;
-
- case 59:
-
-/* Line 1806 of yacc.c */
-#line 482 "libmemcached/csl/parser.yy"
- {
- (yyval.hash)= MEMCACHED_HASH_FNV1_32;
- }
- break;
-
- case 60:
-
-/* Line 1806 of yacc.c */
-#line 486 "libmemcached/csl/parser.yy"
- {
- (yyval.hash)= MEMCACHED_HASH_FNV1A_32;
- }
- break;
-
- case 61:
-
-/* Line 1806 of yacc.c */
-#line 490 "libmemcached/csl/parser.yy"
- {
- (yyval.hash)= MEMCACHED_HASH_HSIEH;
- }
- break;
-
- case 62:
-
-/* Line 1806 of yacc.c */
-#line 494 "libmemcached/csl/parser.yy"
- {
- (yyval.hash)= MEMCACHED_HASH_MURMUR;
- }
- break;
-
- case 63:
-
-/* Line 1806 of yacc.c */
-#line 498 "libmemcached/csl/parser.yy"
- {
- (yyval.hash)= MEMCACHED_HASH_JENKINS;
- }
- break;
-
- case 64:
-
-/* Line 1806 of yacc.c */
-#line 505 "libmemcached/csl/parser.yy"
- {
- (yyval.string)= (yyvsp[(1) - (1)].string);
- }
- break;
-
- case 65:
-
-/* Line 1806 of yacc.c */
-#line 509 "libmemcached/csl/parser.yy"
- {
- (yyval.string)= (yyvsp[(1) - (1)].string);
- }
- break;
-
- case 66:
-
-/* Line 1806 of yacc.c */
-#line 516 "libmemcached/csl/parser.yy"
- {
- (yyval.distribution)= MEMCACHED_DISTRIBUTION_CONSISTENT;
- }
- break;
-
- case 67:
-
-/* Line 1806 of yacc.c */
-#line 520 "libmemcached/csl/parser.yy"
- {
- (yyval.distribution)= MEMCACHED_DISTRIBUTION_MODULA;
- }
- break;
-
- case 68:
-
-/* Line 1806 of yacc.c */
-#line 524 "libmemcached/csl/parser.yy"
- {
- (yyval.distribution)= MEMCACHED_DISTRIBUTION_RANDOM;
- }
- break;
-
-
-
-/* Line 1806 of yacc.c */
-#line 2188 "libmemcached/csl/parser.cc"
- default: break;
- }
- /* User semantic actions sometimes alter yychar, and that requires
- that yytoken be updated with the new translation. We take the
- approach of translating immediately before every use of yytoken.
- One alternative is translating here after every semantic action,
- but that translation would be missed if the semantic action invokes
- YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
- if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
- incorrect destructor might then be invoked immediately. In the
- case of YYERROR or YYBACKUP, subsequent parser actions might lead
- to an incorrect destructor call or verbose syntax error message
- before the lookahead is translated. */
- YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
-
- YYPOPSTACK (yylen);
- yylen = 0;
- YY_STACK_PRINT (yyss, yyssp);
-
- *++yyvsp = yyval;
-
- /* Now `shift' the result of the reduction. Determine what state
- that goes to, based on the state we popped back to and the rule
- number reduced by. */
-
- yyn = yyr1[yyn];
-
- yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
- if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
- yystate = yytable[yystate];
- else
- yystate = yydefgoto[yyn - YYNTOKENS];
-
- goto yynewstate;
-
-
-/*------------------------------------.
-| yyerrlab -- here on detecting error |
-`------------------------------------*/
-yyerrlab:
- /* Make sure we have latest lookahead translation. See comments at
- user semantic actions for why this is necessary. */
- yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
-
- /* If not already recovering from an error, report this error. */
- if (!yyerrstatus)
- {
- ++yynerrs;
-#if ! YYERROR_VERBOSE
- yyerror (context, scanner, YY_("syntax error"));
-#else
-# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
- yyssp, yytoken)
- {
- char const *yymsgp = YY_("syntax error");
- int yysyntax_error_status;
- yysyntax_error_status = YYSYNTAX_ERROR;
- if (yysyntax_error_status == 0)
- yymsgp = yymsg;
- else if (yysyntax_error_status == 1)
- {
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
- yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
- if (!yymsg)
- {
- yymsg = yymsgbuf;
- yymsg_alloc = sizeof yymsgbuf;
- yysyntax_error_status = 2;
- }
- else
- {
- yysyntax_error_status = YYSYNTAX_ERROR;
- yymsgp = yymsg;
- }
- }
- yyerror (context, scanner, yymsgp);
- if (yysyntax_error_status == 2)
- goto yyexhaustedlab;
- }
-# undef YYSYNTAX_ERROR
-#endif
- }
-
-
-
- if (yyerrstatus == 3)
- {
- /* If just tried and failed to reuse lookahead token after an
- error, discard it. */
-
- if (yychar <= YYEOF)
- {
- /* Return failure if at end of input. */
- if (yychar == YYEOF)
- YYABORT;
- }
- else
- {
- yydestruct ("Error: discarding",
- yytoken, &yylval, context, scanner);
- yychar = YYEMPTY;
- }
- }
-
- /* Else will try to reuse lookahead token after shifting the error
- token. */
- goto yyerrlab1;
-
-
-/*---------------------------------------------------.
-| yyerrorlab -- error raised explicitly by YYERROR. |
-`---------------------------------------------------*/
-yyerrorlab:
-
- /* Pacify compilers like GCC when the user code never invokes
- YYERROR and the label yyerrorlab therefore never appears in user
- code. */
- if (/*CONSTCOND*/ 0)
- goto yyerrorlab;
-
- /* Do not reclaim the symbols of the rule which action triggered
- this YYERROR. */
- YYPOPSTACK (yylen);
- yylen = 0;
- YY_STACK_PRINT (yyss, yyssp);
- yystate = *yyssp;
- goto yyerrlab1;
-
-
-/*-------------------------------------------------------------.
-| yyerrlab1 -- common code for both syntax error and YYERROR. |
-`-------------------------------------------------------------*/
-yyerrlab1:
- yyerrstatus = 3; /* Each real token shifted decrements this. */
-
- for (;;)
- {
- yyn = yypact[yystate];
- if (!yypact_value_is_default (yyn))
- {
- yyn += YYTERROR;
- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
- {
- yyn = yytable[yyn];
- if (0 < yyn)
- break;
- }
- }
-
- /* Pop the current state because it cannot handle the error token. */
- if (yyssp == yyss)
- YYABORT;
-
-
- yydestruct ("Error: popping",
- yystos[yystate], yyvsp, context, scanner);
- YYPOPSTACK (1);
- yystate = *yyssp;
- YY_STACK_PRINT (yyss, yyssp);
- }
-
- *++yyvsp = yylval;
-
-
- /* Shift the error token. */
- YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
-
- yystate = yyn;
- goto yynewstate;
-
-
-/*-------------------------------------.
-| yyacceptlab -- YYACCEPT comes here. |
-`-------------------------------------*/
-yyacceptlab:
- yyresult = 0;
- goto yyreturn;
-
-/*-----------------------------------.
-| yyabortlab -- YYABORT comes here. |
-`-----------------------------------*/
-yyabortlab:
- yyresult = 1;
- goto yyreturn;
-
-#if !defined(yyoverflow) || YYERROR_VERBOSE
-/*-------------------------------------------------.
-| yyexhaustedlab -- memory exhaustion comes here. |
-`-------------------------------------------------*/
-yyexhaustedlab:
- yyerror (context, scanner, YY_("memory exhausted"));
- yyresult = 2;
- /* Fall through. */
-#endif
-
-yyreturn:
- if (yychar != YYEMPTY)
- {
- /* Make sure we have latest lookahead translation. See comments at
- user semantic actions for why this is necessary. */
- yytoken = YYTRANSLATE (yychar);
- yydestruct ("Cleanup: discarding lookahead",
- yytoken, &yylval, context, scanner);
- }
- /* Do not reclaim the symbols of the rule which action triggered
- this YYABORT or YYACCEPT. */
- YYPOPSTACK (yylen);
- YY_STACK_PRINT (yyss, yyssp);
- while (yyssp != yyss)
- {
- yydestruct ("Cleanup: popping",
- yystos[*yyssp], yyvsp, context, scanner);
- YYPOPSTACK (1);
- }
-#ifndef yyoverflow
- if (yyss != yyssa)
- YYSTACK_FREE (yyss);
-#endif
-#if YYERROR_VERBOSE
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
-#endif
- /* Make sure YYID is used. */
- return YYID (yyresult);
-}
-
-
-
-/* Line 2067 of yacc.c */
-#line 529 "libmemcached/csl/parser.yy"
-
-
-void Context::start()
-{
- config_parse(this, (void **)scanner);
-}
-
-
diff --git a/libmemcached/csl/parser.h b/libmemcached/csl/parser.h
deleted file mode 100644
index 7feab595..00000000
--- a/libmemcached/csl/parser.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/* A Bison parser, made by GNU Bison 2.5. */
-
-/* Bison interface for Yacc-like parsers in C
-
- Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* As a special exception, you may create a larger work that contains
- part or all of the Bison parser skeleton and distribute that work
- under terms of your choice, so long as that work isn't itself a
- parser generator using the skeleton or a modified version thereof
- as a parser skeleton. Alternatively, if you modify or redistribute
- the parser skeleton itself, you may (at your option) remove this
- special exception, which will cause the skeleton and the resulting
- Bison output files to be licensed under the GNU General Public
- License without this special exception.
-
- This special exception was added by the Free Software Foundation in
- version 2.2 of Bison. */
-
-
-/* Tokens. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- COMMENT = 258,
- END = 259,
- ERROR = 260,
- RESET = 261,
- PARSER_DEBUG = 262,
- INCLUDE = 263,
- CONFIGURE_FILE = 264,
- EMPTY_LINE = 265,
- SERVER = 266,
- SOCKET = 267,
- SERVERS = 268,
- SERVERS_OPTION = 269,
- UNKNOWN_OPTION = 270,
- UNKNOWN = 271,
- BINARY_PROTOCOL = 272,
- BUFFER_REQUESTS = 273,
- CONNECT_TIMEOUT = 274,
- DISTRIBUTION = 275,
- HASH = 276,
- HASH_WITH_NAMESPACE = 277,
- IO_BYTES_WATERMARK = 278,
- IO_KEY_PREFETCH = 279,
- IO_MSG_WATERMARK = 280,
- KETAMA_HASH = 281,
- KETAMA_WEIGHTED = 282,
- NOREPLY = 283,
- NUMBER_OF_REPLICAS = 284,
- POLL_TIMEOUT = 285,
- RANDOMIZE_REPLICA_READ = 286,
- RCV_TIMEOUT = 287,
- REMOVE_FAILED_SERVERS = 288,
- RETRY_TIMEOUT = 289,
- SND_TIMEOUT = 290,
- SOCKET_RECV_SIZE = 291,
- SOCKET_SEND_SIZE = 292,
- SORT_HOSTS = 293,
- SUPPORT_CAS = 294,
- USER_DATA = 295,
- USE_UDP = 296,
- VERIFY_KEY = 297,
- _TCP_KEEPALIVE = 298,
- _TCP_KEEPIDLE = 299,
- _TCP_NODELAY = 300,
- FETCH_VERSION = 301,
- NAMESPACE = 302,
- POOL_MIN = 303,
- POOL_MAX = 304,
- MD5 = 305,
- CRC = 306,
- FNV1_64 = 307,
- FNV1A_64 = 308,
- FNV1_32 = 309,
- FNV1A_32 = 310,
- HSIEH = 311,
- MURMUR = 312,
- JENKINS = 313,
- CONSISTENT = 314,
- MODULA = 315,
- RANDOM = 316,
- TRUE = 317,
- FALSE = 318,
- FLOAT = 319,
- NUMBER = 320,
- PORT = 321,
- WEIGHT_START = 322,
- IPADDRESS = 323,
- HOSTNAME = 324,
- STRING = 325,
- QUOTED_STRING = 326,
- FILE_PATH = 327
- };
-#endif
-
-
-
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
-# define YYSTYPE_IS_DECLARED 1
-#endif
-
-
-
-
diff --git a/libmemcached/csl/parser.yy b/libmemcached/csl/parser.yy
index 486fb4b3..4fed2754 100644
--- a/libmemcached/csl/parser.yy
+++ b/libmemcached/csl/parser.yy
@@ -96,14 +96,14 @@ inline void __config_error(Context *context, yyscan_t *scanner, const char *erro
%token COMMENT
%token END
-%token ERROR
+%token CSL_ERROR
%token RESET
%token PARSER_DEBUG
%token INCLUDE
%token CONFIGURE_FILE
%token EMPTY_LINE
%token SERVER
-%token SOCKET
+%token CSL_SOCKET
%token SERVERS
%token SERVERS_OPTION
%token UNKNOWN_OPTION
@@ -165,13 +165,13 @@ inline void __config_error(Context *context, yyscan_t *scanner, const char *erro
%token RANDOM
/* Boolean values */
-%token <boolean> TRUE
-%token <boolean> FALSE
+%token <boolean> CSL_TRUE
+%token <boolean> CSL_FALSE
%nonassoc ','
%nonassoc '='
-%token <number> FLOAT
+%token <number> CSL_FLOAT
%token <number> NUMBER
%token <number> PORT
%token <number> WEIGHT_START
@@ -208,7 +208,7 @@ statement:
context->set_end();
YYACCEPT;
}
- | ERROR
+ | CSL_ERROR
{
context->rc= MEMCACHED_PARSE_USER_ERROR;
parser_abort(context, "ERROR called directly");
@@ -252,7 +252,7 @@ expression:
}
context->unset_server();
}
- | SOCKET string optional_weight
+ | CSL_SOCKET string optional_weight
{
if (memcached_failed(context->rc= memcached_server_add_unix_socket_with_weight(context->memc, $2.c_str, uint32_t($3))))
{
diff --git a/libmemcached/csl/scanner.cc b/libmemcached/csl/scanner.cc
deleted file mode 100644
index 34adff2f..00000000
--- a/libmemcached/csl/scanner.cc
+++ /dev/null
@@ -1,2935 +0,0 @@
-#line 2 "libmemcached/csl/scanner.cc"
-#line 39 "libmemcached/csl/scanner.l"
-
-#include <libmemcached/csl/common.h>
-#include <libmemcached/csl/context.h>
-#include <libmemcached/csl/parser.h>
-#include <libmemcached/csl/symbol.h>
-
-#ifndef __INTEL_COMPILER
-#pragma GCC diagnostic ignored "-Wold-style-cast"
-#pragma GCC diagnostic ignored "-Wsign-compare"
-#pragma GCC diagnostic ignored "-Wunused-parameter"
-#pragma GCC diagnostic ignored "-Wmissing-declarations"
-#pragma GCC diagnostic ignored "-Wunused-result"
-#pragma GCC diagnostic ignored "-Wmissing-noreturn"
-#endif
-
-#ifdef __clang__
-#pragma GCC diagnostic ignored "-Wshorten-64-to-32"
-#endif
-
-#ifndef __INTEL_COMPILER
-#ifndef __clang__
-#pragma GCC diagnostic ignored "-Wlogical-op"
-#endif
-#endif
-
-#define YY_EXTRA_TYPE Context*
-
-
-
-
-#line 34 "libmemcached/csl/scanner.cc"
-
-#define YY_INT_ALIGNED short int
-
-/* A lexical scanner generated by flex */
-
-#define FLEX_SCANNER
-#define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 35
-#if YY_FLEX_SUBMINOR_VERSION > 0
-#define FLEX_BETA
-#endif
-
-/* First, we deal with platform-specific or compiler-specific issues. */
-
-/* begin standard C headers. */
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-
-/* end standard C headers. */
-
-/* flex integer type definitions */
-
-#ifndef FLEXINT_H
-#define FLEXINT_H
-
-/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
-
-#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-
-/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
- * if you want the limit (max/min) macros for int types.
- */
-#ifndef __STDC_LIMIT_MACROS
-#define __STDC_LIMIT_MACROS 1
-#endif
-
-#include <inttypes.h>
-typedef int8_t flex_int8_t;
-typedef uint8_t flex_uint8_t;
-typedef int16_t flex_int16_t;
-typedef uint16_t flex_uint16_t;
-typedef int32_t flex_int32_t;
-typedef uint32_t flex_uint32_t;
-#else
-typedef signed char flex_int8_t;
-typedef short int flex_int16_t;
-typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t;
-typedef unsigned short int flex_uint16_t;
-typedef unsigned int flex_uint32_t;
-#endif /* ! C99 */
-
-/* Limits of integral types. */
-#ifndef INT8_MIN
-#define INT8_MIN (-128)
-#endif
-#ifndef INT16_MIN
-#define INT16_MIN (-32767-1)
-#endif
-#ifndef INT32_MIN
-#define INT32_MIN (-2147483647-1)
-#endif
-#ifndef INT8_MAX
-#define INT8_MAX (127)
-#endif
-#ifndef INT16_MAX
-#define INT16_MAX (32767)
-#endif
-#ifndef INT32_MAX
-#define INT32_MAX (2147483647)
-#endif
-#ifndef UINT8_MAX
-#define UINT8_MAX (255U)
-#endif
-#ifndef UINT16_MAX
-#define UINT16_MAX (65535U)
-#endif
-#ifndef UINT32_MAX
-#define UINT32_MAX (4294967295U)
-#endif
-
-#endif /* ! FLEXINT_H */
-
-#ifdef __cplusplus
-
-/* The "const" storage-class-modifier is valid. */
-#define YY_USE_CONST
-
-#else /* ! __cplusplus */
-
-/* C99 requires __STDC__ to be defined as 1. */
-#if defined (__STDC__)
-
-#define YY_USE_CONST
-
-#endif /* defined (__STDC__) */
-#endif /* ! __cplusplus */
-
-#ifdef YY_USE_CONST
-#define yyconst const
-#else
-#define yyconst
-#endif
-
-/* Returned upon end-of-file. */
-#define YY_NULL 0
-
-/* Promotes a possibly negative, possibly signed char to an unsigned
- * integer for use as an array index. If the signed char is negative,
- * we want to instead treat it as an 8-bit unsigned char, hence the
- * double cast.
- */
-#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
-
-/* An opaque pointer. */
-#ifndef YY_TYPEDEF_YY_SCANNER_T
-#define YY_TYPEDEF_YY_SCANNER_T
-typedef void* yyscan_t;
-#endif
-
-/* For convenience, these vars (plus the bison vars far below)
- are macros in the reentrant scanner. */
-#define yyin yyg->yyin_r
-#define yyout yyg->yyout_r
-#define yyextra yyg->yyextra_r
-#define yyleng yyg->yyleng_r
-#define yytext yyg->yytext_r
-#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
-#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
-#define yy_flex_debug yyg->yy_flex_debug_r
-
-/* Enter a start condition. This macro really ought to take a parameter,
- * but we do it the disgusting crufty way forced on us by the ()-less
- * definition of BEGIN.
- */
-#define BEGIN yyg->yy_start = 1 + 2 *
-
-/* Translate the current start state into a value that can be later handed
- * to BEGIN to return to the state. The YYSTATE alias is for lex
- * compatibility.
- */
-#define YY_START ((yyg->yy_start - 1) / 2)
-#define YYSTATE YY_START
-
-/* Action number for EOF rule of a given start state. */
-#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
-
-/* Special action meaning "start processing a new file". */
-#define YY_NEW_FILE config_restart(yyin ,yyscanner )
-
-#define YY_END_OF_BUFFER_CHAR 0
-
-/* Size of default input buffer. */
-#ifndef YY_BUF_SIZE
-#define YY_BUF_SIZE 16384
-#endif
-
-/* The state buf must be large enough to hold one state per character in the main buffer.
- */
-#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
-
-#ifndef YY_TYPEDEF_YY_BUFFER_STATE
-#define YY_TYPEDEF_YY_BUFFER_STATE
-typedef struct yy_buffer_state *YY_BUFFER_STATE;
-#endif
-
-#define EOB_ACT_CONTINUE_SCAN 0
-#define EOB_ACT_END_OF_FILE 1
-#define EOB_ACT_LAST_MATCH 2
-
- #define YY_LESS_LINENO(n)
-
-/* Return all but the first "n" matched characters back to the input stream. */
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- int yyless_macro_arg = (n); \
- YY_LESS_LINENO(yyless_macro_arg);\
- *yy_cp = yyg->yy_hold_char; \
- YY_RESTORE_YY_MORE_OFFSET \
- yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
- YY_DO_BEFORE_ACTION; /* set up yytext again */ \
- } \
- while ( 0 )
-
-#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
-
-#ifndef YY_TYPEDEF_YY_SIZE_T
-#define YY_TYPEDEF_YY_SIZE_T
-typedef size_t yy_size_t;
-#endif
-
-#ifndef YY_STRUCT_YY_BUFFER_STATE
-#define YY_STRUCT_YY_BUFFER_STATE
-struct yy_buffer_state
- {
- FILE *yy_input_file;
-
- char *yy_ch_buf; /* input buffer */
- char *yy_buf_pos; /* current position in input buffer */
-
- /* Size of input buffer in bytes, not including room for EOB
- * characters.
- */
- yy_size_t yy_buf_size;
-
- /* Number of characters read into yy_ch_buf, not including EOB
- * characters.
- */
- int yy_n_chars;
-
- /* Whether we "own" the buffer - i.e., we know we created it,
- * and can realloc() it to grow it, and should free() it to
- * delete it.
- */
- int yy_is_our_buffer;
-
- /* Whether this is an "interactive" input source; if so, and
- * if we're using stdio for input, then we want to use getc()
- * instead of fread(), to make sure we stop fetching input after
- * each newline.
- */
- int yy_is_interactive;
-
- /* Whether we're considered to be at the beginning of a line.
- * If so, '^' rules will be active on the next match, otherwise
- * not.
- */
- int yy_at_bol;
-
- int yy_bs_lineno; /**< The line count. */
- int yy_bs_column; /**< The column count. */
-
- /* Whether to try to fill the input buffer when we reach the
- * end of it.
- */
- int yy_fill_buffer;
-
- int yy_buffer_status;
-
-#define YY_BUFFER_NEW 0
-#define YY_BUFFER_NORMAL 1
- /* When an EOF's been seen but there's still some text to process
- * then we mark the buffer as YY_EOF_PENDING, to indicate that we
- * shouldn't try reading from the input source any more. We might
- * still have a bunch of tokens to match, though, because of
- * possible backing-up.
- *
- * When we actually see the EOF, we change the status to "new"
- * (via config_restart()), so that the user can continue scanning by
- * just pointing yyin at a new input file.
- */
-#define YY_BUFFER_EOF_PENDING 2
-
- };
-#endif /* !YY_STRUCT_YY_BUFFER_STATE */
-
-/* We provide macros for accessing buffer states in case in the
- * future we want to put the buffer states in a more general
- * "scanner state".
- *
- * Returns the top of the stack, or NULL.
- */
-#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
- ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
- : NULL)
-
-/* Same as previous macro, but useful when we know that the buffer stack is not
- * NULL or when we need an lvalue. For internal use only.
- */
-#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
-
-void config_restart (FILE *input_file ,yyscan_t yyscanner );
-void config__switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
-YY_BUFFER_STATE config__create_buffer (FILE *file,int size ,yyscan_t yyscanner );
-void config__delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
-void config__flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
-void config_push_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
-void config_pop_buffer_state (yyscan_t yyscanner );
-
-static void config_ensure_buffer_stack (yyscan_t yyscanner );
-static void config__load_buffer_state (yyscan_t yyscanner );
-static void config__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
-
-#define YY_FLUSH_BUFFER config__flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
-
-YY_BUFFER_STATE config__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
-YY_BUFFER_STATE config__scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
-YY_BUFFER_STATE config__scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
-
-void *config_alloc (yy_size_t ,yyscan_t yyscanner );
-void *config_realloc (void *,yy_size_t ,yyscan_t yyscanner );
-void config_free (void * ,yyscan_t yyscanner );
-
-#define yy_new_buffer config__create_buffer
-
-#define yy_set_interactive(is_interactive) \
- { \
- if ( ! YY_CURRENT_BUFFER ){ \
- config_ensure_buffer_stack (yyscanner); \
- YY_CURRENT_BUFFER_LVALUE = \
- config__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
- } \
- YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
- }
-
-#define yy_set_bol(at_bol) \
- { \
- if ( ! YY_CURRENT_BUFFER ){\
- config_ensure_buffer_stack (yyscanner); \
- YY_CURRENT_BUFFER_LVALUE = \
- config__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
- } \
- YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
- }
-
-#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
-
-/* Begin user sect3 */
-
-#define config_wrap(n) 1
-#define YY_SKIP_YYWRAP
-
-typedef unsigned char YY_CHAR;
-
-typedef int yy_state_type;
-
-#define yytext_ptr yytext_r
-
-static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
-static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner);
-static int yy_get_next_buffer (yyscan_t yyscanner );
-static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
-
-/* Done after the current pattern has been matched and before the
- * corresponding action - sets up yytext.
- */
-#define YY_DO_BEFORE_ACTION \
- yyg->yytext_ptr = yy_bp; \
- yyleng = (size_t) (yy_cp - yy_bp); \
- yyg->yy_hold_char = *yy_cp; \
- *yy_cp = '\0'; \
- yyg->yy_c_buf_p = yy_cp;
-
-#define YY_NUM_RULES 66
-#define YY_END_OF_BUFFER 67
-/* This struct is not used in this scanner,
- but its presence is necessary. */
-struct yy_trans_info
- {
- flex_int32_t yy_verify;
- flex_int32_t yy_nxt;
- };
-static yyconst flex_int16_t yy_accept[534] =
- { 0,
- 0, 0, 67, 65, 5, 5, 1, 65, 65, 65,
- 2, 65, 65, 65, 65, 65, 65, 65, 65, 65,
- 65, 65, 65, 65, 65, 65, 0, 64, 0, 49,
- 0, 0, 0, 2, 3, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 6, 49, 49, 49, 49, 49,
- 49, 49, 49, 49, 49, 49, 49, 49, 49, 4,
- 63, 63, 2, 3, 63, 54, 63, 45, 63, 63,
- 63, 63, 63, 63, 64, 0, 63, 53, 63, 63,
- 63, 63, 63, 63, 49, 49, 49, 49, 49, 49,
-
- 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
- 49, 49, 49, 49, 49, 4, 0, 63, 2, 3,
- 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
- 63, 63, 63, 47, 49, 49, 49, 49, 49, 49,
- 0, 49, 49, 49, 49, 49, 49, 49, 49, 49,
- 49, 49, 49, 49, 49, 49, 49, 49, 4, 63,
- 63, 3, 63, 43, 46, 48, 63, 0, 59, 63,
- 63, 63, 63, 63, 42, 63, 49, 49, 49, 49,
- 49, 49, 49, 0, 0, 0, 49, 49, 49, 49,
- 49, 49, 0, 49, 49, 49, 0, 49, 49, 49,
-
- 0, 0, 49, 49, 4, 0, 63, 3, 63, 0,
- 63, 63, 63, 63, 51, 60, 52, 63, 49, 49,
- 49, 49, 49, 49, 0, 15, 0, 0, 0, 49,
- 49, 49, 0, 0, 49, 0, 49, 49, 49, 0,
- 49, 0, 49, 0, 0, 0, 0, 49, 4, 62,
- 63, 63, 63, 63, 57, 55, 41, 61, 44, 49,
- 49, 49, 49, 49, 0, 0, 0, 0, 0, 49,
- 49, 49, 0, 0, 49, 0, 49, 0, 49, 0,
- 49, 0, 49, 0, 0, 0, 0, 49, 62, 63,
- 58, 56, 0, 0, 49, 49, 49, 0, 0, 0,
-
- 0, 0, 49, 19, 0, 0, 0, 0, 49, 0,
- 0, 0, 7, 0, 0, 8, 0, 49, 0, 0,
- 34, 0, 0, 62, 63, 0, 0, 49, 0, 49,
- 0, 0, 0, 0, 0, 49, 0, 0, 0, 0,
- 49, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 50, 0, 0, 49, 0, 49, 0,
- 0, 0, 0, 0, 49, 0, 0, 38, 37, 49,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 35, 0, 0, 0, 0, 0, 49, 0, 0,
- 0, 0, 0, 39, 0, 0, 0, 0, 0, 0,
-
- 0, 0, 0, 29, 0, 0, 0, 0, 36, 0,
- 0, 0, 0, 49, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 30, 0,
- 0, 33, 0, 0, 0, 0, 49, 0, 0, 0,
- 0, 0, 0, 0, 0, 23, 0, 0, 26, 0,
- 0, 0, 32, 0, 0, 0, 0, 13, 40, 0,
- 0, 0, 0, 0, 21, 0, 0, 0, 0, 0,
- 31, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 25, 0, 0, 9, 10, 11, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 12, 0,
-
- 0, 17, 0, 0, 0, 0, 0, 0, 0, 0,
- 18, 0, 0, 0, 27, 28, 0, 0, 0, 0,
- 0, 14, 16, 20, 0, 0, 0, 0, 0, 0,
- 22, 24, 0
- } ;
-
-static yyconst flex_int32_t yy_ec[256] =
- { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
- 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 4, 1, 5, 6, 1, 1, 1, 1, 1,
- 1, 1, 1, 7, 8, 9, 10, 11, 12, 13,
- 14, 15, 16, 17, 11, 11, 11, 18, 1, 1,
- 19, 1, 20, 1, 21, 22, 23, 24, 25, 26,
- 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
- 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
- 1, 47, 1, 1, 48, 1, 49, 50, 51, 52,
-
- 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
- 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
- 73, 74, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1
- } ;
-
-static yyconst flex_int32_t yy_meta[75] =
- { 0,
- 1, 1, 1, 1, 2, 1, 1, 2, 2, 1,
- 2, 2, 2, 2, 2, 2, 2, 1, 1, 1,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 1, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2
- } ;
-
-static yyconst flex_int16_t yy_base[539] =
- { 0,
- 0, 628, 628, 1740, 1740, 1740, 1740, 70, 618, 605,
- 67, 74, 0, 57, 52, 59, 73, 57, 64, 74,
- 612, 77, 79, 77, 65, 612, 101, 1740, 609, 138,
- 202, 215, 217, 230, 237, 250, 252, 259, 265, 277,
- 282, 287, 297, 271, 315, 377, 323, 342, 350, 359,
- 364, 396, 401, 606, 1740, 449, 242, 73, 80, 85,
- 90, 78, 378, 79, 397, 398, 92, 77, 94, 441,
- 328, 515, 528, 481, 499, 421, 541, 543, 548, 553,
- 559, 565, 576, 590, 595, 649, 0, 597, 622, 614,
- 624, 656, 632, 674, 123, 132, 235, 249, 253, 271,
-
- 586, 285, 296, 328, 403, 340, 358, 375, 379, 413,
- 650, 404, 438, 456, 444, 717, 730, 743, 756, 768,
- 781, 787, 789, 797, 803, 808, 825, 810, 838, 852,
- 854, 863, 870, 702, 463, 460, 651, 519, 537, 537,
- 656, 544, 561, 594, 634, 652, 662, 572, 655, 654,
- 651, 571, 664, 658, 672, 570, 711, 696, 893, 921,
- 872, 928, 907, 879, 942, 944, 949, 951, 958, 967,
- 973, 975, 980, 993, 995, 1000, 737, 768, 771, 795,
- 787, 798, 126, 796, 860, 852, 857, 861, 961, 569,
- 567, 959, 971, 970, 971, 992, 985, 1002, 564, 994,
-
- 999, 990, 547, 1006, 1056, 1069, 1082, 1740, 1095, 1097,
- 1107, 1113, 1124, 1118, 1131, 1133, 1139, 1145, 989, 998,
- 1010, 1024, 1022, 546, 1066, 1740, 1084, 1086, 1107, 1110,
- 1126, 1122, 1124, 1134, 1135, 1140, 1145, 527, 1133, 1144,
- 1135, 1148, 1140, 1155, 1147, 1159, 1165, 1145, 1740, 1211,
- 1224, 1226, 1232, 1234, 1239, 1245, 1247, 1252, 1257, 526,
- 517, 1161, 1196, 1236, 1221, 1239, 1244, 514, 513, 1249,
- 1226, 472, 1244, 1254, 1247, 1245, 471, 1241, 457, 1251,
- 258, 1250, 1248, 1264, 1266, 1256, 1273, 456, 1316, 1329,
- 1331, 1336, 1271, 1276, 1277, 451, 1278, 1298, 1286, 1307,
-
- 1312, 1307, 1329, 0, 1318, 1322, 1313, 1324, 1313, 1335,
- 1335, 1333, 1740, 1340, 1328, 1740, 1329, 406, 1333, 1345,
- 1740, 1331, 1341, 1396, 1398, 1344, 1367, 1377, 1368, 1369,
- 1373, 1384, 403, 1375, 1393, 1390, 1391, 1394, 373, 372,
- 1396, 1387, 1402, 1391, 1390, 1401, 1402, 1388, 1406, 1438,
- 1400, 1412, 1409, 1460, 1400, 1411, 367, 1429, 1435, 1431,
- 362, 1428, 1447, 1433, 346, 352, 1439, 1740, 1740, 348,
- 1434, 1448, 1453, 1438, 1458, 1448, 1444, 1463, 1453, 1464,
- 1468, 1740, 1445, 1451, 1452, 1468, 1463, 1462, 1475, 1480,
- 1494, 1494, 1498, 1740, 1488, 1486, 1490, 1489, 1498, 1496,
-
- 1493, 1492, 1511, 1740, 1497, 1508, 1506, 1494, 1740, 1505,
- 1516, 1515, 1520, 1512, 1512, 1528, 1510, 1527, 1515, 1535,
- 1530, 1546, 334, 1551, 1538, 333, 340, 336, 1740, 1540,
- 1558, 1740, 1561, 1546, 1554, 1552, 322, 1555, 1557, 1566,
- 1552, 1560, 1558, 321, 1559, 1740, 1572, 1557, 1740, 1561,
- 1562, 1577, 1740, 1568, 1565, 1581, 1567, 1740, 1740, 1584,
- 1578, 1603, 1606, 1600, 1740, 1603, 319, 289, 1609, 1610,
- 1740, 1608, 1602, 285, 1602, 1604, 1612, 1618, 1609, 1619,
- 1620, 1611, 1740, 1605, 1606, 1740, 1740, 1740, 282, 1617,
- 1635, 253, 1626, 1635, 1636, 1636, 1637, 1639, 1740, 1644,
-
- 1634, 1740, 243, 1661, 1662, 1650, 237, 221, 1668, 1663,
- 1740, 1656, 229, 1654, 1740, 1740, 1672, 217, 208, 1660,
- 1674, 1740, 1740, 1740, 1676, 1664, 1682, 1665, 1681, 202,
- 1740, 1740, 1740, 1733, 154, 1735, 131, 1737
- } ;
-
-static yyconst flex_int16_t yy_def[539] =
- { 0,
- 533, 1, 533, 533, 533, 533, 533, 534, 533, 533,
- 535, 533, 535, 535, 535, 535, 535, 535, 535, 535,
- 535, 535, 535, 535, 535, 536, 534, 533, 534, 533,
- 533, 537, 537, 537, 533, 537, 537, 537, 537, 537,
- 537, 537, 537, 537, 537, 538, 537, 537, 537, 537,
- 537, 537, 537, 536, 533, 30, 56, 56, 56, 56,
- 56, 56, 56, 56, 56, 56, 56, 56, 56, 533,
- 537, 537, 537, 533, 537, 537, 537, 537, 537, 537,
- 537, 537, 537, 537, 537, 538, 86, 537, 537, 537,
- 537, 537, 537, 537, 56, 56, 56, 56, 56, 56,
-
- 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
- 56, 56, 56, 56, 56, 533, 537, 537, 537, 533,
- 537, 537, 537, 537, 537, 537, 537, 537, 537, 537,
- 537, 537, 537, 537, 56, 56, 56, 56, 56, 56,
- 533, 56, 56, 56, 56, 56, 56, 56, 56, 56,
- 56, 56, 56, 56, 56, 56, 56, 56, 533, 537,
- 537, 533, 537, 537, 537, 537, 537, 537, 537, 537,
- 537, 537, 537, 537, 537, 537, 56, 56, 56, 56,
- 56, 56, 56, 533, 533, 533, 56, 56, 56, 56,
- 56, 56, 533, 56, 56, 56, 533, 56, 56, 56,
-
- 533, 533, 56, 56, 533, 537, 537, 533, 537, 537,
- 537, 537, 537, 537, 537, 537, 537, 537, 56, 56,
- 56, 56, 56, 56, 533, 533, 533, 533, 533, 56,
- 56, 56, 533, 533, 56, 533, 56, 56, 56, 533,
- 56, 533, 56, 533, 533, 533, 533, 56, 533, 537,
- 537, 537, 537, 537, 537, 537, 537, 537, 537, 56,
- 56, 56, 56, 56, 533, 533, 533, 533, 533, 56,
- 56, 56, 533, 533, 56, 533, 56, 533, 56, 533,
- 56, 533, 56, 533, 533, 533, 533, 56, 537, 537,
- 537, 537, 533, 533, 56, 56, 56, 533, 533, 533,
-
- 533, 533, 56, 56, 533, 533, 533, 533, 56, 533,
- 533, 533, 533, 533, 533, 533, 533, 56, 533, 533,
- 533, 533, 533, 537, 537, 533, 533, 56, 533, 56,
- 533, 533, 533, 533, 533, 56, 533, 533, 533, 533,
- 56, 533, 533, 533, 533, 533, 533, 533, 533, 533,
- 533, 533, 533, 537, 533, 533, 56, 533, 56, 533,
- 533, 533, 533, 533, 56, 533, 533, 533, 533, 56,
- 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
- 533, 533, 533, 533, 533, 533, 533, 56, 533, 533,
- 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
-
- 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
- 533, 533, 533, 56, 533, 533, 533, 533, 533, 533,
- 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
- 533, 533, 533, 533, 533, 533, 56, 533, 533, 533,
- 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
- 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
- 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
- 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
- 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
- 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
-
- 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
- 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
- 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
- 533, 533, 0, 533, 533, 533, 533, 533
- } ;
-
-static yyconst flex_int16_t yy_nxt[1815] =
- { 0,
- 4, 5, 6, 7, 8, 4, 7, 9, 4, 10,
- 11, 11, 11, 11, 11, 11, 11, 12, 7, 4,
- 13, 13, 14, 15, 16, 17, 13, 18, 19, 20,
- 13, 21, 22, 13, 13, 13, 13, 23, 24, 25,
- 13, 13, 13, 13, 13, 13, 4, 4, 13, 13,
- 14, 15, 16, 17, 13, 18, 19, 20, 13, 21,
- 22, 13, 13, 13, 13, 23, 24, 25, 13, 13,
- 13, 13, 13, 13, 28, 33, 38, 34, 34, 34,
- 34, 34, 34, 34, 35, 35, 35, 35, 35, 35,
- 35, 36, 39, 41, 37, 43, 40, 44, 45, 50,
-
- 47, 52, 53, 51, 38, 28, 42, 97, 98, 99,
- 100, 48, 101, 105, 113, 114, 29, 49, 115, 36,
- 39, 41, 37, 43, 40, 44, 45, 50, 47, 52,
- 53, 51, 71, 225, 42, 97, 98, 99, 100, 48,
- 101, 105, 113, 114, 226, 49, 115, 29, 56, 56,
- 56, 56, 56, 56, 56, 32, 135, 136, 56, 57,
- 58, 59, 56, 60, 56, 61, 62, 56, 56, 56,
- 56, 63, 56, 64, 56, 65, 66, 67, 68, 69,
- 56, 56, 56, 56, 135, 136, 56, 57, 58, 59,
- 56, 60, 56, 61, 62, 56, 56, 56, 56, 63,
-
- 56, 64, 56, 65, 66, 67, 68, 69, 56, 56,
- 56, 56, 70, 70, 70, 70, 70, 70, 70, 32,
- 532, 32, 32, 32, 32, 32, 524, 72, 72, 72,
- 72, 72, 72, 72, 32, 523, 520, 32, 33, 516,
- 73, 73, 73, 73, 73, 73, 73, 74, 74, 74,
- 74, 74, 74, 74, 32, 515, 32, 32, 32, 32,
- 32, 511, 32, 32, 32, 315, 32, 32, 137, 32,
- 95, 502, 32, 32, 76, 32, 316, 32, 32, 32,
- 77, 32, 96, 75, 32, 32, 32, 138, 78, 32,
- 32, 32, 139, 83, 32, 32, 137, 32, 95, 32,
-
- 499, 32, 76, 488, 32, 32, 32, 483, 77, 140,
- 96, 75, 32, 80, 79, 138, 78, 142, 32, 32,
- 139, 83, 32, 32, 32, 82, 482, 32, 81, 32,
- 32, 32, 32, 143, 32, 32, 32, 140, 88, 465,
- 458, 80, 79, 451, 32, 142, 32, 450, 84, 32,
- 32, 449, 446, 82, 32, 397, 81, 32, 32, 395,
- 144, 143, 32, 32, 394, 89, 32, 32, 32, 390,
- 32, 32, 32, 147, 386, 32, 84, 27, 27, 27,
- 27, 85, 27, 27, 86, 86, 27, 90, 144, 32,
- 369, 368, 91, 89, 27, 27, 27, 32, 102, 148,
-
- 32, 147, 92, 32, 32, 32, 32, 149, 32, 32,
- 362, 32, 103, 349, 150, 90, 151, 106, 104, 107,
- 91, 108, 109, 29, 86, 32, 102, 148, 32, 32,
- 92, 110, 111, 93, 145, 149, 152, 146, 112, 155,
- 103, 94, 150, 32, 151, 106, 104, 107, 32, 108,
- 109, 116, 116, 116, 116, 116, 116, 116, 329, 110,
- 111, 93, 145, 323, 152, 146, 112, 155, 32, 94,
- 56, 56, 56, 156, 56, 313, 56, 56, 311, 305,
- 157, 158, 56, 177, 56, 178, 56, 56, 56, 56,
- 56, 120, 120, 120, 120, 120, 120, 120, 56, 56,
-
- 56, 156, 56, 32, 56, 56, 32, 32, 157, 158,
- 56, 177, 56, 178, 56, 56, 56, 56, 56, 32,
- 302, 301, 32, 117, 294, 118, 118, 118, 118, 118,
- 118, 118, 32, 293, 278, 32, 33, 121, 119, 119,
- 119, 119, 119, 119, 119, 32, 32, 32, 32, 32,
- 32, 32, 32, 265, 247, 32, 32, 32, 181, 182,
- 32, 32, 32, 32, 183, 121, 32, 32, 187, 32,
- 125, 242, 32, 32, 234, 32, 233, 201, 197, 193,
- 32, 122, 123, 32, 32, 188, 181, 182, 32, 126,
- 32, 124, 183, 141, 32, 32, 187, 32, 32, 32,
-
- 32, 32, 32, 32, 32, 32, 32, 127, 55, 122,
- 123, 533, 32, 188, 55, 189, 46, 126, 32, 124,
- 128, 32, 32, 32, 31, 30, 32, 533, 32, 32,
- 32, 32, 32, 26, 533, 127, 32, 32, 533, 32,
- 32, 533, 32, 189, 32, 533, 130, 131, 128, 27,
- 27, 27, 27, 85, 27, 27, 86, 86, 27, 533,
- 32, 32, 129, 32, 32, 190, 27, 27, 27, 32,
- 533, 32, 153, 133, 130, 131, 179, 184, 32, 32,
- 132, 32, 32, 191, 180, 192, 185, 154, 186, 194,
- 129, 195, 196, 190, 198, 29, 86, 199, 134, 533,
-
- 153, 133, 533, 32, 179, 184, 32, 200, 132, 32,
- 32, 191, 180, 192, 185, 154, 186, 194, 202, 195,
- 196, 32, 198, 533, 204, 199, 134, 159, 159, 159,
- 159, 159, 159, 159, 32, 200, 533, 32, 32, 533,
- 160, 160, 160, 160, 160, 160, 160, 32, 203, 32,
- 32, 117, 204, 161, 161, 161, 161, 161, 161, 161,
- 32, 533, 533, 32, 32, 533, 119, 119, 119, 119,
- 119, 119, 119, 533, 219, 533, 203, 32, 162, 162,
- 162, 162, 162, 162, 162, 32, 533, 533, 32, 32,
- 32, 32, 220, 32, 32, 32, 32, 32, 533, 221,
-
- 533, 32, 219, 32, 32, 32, 533, 32, 533, 163,
- 32, 32, 32, 164, 32, 32, 32, 32, 32, 222,
- 220, 166, 533, 167, 223, 224, 165, 221, 32, 32,
- 533, 533, 32, 32, 32, 169, 32, 163, 171, 533,
- 227, 164, 32, 533, 32, 32, 32, 222, 533, 166,
- 168, 167, 223, 224, 165, 32, 32, 32, 32, 32,
- 32, 32, 32, 169, 533, 170, 171, 32, 227, 172,
- 32, 32, 32, 533, 32, 533, 32, 32, 32, 32,
- 117, 533, 533, 32, 228, 32, 32, 32, 174, 533,
- 229, 533, 173, 170, 176, 230, 231, 172, 533, 32,
-
- 533, 32, 175, 205, 205, 205, 205, 205, 205, 205,
- 32, 32, 228, 533, 32, 32, 174, 32, 229, 32,
- 173, 533, 176, 230, 231, 32, 32, 533, 32, 206,
- 175, 207, 207, 207, 207, 207, 207, 207, 208, 208,
- 208, 208, 208, 208, 208, 209, 32, 533, 32, 32,
- 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
- 533, 533, 32, 533, 211, 32, 32, 212, 32, 533,
- 533, 32, 533, 209, 32, 32, 533, 32, 533, 32,
- 32, 32, 32, 32, 32, 232, 533, 32, 32, 32,
- 213, 32, 533, 235, 533, 215, 210, 32, 32, 32,
-
- 32, 32, 32, 32, 32, 32, 214, 32, 32, 533,
- 236, 237, 533, 232, 32, 238, 239, 216, 213, 533,
- 32, 235, 32, 215, 240, 217, 241, 32, 243, 244,
- 246, 248, 245, 260, 214, 261, 262, 218, 236, 237,
- 32, 533, 32, 238, 239, 216, 263, 32, 533, 533,
- 264, 533, 240, 217, 241, 533, 243, 244, 246, 248,
- 245, 260, 533, 261, 262, 218, 249, 249, 249, 249,
- 249, 249, 249, 32, 263, 533, 32, 32, 264, 250,
- 250, 250, 250, 250, 250, 250, 32, 533, 533, 32,
- 206, 533, 251, 251, 251, 251, 251, 251, 251, 32,
-
- 533, 32, 32, 32, 32, 32, 533, 533, 266, 533,
- 253, 32, 533, 254, 32, 32, 32, 32, 533, 255,
- 32, 32, 32, 267, 533, 32, 32, 256, 32, 32,
- 268, 32, 32, 269, 252, 32, 266, 32, 32, 32,
- 32, 32, 32, 32, 32, 270, 32, 32, 257, 32,
- 533, 267, 32, 32, 32, 533, 258, 271, 268, 272,
- 32, 269, 252, 273, 533, 32, 274, 275, 276, 277,
- 279, 32, 280, 270, 281, 282, 257, 283, 32, 284,
- 32, 285, 286, 259, 258, 271, 32, 272, 287, 288,
- 533, 273, 32, 533, 274, 275, 276, 277, 279, 533,
-
- 280, 295, 281, 282, 533, 283, 533, 284, 533, 285,
- 286, 259, 533, 533, 533, 32, 287, 288, 32, 32,
- 533, 289, 289, 289, 289, 289, 289, 289, 32, 295,
- 32, 32, 206, 32, 32, 296, 32, 533, 32, 32,
- 32, 32, 32, 32, 291, 533, 32, 32, 292, 32,
- 290, 32, 32, 32, 32, 32, 32, 297, 32, 32,
- 32, 32, 298, 296, 32, 32, 533, 299, 300, 303,
- 304, 32, 306, 32, 307, 309, 533, 310, 290, 32,
- 312, 32, 308, 314, 317, 297, 32, 318, 319, 320,
- 298, 321, 32, 322, 32, 299, 300, 303, 304, 32,
-
- 306, 533, 307, 309, 32, 310, 326, 533, 312, 533,
- 308, 314, 317, 327, 328, 318, 319, 320, 330, 321,
- 32, 322, 331, 32, 32, 332, 324, 324, 324, 324,
- 324, 324, 324, 32, 326, 32, 32, 32, 32, 32,
- 32, 327, 328, 32, 32, 333, 330, 334, 533, 335,
- 331, 336, 337, 332, 338, 533, 339, 340, 341, 342,
- 343, 344, 325, 32, 345, 346, 347, 348, 350, 351,
- 352, 353, 533, 333, 533, 334, 32, 335, 32, 336,
- 337, 355, 338, 32, 339, 340, 341, 342, 343, 344,
- 325, 356, 345, 346, 347, 348, 350, 351, 352, 353,
-
- 32, 357, 32, 32, 32, 32, 32, 358, 359, 355,
- 360, 361, 363, 364, 365, 533, 366, 533, 367, 356,
- 370, 371, 372, 373, 374, 375, 376, 377, 378, 357,
- 533, 381, 382, 383, 384, 358, 359, 354, 360, 361,
- 363, 364, 365, 32, 366, 32, 367, 385, 370, 371,
- 372, 373, 374, 375, 376, 377, 378, 387, 379, 381,
- 382, 383, 384, 388, 32, 354, 380, 32, 32, 389,
- 391, 392, 393, 396, 398, 385, 399, 400, 401, 533,
- 402, 403, 404, 405, 406, 387, 379, 407, 408, 409,
- 410, 388, 411, 412, 380, 413, 414, 389, 391, 392,
-
- 393, 396, 398, 415, 399, 400, 401, 32, 402, 403,
- 404, 405, 406, 416, 417, 407, 408, 409, 410, 418,
- 411, 412, 419, 413, 414, 420, 421, 422, 423, 424,
- 425, 415, 426, 427, 428, 429, 430, 431, 432, 433,
- 434, 416, 417, 435, 436, 437, 438, 418, 439, 440,
- 419, 441, 442, 420, 421, 422, 423, 424, 425, 443,
- 426, 427, 428, 429, 430, 431, 432, 433, 434, 444,
- 445, 435, 436, 437, 438, 447, 439, 440, 448, 441,
- 442, 452, 453, 454, 455, 456, 457, 443, 459, 460,
- 461, 462, 463, 464, 466, 467, 468, 444, 445, 469,
-
- 470, 471, 472, 447, 473, 474, 448, 475, 476, 452,
- 453, 454, 455, 456, 457, 477, 459, 460, 461, 462,
- 463, 464, 466, 467, 468, 478, 479, 469, 470, 471,
- 472, 480, 473, 474, 481, 475, 476, 484, 485, 486,
- 487, 489, 490, 477, 491, 492, 493, 494, 495, 496,
- 497, 498, 500, 478, 479, 501, 503, 504, 505, 480,
- 506, 507, 481, 508, 509, 484, 485, 486, 487, 489,
- 490, 510, 491, 492, 493, 494, 495, 496, 497, 498,
- 500, 512, 513, 501, 503, 504, 505, 514, 506, 507,
- 517, 508, 509, 518, 519, 521, 522, 525, 526, 510,
-
- 527, 528, 529, 530, 531, 533, 533, 533, 533, 512,
- 513, 533, 533, 533, 533, 514, 533, 533, 517, 533,
- 533, 518, 519, 521, 522, 525, 526, 533, 527, 528,
- 529, 530, 531, 27, 27, 54, 54, 87, 87, 3,
- 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
- 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
- 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
- 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
- 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
- 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
-
- 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
- 533, 533, 533, 533
- } ;
-
-static yyconst flex_int16_t yy_chk[1815] =
- { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 8, 11, 15, 11, 11, 11,
- 11, 11, 11, 11, 12, 12, 12, 12, 12, 12,
- 12, 14, 16, 17, 14, 18, 16, 19, 20, 23,
-
- 22, 24, 25, 23, 15, 27, 17, 58, 59, 60,
- 61, 22, 62, 64, 67, 68, 8, 22, 69, 14,
- 16, 17, 14, 18, 16, 19, 20, 23, 22, 24,
- 25, 23, 537, 183, 17, 58, 59, 60, 61, 22,
- 62, 64, 67, 68, 183, 22, 69, 27, 30, 30,
- 30, 30, 30, 30, 30, 535, 95, 96, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
- 30, 30, 30, 30, 95, 96, 30, 30, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
-
- 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
- 30, 30, 31, 31, 31, 31, 31, 31, 31, 32,
- 530, 33, 32, 32, 33, 33, 519, 33, 33, 33,
- 33, 33, 33, 33, 34, 518, 513, 34, 34, 508,
- 34, 34, 34, 34, 34, 34, 34, 35, 35, 35,
- 35, 35, 35, 35, 36, 507, 37, 36, 36, 37,
- 37, 503, 32, 38, 33, 281, 38, 38, 97, 39,
- 57, 492, 39, 39, 37, 44, 281, 34, 44, 44,
- 38, 40, 57, 36, 40, 40, 41, 98, 39, 41,
- 41, 42, 99, 44, 42, 42, 97, 36, 57, 37,
-
- 489, 43, 37, 474, 43, 43, 38, 468, 38, 100,
- 57, 36, 39, 41, 40, 98, 39, 102, 44, 45,
- 99, 44, 45, 45, 40, 43, 467, 47, 42, 41,
- 47, 47, 71, 103, 42, 71, 71, 100, 47, 444,
- 437, 41, 40, 428, 43, 102, 48, 427, 45, 48,
- 48, 426, 423, 43, 49, 370, 42, 49, 49, 366,
- 104, 103, 45, 50, 365, 48, 50, 50, 51, 361,
- 47, 51, 51, 106, 357, 71, 45, 46, 46, 46,
- 46, 46, 46, 46, 46, 46, 46, 49, 104, 48,
- 340, 339, 50, 48, 46, 46, 46, 49, 63, 107,
-
- 52, 106, 51, 52, 52, 53, 50, 108, 53, 53,
- 333, 51, 63, 318, 108, 49, 109, 65, 63, 65,
- 50, 65, 66, 46, 46, 76, 63, 107, 76, 76,
- 51, 66, 66, 52, 105, 108, 110, 105, 66, 112,
- 63, 53, 108, 52, 109, 65, 63, 65, 53, 65,
- 66, 70, 70, 70, 70, 70, 70, 70, 296, 66,
- 66, 52, 105, 288, 110, 105, 66, 112, 76, 53,
- 56, 56, 56, 113, 56, 279, 56, 56, 277, 272,
- 114, 115, 56, 135, 56, 136, 56, 56, 56, 56,
- 56, 74, 74, 74, 74, 74, 74, 74, 56, 56,
-
- 56, 113, 56, 75, 56, 56, 75, 75, 114, 115,
- 56, 135, 56, 136, 56, 56, 56, 56, 56, 72,
- 269, 268, 72, 72, 261, 72, 72, 72, 72, 72,
- 72, 72, 73, 260, 238, 73, 73, 75, 73, 73,
- 73, 73, 73, 73, 73, 77, 75, 78, 77, 77,
- 78, 78, 79, 224, 203, 79, 79, 80, 138, 139,
- 80, 80, 72, 81, 140, 75, 81, 81, 142, 82,
- 81, 199, 82, 82, 191, 73, 190, 156, 152, 148,
- 83, 77, 79, 83, 83, 143, 138, 139, 77, 82,
- 78, 80, 140, 101, 84, 79, 142, 84, 84, 85,
-
- 80, 88, 85, 85, 88, 88, 81, 83, 54, 77,
- 79, 29, 82, 143, 26, 144, 21, 82, 90, 80,
- 84, 90, 90, 83, 10, 9, 89, 3, 91, 89,
- 89, 91, 91, 2, 0, 83, 93, 84, 0, 93,
- 93, 0, 85, 144, 88, 0, 90, 91, 84, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 0,
- 92, 90, 89, 92, 92, 145, 86, 86, 86, 89,
- 0, 91, 111, 93, 90, 91, 137, 141, 94, 93,
- 92, 94, 94, 146, 137, 147, 141, 111, 141, 149,
- 89, 150, 151, 145, 153, 86, 86, 154, 94, 0,
-
- 111, 93, 0, 92, 137, 141, 134, 155, 92, 134,
- 134, 146, 137, 147, 141, 111, 141, 149, 157, 150,
- 151, 94, 153, 0, 158, 154, 94, 116, 116, 116,
- 116, 116, 116, 116, 117, 155, 0, 117, 117, 0,
- 117, 117, 117, 117, 117, 117, 117, 118, 157, 134,
- 118, 118, 158, 118, 118, 118, 118, 118, 118, 118,
- 119, 0, 0, 119, 119, 0, 119, 119, 119, 119,
- 119, 119, 119, 0, 177, 0, 157, 117, 120, 120,
- 120, 120, 120, 120, 120, 121, 0, 0, 121, 121,
- 118, 122, 178, 123, 122, 122, 123, 123, 0, 179,
-
- 0, 124, 177, 119, 124, 124, 0, 125, 0, 121,
- 125, 125, 126, 122, 128, 126, 126, 128, 128, 180,
- 178, 124, 0, 125, 181, 182, 123, 179, 121, 127,
- 0, 0, 127, 127, 122, 126, 123, 121, 128, 0,
- 184, 122, 129, 0, 124, 129, 129, 180, 0, 124,
- 125, 125, 181, 182, 123, 126, 130, 128, 131, 130,
- 130, 131, 131, 126, 0, 127, 128, 132, 184, 129,
- 132, 132, 127, 0, 133, 0, 161, 133, 133, 161,
- 161, 0, 0, 164, 185, 129, 164, 164, 131, 0,
- 186, 0, 130, 127, 133, 187, 188, 129, 0, 130,
-
- 0, 131, 132, 159, 159, 159, 159, 159, 159, 159,
- 132, 163, 185, 0, 163, 163, 131, 133, 186, 161,
- 130, 0, 133, 187, 188, 160, 164, 0, 160, 160,
- 132, 160, 160, 160, 160, 160, 160, 160, 162, 162,
- 162, 162, 162, 162, 162, 163, 165, 0, 166, 165,
- 165, 166, 166, 167, 163, 168, 167, 167, 168, 168,
- 0, 0, 169, 0, 168, 169, 169, 168, 160, 0,
- 0, 170, 0, 163, 170, 170, 0, 171, 0, 172,
- 171, 171, 172, 172, 173, 189, 0, 173, 173, 165,
- 170, 166, 0, 192, 0, 172, 167, 174, 168, 175,
-
- 174, 174, 175, 175, 176, 169, 171, 176, 176, 0,
- 193, 194, 0, 189, 170, 195, 196, 173, 170, 0,
- 171, 192, 172, 172, 197, 174, 198, 173, 200, 201,
- 202, 204, 201, 219, 171, 220, 221, 176, 193, 194,
- 174, 0, 175, 195, 196, 173, 222, 176, 0, 0,
- 223, 0, 197, 174, 198, 0, 200, 201, 202, 204,
- 201, 219, 0, 220, 221, 176, 205, 205, 205, 205,
- 205, 205, 205, 206, 222, 0, 206, 206, 223, 206,
- 206, 206, 206, 206, 206, 206, 207, 0, 0, 207,
- 207, 0, 207, 207, 207, 207, 207, 207, 207, 209,
-
- 0, 210, 209, 209, 210, 210, 0, 0, 225, 0,
- 210, 211, 0, 210, 211, 211, 206, 212, 0, 211,
- 212, 212, 214, 227, 0, 214, 214, 212, 213, 207,
- 228, 213, 213, 229, 209, 215, 225, 216, 215, 215,
- 216, 216, 209, 217, 210, 230, 217, 217, 213, 218,
- 0, 227, 218, 218, 211, 0, 214, 231, 228, 232,
- 212, 229, 209, 233, 0, 214, 234, 235, 236, 237,
- 239, 213, 240, 230, 241, 242, 213, 243, 215, 244,
- 216, 245, 246, 218, 214, 231, 217, 232, 247, 248,
- 0, 233, 218, 0, 234, 235, 236, 237, 239, 0,
-
- 240, 262, 241, 242, 0, 243, 0, 244, 0, 245,
- 246, 218, 0, 0, 0, 250, 247, 248, 250, 250,
- 0, 250, 250, 250, 250, 250, 250, 250, 251, 262,
- 252, 251, 251, 252, 252, 263, 253, 0, 254, 253,
- 253, 254, 254, 255, 253, 0, 255, 255, 254, 256,
- 252, 257, 256, 256, 257, 257, 258, 264, 250, 258,
- 258, 259, 265, 263, 259, 259, 0, 266, 267, 270,
- 271, 251, 273, 252, 274, 275, 0, 276, 252, 253,
- 278, 254, 274, 280, 282, 264, 255, 283, 284, 285,
- 265, 286, 256, 287, 257, 266, 267, 270, 271, 258,
-
- 273, 0, 274, 275, 259, 276, 293, 0, 278, 0,
- 274, 280, 282, 294, 295, 283, 284, 285, 297, 286,
- 289, 287, 298, 289, 289, 299, 289, 289, 289, 289,
- 289, 289, 289, 290, 293, 291, 290, 290, 291, 291,
- 292, 294, 295, 292, 292, 300, 297, 301, 0, 302,
- 298, 303, 305, 299, 306, 0, 307, 308, 309, 310,
- 311, 312, 290, 289, 314, 315, 315, 317, 319, 320,
- 322, 323, 0, 300, 0, 301, 290, 302, 291, 303,
- 305, 326, 306, 292, 307, 308, 309, 310, 311, 312,
- 290, 327, 314, 315, 315, 317, 319, 320, 322, 323,
-
- 324, 328, 325, 324, 324, 325, 325, 329, 330, 326,
- 331, 332, 334, 335, 336, 0, 337, 0, 338, 327,
- 341, 342, 343, 344, 345, 346, 347, 348, 349, 328,
- 0, 351, 352, 353, 355, 329, 330, 325, 331, 332,
- 334, 335, 336, 324, 337, 325, 338, 356, 341, 342,
- 343, 344, 345, 346, 347, 348, 349, 358, 350, 351,
- 352, 353, 355, 359, 354, 325, 350, 354, 354, 360,
- 362, 363, 364, 367, 371, 356, 372, 373, 374, 0,
- 375, 376, 377, 378, 379, 358, 350, 380, 381, 383,
- 384, 359, 385, 386, 350, 387, 388, 360, 362, 363,
-
- 364, 367, 371, 389, 372, 373, 374, 354, 375, 376,
- 377, 378, 379, 390, 391, 380, 381, 383, 384, 392,
- 385, 386, 393, 387, 388, 395, 396, 397, 398, 399,
- 400, 389, 401, 402, 403, 405, 406, 407, 408, 410,
- 411, 390, 391, 412, 413, 414, 415, 392, 416, 417,
- 393, 418, 419, 395, 396, 397, 398, 399, 400, 420,
- 401, 402, 403, 405, 406, 407, 408, 410, 411, 421,
- 422, 412, 413, 414, 415, 424, 416, 417, 425, 418,
- 419, 430, 431, 433, 434, 435, 436, 420, 438, 439,
- 440, 441, 442, 443, 445, 447, 448, 421, 422, 450,
-
- 451, 452, 454, 424, 455, 456, 425, 457, 460, 430,
- 431, 433, 434, 435, 436, 461, 438, 439, 440, 441,
- 442, 443, 445, 447, 448, 462, 463, 450, 451, 452,
- 454, 464, 455, 456, 466, 457, 460, 469, 470, 472,
- 473, 475, 476, 461, 477, 478, 479, 480, 481, 482,
- 484, 485, 490, 462, 463, 491, 493, 494, 495, 464,
- 496, 497, 466, 498, 500, 469, 470, 472, 473, 475,
- 476, 501, 477, 478, 479, 480, 481, 482, 484, 485,
- 490, 504, 505, 491, 493, 494, 495, 506, 496, 497,
- 509, 498, 500, 510, 512, 514, 517, 520, 521, 501,
-
- 525, 526, 527, 528, 529, 0, 0, 0, 0, 504,
- 505, 0, 0, 0, 0, 506, 0, 0, 509, 0,
- 0, 510, 512, 514, 517, 520, 521, 0, 525, 526,
- 527, 528, 529, 534, 534, 536, 536, 538, 538, 533,
- 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
- 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
- 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
- 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
- 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
- 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
-
- 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
- 533, 533, 533, 533
- } ;
-
-/* The intent behind this definition is that it'll catch
- * any uses of REJECT which flex missed.
- */
-#define REJECT reject_used_but_not_detected
-#define yymore() yymore_used_but_not_detected
-#define YY_MORE_ADJ 0
-#define YY_RESTORE_YY_MORE_OFFSET
-#line 1 "libmemcached/csl/scanner.l"
-/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * Libmemcached library
- *
- * Copyright (C) 2012 Data Differential, http://datadifferential.com/
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *
- * * The names of its contributors may not be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#line 70 "libmemcached/csl/scanner.l"
-#include <cstdlib>
-#include <cstring>
-
-#define PARAM config_get_extra(yyscanner)
-
-#define get_lex_chars(buffer, result, max_size, context) \
-{ \
- if (context->pos >= context->length) \
- { \
- result= YY_NULL; \
- } \
- else \
- { \
- result= (int)(context->length - context->pos); \
- (size_t)result > (size_t)max_size ? result= max_size : 0; \
- memcpy(buffer, context->buf + context->pos, result); \
- context->pos += result; \
- } \
-}
-
-#define YY_FATAL_ERROR(msg) \
-{ \
-}
-
-
-#define YY_INPUT(buffer, result, max_size) get_lex_chars(buffer, result, max_size, PARAM)
-
-#define YY_NO_INPUT 1
-#line 1106 "libmemcached/csl/scanner.cc"
-
-#define INITIAL 0
-
-#ifndef YY_NO_UNISTD_H
-/* Special case for "unistd.h", since it is non-ANSI. We include it way
- * down here because we want the user's section 1 to have been scanned first.
- * The user has a chance to override it with an option.
- */
-#include <unistd.h>
-#endif
-
-#ifndef YY_EXTRA_TYPE
-#define YY_EXTRA_TYPE void *
-#endif
-
-/* Holds the entire state of the reentrant scanner. */
-struct yyguts_t
- {
-
- /* User-defined. Not touched by flex. */
- YY_EXTRA_TYPE yyextra_r;
-
- /* The rest are the same as the globals declared in the non-reentrant scanner. */
- FILE *yyin_r, *yyout_r;
- size_t yy_buffer_stack_top; /**< index of top of stack. */
- size_t yy_buffer_stack_max; /**< capacity of stack. */
- YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
- char yy_hold_char;
- int yy_n_chars;
- int yyleng_r;
- char *yy_c_buf_p;
- int yy_init;
- int yy_start;
- int yy_did_buffer_switch_on_eof;
- int yy_start_stack_ptr;
- int yy_start_stack_depth;
- int *yy_start_stack;
- yy_state_type yy_last_accepting_state;
- char* yy_last_accepting_cpos;
-
- int yylineno_r;
- int yy_flex_debug_r;
-
- char *yytext_r;
- int yy_more_flag;
- int yy_more_len;
-
- YYSTYPE * yylval_r;
-
- }; /* end struct yyguts_t */
-
-static int yy_init_globals (yyscan_t yyscanner );
-
- /* This must go here because YYSTYPE and YYLTYPE are included
- * from bison output in section 1.*/
- # define yylval yyg->yylval_r
-
-int config_lex_init (yyscan_t* scanner);
-
-int config_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
-
-/* Accessor methods to globals.
- These are made visible to non-reentrant scanners for convenience. */
-
-int config_lex_destroy (yyscan_t yyscanner );
-
-int config_get_debug (yyscan_t yyscanner );
-
-void config_set_debug (int debug_flag ,yyscan_t yyscanner );
-
-YY_EXTRA_TYPE config_get_extra (yyscan_t yyscanner );
-
-void config_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
-
-FILE *config_get_in (yyscan_t yyscanner );
-
-void config_set_in (FILE * in_str ,yyscan_t yyscanner );
-
-FILE *config_get_out (yyscan_t yyscanner );
-
-void config_set_out (FILE * out_str ,yyscan_t yyscanner );
-
-int config_get_leng (yyscan_t yyscanner );
-
-char *config_get_text (yyscan_t yyscanner );
-
-int config_get_lineno (yyscan_t yyscanner );
-
-void config_set_lineno (int line_number ,yyscan_t yyscanner );
-
-int config_get_column (yyscan_t yyscanner );
-
-void config_set_column (int column_no ,yyscan_t yyscanner );
-
-YYSTYPE * config_get_lval (yyscan_t yyscanner );
-
-void config_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
-
-/* Macros after this point can all be overridden by user definitions in
- * section 1.
- */
-
-#ifndef YY_SKIP_YYWRAP
-#ifdef __cplusplus
-extern "C" int config_wrap (yyscan_t yyscanner );
-#else
-extern int config_wrap (yyscan_t yyscanner );
-#endif
-#endif
-
-#ifndef yytext_ptr
-static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
-#endif
-
-#ifndef YY_NO_INPUT
-
-#ifdef __cplusplus
-static int yyinput (yyscan_t yyscanner );
-#else
-static int input (yyscan_t yyscanner );
-#endif
-
-#endif
-
-/* Amount of stuff to slurp up with each read. */
-#ifndef YY_READ_BUF_SIZE
-#define YY_READ_BUF_SIZE 8192
-#endif
-
-/* Copy whatever the last rule matched to the standard output. */
-#ifndef ECHO
-/* This used to be an fputs(), but since the string might contain NUL's,
- * we now use fwrite().
- */
-#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
-#endif
-
-/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
- * is returned in "result".
- */
-#ifndef YY_INPUT
-#define YY_INPUT(buf,result,max_size) \
- if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
- { \
- int c = '*'; \
- unsigned n; \
- for ( n = 0; n < max_size && \
- (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
- buf[n] = (char) c; \
- if ( c == '\n' ) \
- buf[n++] = (char) c; \
- if ( c == EOF && ferror( yyin ) ) \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- result = n; \
- } \
- else \
- { \
- errno=0; \
- while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
- { \
- if( errno != EINTR) \
- { \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- break; \
- } \
- errno=0; \
- clearerr(yyin); \
- } \
- }\
-\
-
-#endif
-
-/* No semi-colon after return; correct usage is to write "yyterminate();" -
- * we don't want an extra ';' after the "return" because that will cause
- * some compilers to complain about unreachable statements.
- */
-#ifndef yyterminate
-#define yyterminate() return YY_NULL
-#endif
-
-/* Number of entries by which start-condition stack grows. */
-#ifndef YY_START_STACK_INCR
-#define YY_START_STACK_INCR 25
-#endif
-
-/* Report a fatal error. */
-#ifndef YY_FATAL_ERROR
-#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
-#endif
-
-/* end tables serialization structures and prototypes */
-
-/* Default declaration of generated scanner - a define so the user can
- * easily add parameters.
- */
-#ifndef YY_DECL
-#define YY_DECL_IS_OURS 1
-
-extern int config_lex \
- (YYSTYPE * yylval_param ,yyscan_t yyscanner);
-
-#define YY_DECL int config_lex \
- (YYSTYPE * yylval_param , yyscan_t yyscanner)
-#endif /* !YY_DECL */
-
-/* Code executed at the beginning of each rule, after yytext and yyleng
- * have been set up.
- */
-#ifndef YY_USER_ACTION
-#define YY_USER_ACTION
-#endif
-
-/* Code executed at the end of each rule. */
-#ifndef YY_BREAK
-#define YY_BREAK break;
-#endif
-
-#define YY_RULE_SETUP \
- if ( yyleng > 0 ) \
- YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
- (yytext[yyleng - 1] == '\n'); \
- YY_USER_ACTION
-
-/** The main scanner function which does all the work.
- */
-YY_DECL
-{
- register yy_state_type yy_current_state;
- register char *yy_cp, *yy_bp;
- register int yy_act;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
-#line 112 "libmemcached/csl/scanner.l"
-
-
-
-#line 1348 "libmemcached/csl/scanner.cc"
-
- yylval = yylval_param;
-
- if ( !yyg->yy_init )
- {
- yyg->yy_init = 1;
-
-#ifdef YY_USER_INIT
- YY_USER_INIT;
-#endif
-
- if ( ! yyg->yy_start )
- yyg->yy_start = 1; /* first start state */
-
- if ( ! yyin )
- yyin = stdin;
-
- if ( ! yyout )
- yyout = stdout;
-
- if ( ! YY_CURRENT_BUFFER ) {
- config_ensure_buffer_stack (yyscanner);
- YY_CURRENT_BUFFER_LVALUE =
- config__create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
- }
-
- config__load_buffer_state(yyscanner );
- }
-
- while ( 1 ) /* loops until end-of-file is reached */
- {
- yy_cp = yyg->yy_c_buf_p;
-
- /* Support of yytext. */
- *yy_cp = yyg->yy_hold_char;
-
- /* yy_bp points to the position in yy_ch_buf of the start of
- * the current run.
- */
- yy_bp = yy_cp;
-
- yy_current_state = yyg->yy_start;
- yy_current_state += YY_AT_BOL();
-yy_match:
- do
- {
- register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
- if ( yy_accept[yy_current_state] )
- {
- yyg->yy_last_accepting_state = yy_current_state;
- yyg->yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 534 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- ++yy_cp;
- }
- while ( yy_current_state != 533 );
- yy_cp = yyg->yy_last_accepting_cpos;
- yy_current_state = yyg->yy_last_accepting_state;
-
-yy_find_action:
- yy_act = yy_accept[yy_current_state];
-
- YY_DO_BEFORE_ACTION;
-
-do_action: /* This label is used only to access EOF actions. */
-
- switch ( yy_act )
- { /* beginning of action switch */
- case 0: /* must back up */
- /* undo the effects of YY_DO_BEFORE_ACTION */
- *yy_cp = yyg->yy_hold_char;
- yy_cp = yyg->yy_last_accepting_cpos;
- yy_current_state = yyg->yy_last_accepting_state;
- goto yy_find_action;
-
-case 1:
-YY_RULE_SETUP
-#line 115 "libmemcached/csl/scanner.l"
-{ return yytext[0];}
- YY_BREAK
-case 2:
-YY_RULE_SETUP
-#line 117 "libmemcached/csl/scanner.l"
-{ yylval->number= atoi(yytext); return (NUMBER); }
- YY_BREAK
-case 3:
-YY_RULE_SETUP
-#line 119 "libmemcached/csl/scanner.l"
-{ yylval->number= atoi(yytext +1); return PORT; }
- YY_BREAK
-case 4:
-YY_RULE_SETUP
-#line 121 "libmemcached/csl/scanner.l"
-{ yylval->number= atoi(yytext +2); return WEIGHT_START; }
- YY_BREAK
-case 5:
-/* rule 5 can match eol */
-YY_RULE_SETUP
-#line 123 "libmemcached/csl/scanner.l"
-; /* skip whitespace */
- YY_BREAK
-case 6:
-*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
-yyg->yy_c_buf_p = yy_cp -= 1;
-YY_DO_BEFORE_ACTION; /* set up yytext again */
-YY_RULE_SETUP
-#line 126 "libmemcached/csl/scanner.l"
-{
- return COMMENT;
- }
- YY_BREAK
-case 7:
-YY_RULE_SETUP
-#line 130 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; yyextra->set_server(); return yyextra->previous_token= SERVER; }
- YY_BREAK
-case 8:
-YY_RULE_SETUP
-#line 132 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= SOCKET; }
- YY_BREAK
-case 9:
-YY_RULE_SETUP
-#line 134 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= BINARY_PROTOCOL; }
- YY_BREAK
-case 10:
-YY_RULE_SETUP
-#line 135 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= BUFFER_REQUESTS; }
- YY_BREAK
-case 11:
-YY_RULE_SETUP
-#line 136 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= CONFIGURE_FILE; }
- YY_BREAK
-case 12:
-YY_RULE_SETUP
-#line 137 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= CONNECT_TIMEOUT; }
- YY_BREAK
-case 13:
-YY_RULE_SETUP
-#line 138 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= DISTRIBUTION; }
- YY_BREAK
-case 14:
-YY_RULE_SETUP
-#line 139 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= HASH_WITH_NAMESPACE; }
- YY_BREAK
-case 15:
-YY_RULE_SETUP
-#line 140 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= HASH; }
- YY_BREAK
-case 16:
-YY_RULE_SETUP
-#line 141 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= IO_BYTES_WATERMARK; }
- YY_BREAK
-case 17:
-YY_RULE_SETUP
-#line 142 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= IO_KEY_PREFETCH; }
- YY_BREAK
-case 18:
-YY_RULE_SETUP
-#line 143 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= IO_MSG_WATERMARK; }
- YY_BREAK
-case 19:
-YY_RULE_SETUP
-#line 144 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= NOREPLY; }
- YY_BREAK
-case 20:
-YY_RULE_SETUP
-#line 145 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= NUMBER_OF_REPLICAS; }
- YY_BREAK
-case 21:
-YY_RULE_SETUP
-#line 146 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= POLL_TIMEOUT; }
- YY_BREAK
-case 22:
-YY_RULE_SETUP
-#line 147 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= RANDOMIZE_REPLICA_READ; }
- YY_BREAK
-case 23:
-YY_RULE_SETUP
-#line 148 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= RCV_TIMEOUT; }
- YY_BREAK
-case 24:
-YY_RULE_SETUP
-#line 149 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= REMOVE_FAILED_SERVERS; }
- YY_BREAK
-case 25:
-YY_RULE_SETUP
-#line 150 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= RETRY_TIMEOUT; }
- YY_BREAK
-case 26:
-YY_RULE_SETUP
-#line 151 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= SND_TIMEOUT; }
- YY_BREAK
-case 27:
-YY_RULE_SETUP
-#line 152 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= SOCKET_RECV_SIZE; }
- YY_BREAK
-case 28:
-YY_RULE_SETUP
-#line 153 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= SOCKET_SEND_SIZE; }
- YY_BREAK
-case 29:
-YY_RULE_SETUP
-#line 154 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= SORT_HOSTS; }
- YY_BREAK
-case 30:
-YY_RULE_SETUP
-#line 155 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= SUPPORT_CAS; }
- YY_BREAK
-case 31:
-YY_RULE_SETUP
-#line 156 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= _TCP_KEEPALIVE; }
- YY_BREAK
-case 32:
-YY_RULE_SETUP
-#line 157 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= _TCP_KEEPIDLE; }
- YY_BREAK
-case 33:
-YY_RULE_SETUP
-#line 158 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= _TCP_NODELAY; }
- YY_BREAK
-case 34:
-YY_RULE_SETUP
-#line 159 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= USE_UDP; }
- YY_BREAK
-case 35:
-YY_RULE_SETUP
-#line 160 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= USER_DATA; }
- YY_BREAK
-case 36:
-YY_RULE_SETUP
-#line 161 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= VERIFY_KEY; }
- YY_BREAK
-case 37:
-YY_RULE_SETUP
-#line 163 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= POOL_MIN; }
- YY_BREAK
-case 38:
-YY_RULE_SETUP
-#line 164 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= POOL_MAX; }
- YY_BREAK
-case 39:
-YY_RULE_SETUP
-#line 166 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= NAMESPACE; }
- YY_BREAK
-case 40:
-YY_RULE_SETUP
-#line 168 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= FETCH_VERSION; }
- YY_BREAK
-case 41:
-YY_RULE_SETUP
-#line 170 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= INCLUDE; }
- YY_BREAK
-case 42:
-YY_RULE_SETUP
-#line 171 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= RESET; }
- YY_BREAK
-case 43:
-YY_RULE_SETUP
-#line 172 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= PARSER_DEBUG; }
- YY_BREAK
-case 44:
-YY_RULE_SETUP
-#line 173 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= SERVERS; }
- YY_BREAK
-case 45:
-YY_RULE_SETUP
-#line 174 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= END; }
- YY_BREAK
-case 46:
-YY_RULE_SETUP
-#line 175 "libmemcached/csl/scanner.l"
-{ yyextra->begin= yytext; return yyextra->previous_token= ERROR; }
- YY_BREAK
-case 47:
-YY_RULE_SETUP
-#line 177 "libmemcached/csl/scanner.l"
-{ return yyextra->previous_token= TRUE; }
- YY_BREAK
-case 48:
-YY_RULE_SETUP
-#line 178 "libmemcached/csl/scanner.l"
-{ return yyextra->previous_token= FALSE; }
- YY_BREAK
-case 49:
-YY_RULE_SETUP
-#line 181 "libmemcached/csl/scanner.l"
-{
- yyextra->begin= yytext;
- return UNKNOWN_OPTION;
- }
- YY_BREAK
-case 50:
-YY_RULE_SETUP
-#line 186 "libmemcached/csl/scanner.l"
-{ return CONSISTENT; }
- YY_BREAK
-case 51:
-YY_RULE_SETUP
-#line 187 "libmemcached/csl/scanner.l"
-{ return MODULA; }
- YY_BREAK
-case 52:
-YY_RULE_SETUP
-#line 188 "libmemcached/csl/scanner.l"
-{ return RANDOM; }
- YY_BREAK
-case 53:
-YY_RULE_SETUP
-#line 190 "libmemcached/csl/scanner.l"
-{ return MD5; }
- YY_BREAK
-case 54:
-YY_RULE_SETUP
-#line 191 "libmemcached/csl/scanner.l"
-{ return CRC; }
- YY_BREAK
-case 55:
-YY_RULE_SETUP
-#line 192 "libmemcached/csl/scanner.l"
-{ return FNV1_64; }
- YY_BREAK
-case 56:
-YY_RULE_SETUP
-#line 193 "libmemcached/csl/scanner.l"
-{ return FNV1A_64; }
- YY_BREAK
-case 57:
-YY_RULE_SETUP
-#line 194 "libmemcached/csl/scanner.l"
-{ return FNV1_32; }
- YY_BREAK
-case 58:
-YY_RULE_SETUP
-#line 195 "libmemcached/csl/scanner.l"
-{ return FNV1A_32; }
- YY_BREAK
-case 59:
-YY_RULE_SETUP
-#line 196 "libmemcached/csl/scanner.l"
-{ return HSIEH; }
- YY_BREAK
-case 60:
-YY_RULE_SETUP
-#line 197 "libmemcached/csl/scanner.l"
-{ return MURMUR; }
- YY_BREAK
-case 61:
-YY_RULE_SETUP
-#line 198 "libmemcached/csl/scanner.l"
-{ return JENKINS; }
- YY_BREAK
-case 62:
-YY_RULE_SETUP
-#line 200 "libmemcached/csl/scanner.l"
-{
- yyextra->hostname(yytext, yyleng, yylval->server);
- return IPADDRESS;
- }
- YY_BREAK
-case 63:
-YY_RULE_SETUP
-#line 205 "libmemcached/csl/scanner.l"
-{
- if (yyextra->is_server())
- {
- yyextra->hostname(yytext, yyleng, yylval->server);
-
- return HOSTNAME;
- }
-
- yyextra->string_buffer(yytext, yyleng, yylval->string);
-
- return STRING;
- }
- YY_BREAK
-case 64:
-/* rule 64 can match eol */
-YY_RULE_SETUP
-#line 218 "libmemcached/csl/scanner.l"
-{
- config_get_text(yyscanner)[yyleng -1]= 0;
- yyextra->string_buffer(yytext +1, yyleng -2, yylval->string);
- return QUOTED_STRING;
- }
- YY_BREAK
-case 65:
-YY_RULE_SETUP
-#line 224 "libmemcached/csl/scanner.l"
-{
- yyextra->begin= yytext;
- return UNKNOWN;
- }
- YY_BREAK
-case 66:
-YY_RULE_SETUP
-#line 229 "libmemcached/csl/scanner.l"
-ECHO;
- YY_BREAK
-#line 1791 "libmemcached/csl/scanner.cc"
-case YY_STATE_EOF(INITIAL):
- yyterminate();
-
- case YY_END_OF_BUFFER:
- {
- /* Amount of text matched not including the EOB char. */
- int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
-
- /* Undo the effects of YY_DO_BEFORE_ACTION. */
- *yy_cp = yyg->yy_hold_char;
- YY_RESTORE_YY_MORE_OFFSET
-
- if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
- {
- /* We're scanning a new file or input source. It's
- * possible that this happened because the user
- * just pointed yyin at a new source and called
- * config_lex(). If so, then we have to assure
- * consistency between YY_CURRENT_BUFFER and our
- * globals. Here is the right place to do so, because
- * this is the first action (other than possibly a
- * back-up) that will match for the new input source.
- */
- yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
- YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
- YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
- }
-
- /* Note that here we test for yy_c_buf_p "<=" to the position
- * of the first EOB in the buffer, since yy_c_buf_p will
- * already have been incremented past the NUL character
- * (since all states make transitions on EOB to the
- * end-of-buffer state). Contrast this with the test
- * in input().
- */
- if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
- { /* This was really a NUL. */
- yy_state_type yy_next_state;
-
- yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state( yyscanner );
-
- /* Okay, we're now positioned to make the NUL
- * transition. We couldn't have
- * yy_get_previous_state() go ahead and do it
- * for us because it doesn't know how to deal
- * with the possibility of jamming (and we don't
- * want to build jamming into it because then it
- * will run more slowly).
- */
-
- yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
-
- yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
-
- if ( yy_next_state )
- {
- /* Consume the NUL. */
- yy_cp = ++yyg->yy_c_buf_p;
- yy_current_state = yy_next_state;
- goto yy_match;
- }
-
- else
- {
- yy_cp = yyg->yy_last_accepting_cpos;
- yy_current_state = yyg->yy_last_accepting_state;
- goto yy_find_action;
- }
- }
-
- else switch ( yy_get_next_buffer( yyscanner ) )
- {
- case EOB_ACT_END_OF_FILE:
- {
- yyg->yy_did_buffer_switch_on_eof = 0;
-
- if ( config_wrap(yyscanner ) )
- {
- /* Note: because we've taken care in
- * yy_get_next_buffer() to have set up
- * yytext, we can now set up
- * yy_c_buf_p so that if some total
- * hoser (like flex itself) wants to
- * call the scanner after we return the
- * YY_NULL, it'll still work - another
- * YY_NULL will get returned.
- */
- yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
-
- yy_act = YY_STATE_EOF(YY_START);
- goto do_action;
- }
-
- else
- {
- if ( ! yyg->yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
- }
- break;
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yyg->yy_c_buf_p =
- yyg->yytext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state( yyscanner );
-
- yy_cp = yyg->yy_c_buf_p;
- yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
- goto yy_match;
-
- case EOB_ACT_LAST_MATCH:
- yyg->yy_c_buf_p =
- &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
-
- yy_current_state = yy_get_previous_state( yyscanner );
-
- yy_cp = yyg->yy_c_buf_p;
- yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
- goto yy_find_action;
- }
- break;
- }
-
- default:
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--no action found" );
- } /* end of action switch */
- } /* end of scanning one token */
-} /* end of config_lex */
-
-/* yy_get_next_buffer - try to read in a new buffer
- *
- * Returns a code representing an action:
- * EOB_ACT_LAST_MATCH -
- * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
- * EOB_ACT_END_OF_FILE - end of file
- */
-static int yy_get_next_buffer (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
- register char *source = yyg->yytext_ptr;
- register int number_to_move, i;
- int ret_val;
-
- if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--end of buffer missed" );
-
- if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
- { /* Don't try to fill the buffer, so this is an EOF. */
- if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
- {
- /* We matched a single character, the EOB, so
- * treat this as a final EOF.
- */
- return EOB_ACT_END_OF_FILE;
- }
-
- else
- {
- /* We matched some text prior to the EOB, first
- * process it.
- */
- return EOB_ACT_LAST_MATCH;
- }
- }
-
- /* Try to read more data. */
-
- /* First move last chars to start of buffer. */
- number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
-
- for ( i = 0; i < number_to_move; ++i )
- *(dest++) = *(source++);
-
- if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
- /* don't do the read, it's not guaranteed to return an EOF,
- * just force an EOF
- */
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
-
- else
- {
- int num_to_read =
- YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
-
- while ( num_to_read <= 0 )
- { /* Not enough room in the buffer - grow it. */
-
- /* just a shorter name for the current buffer */
- YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
-
- int yy_c_buf_p_offset =
- (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
-
- if ( b->yy_is_our_buffer )
- {
- int new_size = b->yy_buf_size * 2;
-
- if ( new_size <= 0 )
- b->yy_buf_size += b->yy_buf_size / 8;
- else
- b->yy_buf_size *= 2;
-
- b->yy_ch_buf = (char *)
- /* Include room in for 2 EOB chars. */
- config_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
- }
- else
- /* Can't grow it, we don't own it. */
- b->yy_ch_buf = 0;
-
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR(
- "fatal error - scanner input buffer overflow" );
-
- yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
-
- num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
- number_to_move - 1;
-
- }
-
- if ( num_to_read > YY_READ_BUF_SIZE )
- num_to_read = YY_READ_BUF_SIZE;
-
- /* Read in more data. */
- YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
- yyg->yy_n_chars, (size_t) num_to_read );
-
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
- }
-
- if ( yyg->yy_n_chars == 0 )
- {
- if ( number_to_move == YY_MORE_ADJ )
- {
- ret_val = EOB_ACT_END_OF_FILE;
- config_restart(yyin ,yyscanner);
- }
-
- else
- {
- ret_val = EOB_ACT_LAST_MATCH;
- YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
- YY_BUFFER_EOF_PENDING;
- }
- }
-
- else
- ret_val = EOB_ACT_CONTINUE_SCAN;
-
- if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
- /* Extend the array by 50%, plus the number we really need. */
- yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) config_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
- if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
- }
-
- yyg->yy_n_chars += number_to_move;
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
-
- yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
-
- return ret_val;
-}
-
-/* yy_get_previous_state - get the state just before the EOB char was reached */
-
- static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
-{
- register yy_state_type yy_current_state;
- register char *yy_cp;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- yy_current_state = yyg->yy_start;
- yy_current_state += YY_AT_BOL();
-
- for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
- {
- register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
- if ( yy_accept[yy_current_state] )
- {
- yyg->yy_last_accepting_state = yy_current_state;
- yyg->yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 534 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- }
-
- return yy_current_state;
-}
-
-/* yy_try_NUL_trans - try to make a transition on the NUL character
- *
- * synopsis
- * next_state = yy_try_NUL_trans( current_state );
- */
- static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
-{
- register int yy_is_jam;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
- register char *yy_cp = yyg->yy_c_buf_p;
-
- register YY_CHAR yy_c = 1;
- if ( yy_accept[yy_current_state] )
- {
- yyg->yy_last_accepting_state = yy_current_state;
- yyg->yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 534 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 533);
-
- return yy_is_jam ? 0 : yy_current_state;
-}
-
-#ifndef YY_NO_INPUT
-#ifdef __cplusplus
- static int yyinput (yyscan_t yyscanner)
-#else
- static int input (yyscan_t yyscanner)
-#endif
-
-{
- int c;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- *yyg->yy_c_buf_p = yyg->yy_hold_char;
-
- if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
- {
- /* yy_c_buf_p now points to the character we want to return.
- * If this occurs *before* the EOB characters, then it's a
- * valid NUL; if not, then we've hit the end of the buffer.
- */
- if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
- /* This was really a NUL. */
- *yyg->yy_c_buf_p = '\0';
-
- else
- { /* need more input */
- int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
- ++yyg->yy_c_buf_p;
-
- switch ( yy_get_next_buffer( yyscanner ) )
- {
- case EOB_ACT_LAST_MATCH:
- /* This happens because yy_g_n_b()
- * sees that we've accumulated a
- * token and flags that we need to
- * try matching the token before
- * proceeding. But for input(),
- * there's no matching to consider.
- * So convert the EOB_ACT_LAST_MATCH
- * to EOB_ACT_END_OF_FILE.
- */
-
- /* Reset buffer status. */
- config_restart(yyin ,yyscanner);
-
- /*FALLTHROUGH*/
-
- case EOB_ACT_END_OF_FILE:
- {
- if ( config_wrap(yyscanner ) )
- return EOF;
-
- if ( ! yyg->yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
-#ifdef __cplusplus
- return yyinput(yyscanner);
-#else
- return input(yyscanner);
-#endif
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
- break;
- }
- }
- }
-
- c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
- *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
- yyg->yy_hold_char = *++yyg->yy_c_buf_p;
-
- YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
-
- return c;
-}
-#endif /* ifndef YY_NO_INPUT */
-
-/** Immediately switch to a different input stream.
- * @param input_file A readable stream.
- * @param yyscanner The scanner object.
- * @note This function does not reset the start condition to @c INITIAL .
- */
- void config_restart (FILE * input_file , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- if ( ! YY_CURRENT_BUFFER ){
- config_ensure_buffer_stack (yyscanner);
- YY_CURRENT_BUFFER_LVALUE =
- config__create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
- }
-
- config__init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
- config__load_buffer_state(yyscanner );
-}
-
-/** Switch to a different input buffer.
- * @param new_buffer The new input buffer.
- * @param yyscanner The scanner object.
- */
- void config__switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- /* TODO. We should be able to replace this entire function body
- * with
- * config_pop_buffer_state();
- * config_push_buffer_state(new_buffer);
- */
- config_ensure_buffer_stack (yyscanner);
- if ( YY_CURRENT_BUFFER == new_buffer )
- return;
-
- if ( YY_CURRENT_BUFFER )
- {
- /* Flush out information for old buffer. */
- *yyg->yy_c_buf_p = yyg->yy_hold_char;
- YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
- }
-
- YY_CURRENT_BUFFER_LVALUE = new_buffer;
- config__load_buffer_state(yyscanner );
-
- /* We don't actually know whether we did this switch during
- * EOF (config_wrap()) processing, but the only time this flag
- * is looked at is after config_wrap() is called, so it's safe
- * to go ahead and always set it.
- */
- yyg->yy_did_buffer_switch_on_eof = 1;
-}
-
-static void config__load_buffer_state (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
- yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
- yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
- yyg->yy_hold_char = *yyg->yy_c_buf_p;
-}
-
-/** Allocate and initialize an input buffer state.
- * @param file A readable stream.
- * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
- * @param yyscanner The scanner object.
- * @return the allocated buffer state.
- */
- YY_BUFFER_STATE config__create_buffer (FILE * file, int size , yyscan_t yyscanner)
-{
- YY_BUFFER_STATE b;
-
- b = (YY_BUFFER_STATE) config_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in config__create_buffer()" );
-
- b->yy_buf_size = size;
-
- /* yy_ch_buf has to be 2 characters longer than the size given because
- * we need to put in 2 end-of-buffer characters.
- */
- b->yy_ch_buf = (char *) config_alloc(b->yy_buf_size + 2 ,yyscanner );
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in config__create_buffer()" );
-
- b->yy_is_our_buffer = 1;
-
- config__init_buffer(b,file ,yyscanner);
-
- return b;
-}
-
-/** Destroy the buffer.
- * @param b a buffer created with config__create_buffer()
- * @param yyscanner The scanner object.
- */
- void config__delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- if ( ! b )
- return;
-
- if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
- YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
-
- if ( b->yy_is_our_buffer )
- config_free((void *) b->yy_ch_buf ,yyscanner );
-
- config_free((void *) b ,yyscanner );
-}
-
-/* Initializes or reinitializes a buffer.
- * This function is sometimes called more than once on the same buffer,
- * such as during a config_restart() or at EOF.
- */
- static void config__init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
-
-{
- int oerrno = errno;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- config__flush_buffer(b ,yyscanner);
-
- b->yy_input_file = file;
- b->yy_fill_buffer = 1;
-
- /* If b is the current buffer, then config__init_buffer was _probably_
- * called from config_restart() or through yy_get_next_buffer.
- * In that case, we don't want to reset the lineno or column.
- */
- if (b != YY_CURRENT_BUFFER){
- b->yy_bs_lineno = 1;
- b->yy_bs_column = 0;
- }
-
- b->yy_is_interactive = 0;
-
- errno = oerrno;
-}
-
-/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
- * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
- * @param yyscanner The scanner object.
- */
- void config__flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- if ( ! b )
- return;
-
- b->yy_n_chars = 0;
-
- /* We always need two end-of-buffer characters. The first causes
- * a transition to the end-of-buffer state. The second causes
- * a jam in that state.
- */
- b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
- b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
-
- b->yy_buf_pos = &b->yy_ch_buf[0];
-
- b->yy_at_bol = 1;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- if ( b == YY_CURRENT_BUFFER )
- config__load_buffer_state(yyscanner );
-}
-
-/** Pushes the new state onto the stack. The new state becomes
- * the current state. This function will allocate the stack
- * if necessary.
- * @param new_buffer The new state.
- * @param yyscanner The scanner object.
- */
-void config_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- if (new_buffer == NULL)
- return;
-
- config_ensure_buffer_stack(yyscanner);
-
- /* This block is copied from config__switch_to_buffer. */
- if ( YY_CURRENT_BUFFER )
- {
- /* Flush out information for old buffer. */
- *yyg->yy_c_buf_p = yyg->yy_hold_char;
- YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
- }
-
- /* Only push if top exists. Otherwise, replace top. */
- if (YY_CURRENT_BUFFER)
- yyg->yy_buffer_stack_top++;
- YY_CURRENT_BUFFER_LVALUE = new_buffer;
-
- /* copied from config__switch_to_buffer. */
- config__load_buffer_state(yyscanner );
- yyg->yy_did_buffer_switch_on_eof = 1;
-}
-
-/** Removes and deletes the top of the stack, if present.
- * The next element becomes the new top.
- * @param yyscanner The scanner object.
- */
-void config_pop_buffer_state (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- if (!YY_CURRENT_BUFFER)
- return;
-
- config__delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
- YY_CURRENT_BUFFER_LVALUE = NULL;
- if (yyg->yy_buffer_stack_top > 0)
- --yyg->yy_buffer_stack_top;
-
- if (YY_CURRENT_BUFFER) {
- config__load_buffer_state(yyscanner );
- yyg->yy_did_buffer_switch_on_eof = 1;
- }
-}
-
-/* Allocates the stack if it does not exist.
- * Guarantees space for at least one push.
- */
-static void config_ensure_buffer_stack (yyscan_t yyscanner)
-{
- int num_to_alloc;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- if (!yyg->yy_buffer_stack) {
-
- /* First allocation is just for 2 elements, since we don't know if this
- * scanner will even need a stack. We use 2 instead of 1 to avoid an
- * immediate realloc on the next call.
- */
- num_to_alloc = 1;
- yyg->yy_buffer_stack = (struct yy_buffer_state**)config_alloc
- (num_to_alloc * sizeof(struct yy_buffer_state*)
- , yyscanner);
- if ( ! yyg->yy_buffer_stack )
- YY_FATAL_ERROR( "out of dynamic memory in config_ensure_buffer_stack()" );
-
- memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
-
- yyg->yy_buffer_stack_max = num_to_alloc;
- yyg->yy_buffer_stack_top = 0;
- return;
- }
-
- if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
-
- /* Increase the buffer to prepare for a possible push. */
- int grow_size = 8 /* arbitrary grow size */;
-
- num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
- yyg->yy_buffer_stack = (struct yy_buffer_state**)config_realloc
- (yyg->yy_buffer_stack,
- num_to_alloc * sizeof(struct yy_buffer_state*)
- , yyscanner);
- if ( ! yyg->yy_buffer_stack )
- YY_FATAL_ERROR( "out of dynamic memory in config_ensure_buffer_stack()" );
-
- /* zero only the new slots.*/
- memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
- yyg->yy_buffer_stack_max = num_to_alloc;
- }
-}
-
-/** Setup the input buffer state to scan directly from a user-specified character buffer.
- * @param base the character buffer
- * @param size the size in bytes of the character buffer
- * @param yyscanner The scanner object.
- * @return the newly allocated buffer state object.
- */
-YY_BUFFER_STATE config__scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
-{
- YY_BUFFER_STATE b;
-
- if ( size < 2 ||
- base[size-2] != YY_END_OF_BUFFER_CHAR ||
- base[size-1] != YY_END_OF_BUFFER_CHAR )
- /* They forgot to leave room for the EOB's. */
- return 0;
-
- b = (YY_BUFFER_STATE) config_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in config__scan_buffer()" );
-
- b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
- b->yy_buf_pos = b->yy_ch_buf = base;
- b->yy_is_our_buffer = 0;
- b->yy_input_file = 0;
- b->yy_n_chars = b->yy_buf_size;
- b->yy_is_interactive = 0;
- b->yy_at_bol = 1;
- b->yy_fill_buffer = 0;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- config__switch_to_buffer(b ,yyscanner );
-
- return b;
-}
-
-/** Setup the input buffer state to scan a string. The next call to config_lex() will
- * scan from a @e copy of @a str.
- * @param yystr a NUL-terminated string to scan
- * @param yyscanner The scanner object.
- * @return the newly allocated buffer state object.
- * @note If you want to scan bytes that may contain NUL values, then use
- * config__scan_bytes() instead.
- */
-YY_BUFFER_STATE config__scan_string (yyconst char * yystr , yyscan_t yyscanner)
-{
-
- return config__scan_bytes(yystr,strlen(yystr) ,yyscanner);
-}
-
-/** Setup the input buffer state to scan the given bytes. The next call to config_lex() will
- * scan from a @e copy of @a bytes.
- * @param bytes the byte buffer to scan
- * @param len the number of bytes in the buffer pointed to by @a bytes.
- * @param yyscanner The scanner object.
- * @return the newly allocated buffer state object.
- */
-YY_BUFFER_STATE config__scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner)
-{
- YY_BUFFER_STATE b;
- char *buf;
- yy_size_t n;
- int i;
-
- /* Get memory for full buffer, including space for trailing EOB's. */
- n = _yybytes_len + 2;
- buf = (char *) config_alloc(n ,yyscanner );
- if ( ! buf )
- YY_FATAL_ERROR( "out of dynamic memory in config__scan_bytes()" );
-
- for ( i = 0; i < _yybytes_len; ++i )
- buf[i] = yybytes[i];
-
- buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
-
- b = config__scan_buffer(buf,n ,yyscanner);
- if ( ! b )
- YY_FATAL_ERROR( "bad buffer in config__scan_bytes()" );
-
- /* It's okay to grow etc. this buffer, and we should throw it
- * away when we're done.
- */
- b->yy_is_our_buffer = 1;
-
- return b;
-}
-
-#ifndef YY_EXIT_FAILURE
-#define YY_EXIT_FAILURE 2
-#endif
-
-static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
-{
- (void) fprintf( stderr, "%s\n", msg );
- exit( YY_EXIT_FAILURE );
-}
-
-/* Redefine yyless() so it works in section 3 code. */
-
-#undef yyless
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- int yyless_macro_arg = (n); \
- YY_LESS_LINENO(yyless_macro_arg);\
- yytext[yyleng] = yyg->yy_hold_char; \
- yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
- yyg->yy_hold_char = *yyg->yy_c_buf_p; \
- *yyg->yy_c_buf_p = '\0'; \
- yyleng = yyless_macro_arg; \
- } \
- while ( 0 )
-
-/* Accessor methods (get/set functions) to struct members. */
-
-/** Get the user-defined data for this scanner.
- * @param yyscanner The scanner object.
- */
-YY_EXTRA_TYPE config_get_extra (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yyextra;
-}
-
-/** Get the current line number.
- * @param yyscanner The scanner object.
- */
-int config_get_lineno (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- if (! YY_CURRENT_BUFFER)
- return 0;
-
- return yylineno;
-}
-
-/** Get the current column number.
- * @param yyscanner The scanner object.
- */
-int config_get_column (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- if (! YY_CURRENT_BUFFER)
- return 0;
-
- return yycolumn;
-}
-
-/** Get the input stream.
- * @param yyscanner The scanner object.
- */
-FILE *config_get_in (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yyin;
-}
-
-/** Get the output stream.
- * @param yyscanner The scanner object.
- */
-FILE *config_get_out (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yyout;
-}
-
-/** Get the length of the current token.
- * @param yyscanner The scanner object.
- */
-int config_get_leng (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yyleng;
-}
-
-/** Get the current token.
- * @param yyscanner The scanner object.
- */
-
-char *config_get_text (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yytext;
-}
-
-/** Set the user-defined data. This data is never touched by the scanner.
- * @param user_defined The data to be associated with this scanner.
- * @param yyscanner The scanner object.
- */
-void config_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyextra = user_defined ;
-}
-
-/** Set the current line number.
- * @param line_number
- * @param yyscanner The scanner object.
- */
-void config_set_lineno (int line_number , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- /* lineno is only valid if an input buffer exists. */
- if (! YY_CURRENT_BUFFER )
- yy_fatal_error( "config_set_lineno called with no buffer" , yyscanner);
-
- yylineno = line_number;
-}
-
-/** Set the current column.
- * @param line_number
- * @param yyscanner The scanner object.
- */
-void config_set_column (int column_no , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- /* column is only valid if an input buffer exists. */
- if (! YY_CURRENT_BUFFER )
- yy_fatal_error( "config_set_column called with no buffer" , yyscanner);
-
- yycolumn = column_no;
-}
-
-/** Set the input stream. This does not discard the current
- * input buffer.
- * @param in_str A readable stream.
- * @param yyscanner The scanner object.
- * @see config__switch_to_buffer
- */
-void config_set_in (FILE * in_str , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyin = in_str ;
-}
-
-void config_set_out (FILE * out_str , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyout = out_str ;
-}
-
-int config_get_debug (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yy_flex_debug;
-}
-
-void config_set_debug (int bdebug , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yy_flex_debug = bdebug ;
-}
-
-/* Accessor methods for yylval and yylloc */
-
-YYSTYPE * config_get_lval (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yylval;
-}
-
-void config_set_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yylval = yylval_param;
-}
-
-/* User-visible API */
-
-/* config_lex_init is special because it creates the scanner itself, so it is
- * the ONLY reentrant function that doesn't take the scanner as the last argument.
- * That's why we explicitly handle the declaration, instead of using our macros.
- */
-
-int config_lex_init(yyscan_t* ptr_yy_globals)
-
-{
- if (ptr_yy_globals == NULL){
- errno = EINVAL;
- return 1;
- }
-
- *ptr_yy_globals = (yyscan_t) config_alloc ( sizeof( struct yyguts_t ), NULL );
-
- if (*ptr_yy_globals == NULL){
- errno = ENOMEM;
- return 1;
- }
-
- /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
- memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
-
- return yy_init_globals ( *ptr_yy_globals );
-}
-
-/* config_lex_init_extra has the same functionality as config_lex_init, but follows the
- * convention of taking the scanner as the last argument. Note however, that
- * this is a *pointer* to a scanner, as it will be allocated by this call (and
- * is the reason, too, why this function also must handle its own declaration).
- * The user defined value in the first argument will be available to config_alloc in
- * the yyextra field.
- */
-
-int config_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
-
-{
- struct yyguts_t dummy_yyguts;
-
- config_set_extra (yy_user_defined, &dummy_yyguts);
-
- if (ptr_yy_globals == NULL){
- errno = EINVAL;
- return 1;
- }
-
- *ptr_yy_globals = (yyscan_t) config_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
-
- if (*ptr_yy_globals == NULL){
- errno = ENOMEM;
- return 1;
- }
-
- /* By setting to 0xAA, we expose bugs in
- yy_init_globals. Leave at 0x00 for releases. */
- memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
-
- config_set_extra (yy_user_defined, *ptr_yy_globals);
-
- return yy_init_globals ( *ptr_yy_globals );
-}
-
-static int yy_init_globals (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- /* Initialization is the same as for the non-reentrant scanner.
- * This function is called from config_lex_destroy(), so don't allocate here.
- */
-
- yyg->yy_buffer_stack = 0;
- yyg->yy_buffer_stack_top = 0;
- yyg->yy_buffer_stack_max = 0;
- yyg->yy_c_buf_p = (char *) 0;
- yyg->yy_init = 0;
- yyg->yy_start = 0;
-
- yyg->yy_start_stack_ptr = 0;
- yyg->yy_start_stack_depth = 0;
- yyg->yy_start_stack = NULL;
-
-/* Defined in main.c */
-#ifdef YY_STDINIT
- yyin = stdin;
- yyout = stdout;
-#else
- yyin = (FILE *) 0;
- yyout = (FILE *) 0;
-#endif
-
- /* For future reference: Set errno on error, since we are called by
- * config_lex_init()
- */
- return 0;
-}
-
-/* config_lex_destroy is for both reentrant and non-reentrant scanners. */
-int config_lex_destroy (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- /* Pop the buffer stack, destroying each element. */
- while(YY_CURRENT_BUFFER){
- config__delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
- YY_CURRENT_BUFFER_LVALUE = NULL;
- config_pop_buffer_state(yyscanner);
- }
-
- /* Destroy the stack itself. */
- config_free(yyg->yy_buffer_stack ,yyscanner);
- yyg->yy_buffer_stack = NULL;
-
- /* Destroy the start condition stack. */
- config_free(yyg->yy_start_stack ,yyscanner );
- yyg->yy_start_stack = NULL;
-
- /* Reset the globals. This is important in a non-reentrant scanner so the next time
- * config_lex() is called, initialization will occur. */
- yy_init_globals( yyscanner);
-
- /* Destroy the main struct (reentrant only). */
- config_free ( yyscanner , yyscanner );
- yyscanner = NULL;
- return 0;
-}
-
-/*
- * Internal utility routines.
- */
-
-#ifndef yytext_ptr
-static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
-{
- register int i;
- for ( i = 0; i < n; ++i )
- s1[i] = s2[i];
-}
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
-{
- register int n;
- for ( n = 0; s[n]; ++n )
- ;
-
- return n;
-}
-#endif
-
-void *config_alloc (yy_size_t size , yyscan_t yyscanner)
-{
- return (void *) malloc( size );
-}
-
-void *config_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
-{
- /* The cast to (char *) in the following accommodates both
- * implementations that use char* generic pointers, and those
- * that use void* generic pointers. It works with the latter
- * because both ANSI C and C++ allow castless assignment from
- * any pointer type to void*, and deal with argument conversions
- * as though doing an assignment.
- */
- return (void *) realloc( (char *) ptr, size );
-}
-
-void config_free (void * ptr , yyscan_t yyscanner)
-{
- free( (char *) ptr ); /* see config_realloc() for (char *) cast */
-}
-
-#define YYTABLES_NAME "yytables"
-
-#line 229 "libmemcached/csl/scanner.l"
-
-
-
-void Context::init_scanner()
-{
- config_lex_init(&scanner);
- config_set_extra(this,scanner);
-}
-
-void Context::destroy_scanner()
-{
- (void)yy_fatal_error; // Removes warning about unused yy_fatal_error()
- config_lex_destroy(scanner);
-}
-
-
diff --git a/libmemcached/csl/scanner.h b/libmemcached/csl/scanner.h
deleted file mode 100644
index 34c5a3ac..00000000
--- a/libmemcached/csl/scanner.h
+++ /dev/null
@@ -1,375 +0,0 @@
-#ifndef config_HEADER_H
-#define config_HEADER_H 1
-#define config_IN_HEADER 1
-
-#line 6 "libmemcached/csl/scanner.h"
-#line 39 "libmemcached/csl/scanner.l"
-
-#include <libmemcached/csl/common.h>
-#include <libmemcached/csl/context.h>
-#include <libmemcached/csl/parser.h>
-#include <libmemcached/csl/symbol.h>
-
-#ifndef __INTEL_COMPILER
-#pragma GCC diagnostic ignored "-Wold-style-cast"
-#pragma GCC diagnostic ignored "-Wsign-compare"
-#pragma GCC diagnostic ignored "-Wunused-parameter"
-#pragma GCC diagnostic ignored "-Wmissing-declarations"
-#pragma GCC diagnostic ignored "-Wunused-result"
-#pragma GCC diagnostic ignored "-Wmissing-noreturn"
-#endif
-
-#ifdef __clang__
-#pragma GCC diagnostic ignored "-Wshorten-64-to-32"
-#endif
-
-#ifndef __INTEL_COMPILER
-#ifndef __clang__
-#pragma GCC diagnostic ignored "-Wlogical-op"
-#endif
-#endif
-
-#define YY_EXTRA_TYPE Context*
-
-
-
-
-#line 38 "libmemcached/csl/scanner.h"
-
-#define YY_INT_ALIGNED short int
-
-/* A lexical scanner generated by flex */
-
-#define FLEX_SCANNER
-#define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 35
-#if YY_FLEX_SUBMINOR_VERSION > 0
-#define FLEX_BETA
-#endif
-
-/* First, we deal with platform-specific or compiler-specific issues. */
-
-/* begin standard C headers. */
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-
-/* end standard C headers. */
-
-/* flex integer type definitions */
-
-#ifndef FLEXINT_H
-#define FLEXINT_H
-
-/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
-
-#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-
-/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
- * if you want the limit (max/min) macros for int types.
- */
-#ifndef __STDC_LIMIT_MACROS
-#define __STDC_LIMIT_MACROS 1
-#endif
-
-#include <inttypes.h>
-typedef int8_t flex_int8_t;
-typedef uint8_t flex_uint8_t;
-typedef int16_t flex_int16_t;
-typedef uint16_t flex_uint16_t;
-typedef int32_t flex_int32_t;
-typedef uint32_t flex_uint32_t;
-#else
-typedef signed char flex_int8_t;
-typedef short int flex_int16_t;
-typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t;
-typedef unsigned short int flex_uint16_t;
-typedef unsigned int flex_uint32_t;
-#endif /* ! C99 */
-
-/* Limits of integral types. */
-#ifndef INT8_MIN
-#define INT8_MIN (-128)
-#endif
-#ifndef INT16_MIN
-#define INT16_MIN (-32767-1)
-#endif
-#ifndef INT32_MIN
-#define INT32_MIN (-2147483647-1)
-#endif
-#ifndef INT8_MAX
-#define INT8_MAX (127)
-#endif
-#ifndef INT16_MAX
-#define INT16_MAX (32767)
-#endif
-#ifndef INT32_MAX
-#define INT32_MAX (2147483647)
-#endif
-#ifndef UINT8_MAX
-#define UINT8_MAX (255U)
-#endif
-#ifndef UINT16_MAX
-#define UINT16_MAX (65535U)
-#endif
-#ifndef UINT32_MAX
-#define UINT32_MAX (4294967295U)
-#endif
-
-#endif /* ! FLEXINT_H */
-
-#ifdef __cplusplus
-
-/* The "const" storage-class-modifier is valid. */
-#define YY_USE_CONST
-
-#else /* ! __cplusplus */
-
-/* C99 requires __STDC__ to be defined as 1. */
-#if defined (__STDC__)
-
-#define YY_USE_CONST
-
-#endif /* defined (__STDC__) */
-#endif /* ! __cplusplus */
-
-#ifdef YY_USE_CONST
-#define yyconst const
-#else
-#define yyconst
-#endif
-
-/* An opaque pointer. */
-#ifndef YY_TYPEDEF_YY_SCANNER_T
-#define YY_TYPEDEF_YY_SCANNER_T
-typedef void* yyscan_t;
-#endif
-
-/* For convenience, these vars (plus the bison vars far below)
- are macros in the reentrant scanner. */
-#define yyin yyg->yyin_r
-#define yyout yyg->yyout_r
-#define yyextra yyg->yyextra_r
-#define yyleng yyg->yyleng_r
-#define yytext yyg->yytext_r
-#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
-#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
-#define yy_flex_debug yyg->yy_flex_debug_r
-
-/* Size of default input buffer. */
-#ifndef YY_BUF_SIZE
-#define YY_BUF_SIZE 16384
-#endif
-
-#ifndef YY_TYPEDEF_YY_BUFFER_STATE
-#define YY_TYPEDEF_YY_BUFFER_STATE
-typedef struct yy_buffer_state *YY_BUFFER_STATE;
-#endif
-
-#ifndef YY_TYPEDEF_YY_SIZE_T
-#define YY_TYPEDEF_YY_SIZE_T
-typedef size_t yy_size_t;
-#endif
-
-#ifndef YY_STRUCT_YY_BUFFER_STATE
-#define YY_STRUCT_YY_BUFFER_STATE
-struct yy_buffer_state
- {
- FILE *yy_input_file;
-
- char *yy_ch_buf; /* input buffer */
- char *yy_buf_pos; /* current position in input buffer */
-
- /* Size of input buffer in bytes, not including room for EOB
- * characters.
- */
- yy_size_t yy_buf_size;
-
- /* Number of characters read into yy_ch_buf, not including EOB
- * characters.
- */
- int yy_n_chars;
-
- /* Whether we "own" the buffer - i.e., we know we created it,
- * and can realloc() it to grow it, and should free() it to
- * delete it.
- */
- int yy_is_our_buffer;
-
- /* Whether this is an "interactive" input source; if so, and
- * if we're using stdio for input, then we want to use getc()
- * instead of fread(), to make sure we stop fetching input after
- * each newline.
- */
- int yy_is_interactive;
-
- /* Whether we're considered to be at the beginning of a line.
- * If so, '^' rules will be active on the next match, otherwise
- * not.
- */
- int yy_at_bol;
-
- int yy_bs_lineno; /**< The line count. */
- int yy_bs_column; /**< The column count. */
-
- /* Whether to try to fill the input buffer when we reach the
- * end of it.
- */
- int yy_fill_buffer;
-
- int yy_buffer_status;
-
- };
-#endif /* !YY_STRUCT_YY_BUFFER_STATE */
-
-void config_restart (FILE *input_file ,yyscan_t yyscanner );
-void config__switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
-YY_BUFFER_STATE config__create_buffer (FILE *file,int size ,yyscan_t yyscanner );
-void config__delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
-void config__flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
-void config_push_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
-void config_pop_buffer_state (yyscan_t yyscanner );
-
-YY_BUFFER_STATE config__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
-YY_BUFFER_STATE config__scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
-YY_BUFFER_STATE config__scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
-
-void *config_alloc (yy_size_t ,yyscan_t yyscanner );
-void *config_realloc (void *,yy_size_t ,yyscan_t yyscanner );
-void config_free (void * ,yyscan_t yyscanner );
-
-/* Begin user sect3 */
-
-#define config_wrap(n) 1
-#define YY_SKIP_YYWRAP
-
-#define yytext_ptr yytext_r
-
-#ifdef YY_HEADER_EXPORT_START_CONDITIONS
-#define INITIAL 0
-
-#endif
-
-#ifndef YY_NO_UNISTD_H
-/* Special case for "unistd.h", since it is non-ANSI. We include it way
- * down here because we want the user's section 1 to have been scanned first.
- * The user has a chance to override it with an option.
- */
-#include <unistd.h>
-#endif
-
-#ifndef YY_EXTRA_TYPE
-#define YY_EXTRA_TYPE void *
-#endif
-
-int config_lex_init (yyscan_t* scanner);
-
-int config_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
-
-/* Accessor methods to globals.
- These are made visible to non-reentrant scanners for convenience. */
-
-int config_lex_destroy (yyscan_t yyscanner );
-
-int config_get_debug (yyscan_t yyscanner );
-
-void config_set_debug (int debug_flag ,yyscan_t yyscanner );
-
-YY_EXTRA_TYPE config_get_extra (yyscan_t yyscanner );
-
-void config_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
-
-FILE *config_get_in (yyscan_t yyscanner );
-
-void config_set_in (FILE * in_str ,yyscan_t yyscanner );
-
-FILE *config_get_out (yyscan_t yyscanner );
-
-void config_set_out (FILE * out_str ,yyscan_t yyscanner );
-
-int config_get_leng (yyscan_t yyscanner );
-
-char *config_get_text (yyscan_t yyscanner );
-
-int config_get_lineno (yyscan_t yyscanner );
-
-void config_set_lineno (int line_number ,yyscan_t yyscanner );
-
-int config_get_column (yyscan_t yyscanner );
-
-void config_set_column (int column_no ,yyscan_t yyscanner );
-
-YYSTYPE * config_get_lval (yyscan_t yyscanner );
-
-void config_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
-
-/* Macros after this point can all be overridden by user definitions in
- * section 1.
- */
-
-#ifndef YY_SKIP_YYWRAP
-#ifdef __cplusplus
-extern "C" int config_wrap (yyscan_t yyscanner );
-#else
-extern int config_wrap (yyscan_t yyscanner );
-#endif
-#endif
-
-#ifndef yytext_ptr
-static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
-#endif
-
-#ifndef YY_NO_INPUT
-
-#endif
-
-/* Amount of stuff to slurp up with each read. */
-#ifndef YY_READ_BUF_SIZE
-#define YY_READ_BUF_SIZE 8192
-#endif
-
-/* Number of entries by which start-condition stack grows. */
-#ifndef YY_START_STACK_INCR
-#define YY_START_STACK_INCR 25
-#endif
-
-/* Default declaration of generated scanner - a define so the user can
- * easily add parameters.
- */
-#ifndef YY_DECL
-#define YY_DECL_IS_OURS 1
-
-extern int config_lex \
- (YYSTYPE * yylval_param ,yyscan_t yyscanner);
-
-#define YY_DECL int config_lex \
- (YYSTYPE * yylval_param , yyscan_t yyscanner)
-#endif /* !YY_DECL */
-
-/* yy_get_previous_state - get the state just before the EOB char was reached */
-
-#undef YY_NEW_FILE
-#undef YY_FLUSH_BUFFER
-#undef yy_set_bol
-#undef yy_new_buffer
-#undef yy_set_interactive
-#undef YY_DO_BEFORE_ACTION
-
-#ifdef YY_DECL_IS_OURS
-#undef YY_DECL_IS_OURS
-#undef YY_DECL
-#endif
-
-#line 229 "libmemcached/csl/scanner.l"
-
-
-#line 374 "libmemcached/csl/scanner.h"
-#undef config_IN_HEADER
-#endif /* config_HEADER_H */
diff --git a/libmemcached/csl/scanner.l b/libmemcached/csl/scanner.l
index 5a341906..e35008a8 100644
--- a/libmemcached/csl/scanner.l
+++ b/libmemcached/csl/scanner.l
@@ -67,9 +67,6 @@
%{
-#include <cstdlib>
-#include <cstring>
-
#define PARAM yyget_extra(yyscanner)
#define get_lex_chars(buffer, result, max_size, context) \
@@ -129,7 +126,7 @@
"--SERVER=" { yyextra->begin= yytext; yyextra->set_server(); return yyextra->previous_token= SERVER; }
-"--SOCKET=" { yyextra->begin= yytext; return yyextra->previous_token= SOCKET; }
+"--SOCKET=" { yyextra->begin= yytext; return yyextra->previous_token= CSL_SOCKET; }
"--BINARY-PROTOCOL" { yyextra->begin= yytext; return yyextra->previous_token= BINARY_PROTOCOL; }
"--BUFFER-REQUESTS" { yyextra->begin= yytext; return yyextra->previous_token= BUFFER_REQUESTS; }
@@ -172,10 +169,10 @@ RESET { yyextra->begin= yytext; return yyextra->previous_token= RESET;
DEBUG { yyextra->begin= yytext; return yyextra->previous_token= PARSER_DEBUG; }
SERVERS { yyextra->begin= yytext; return yyextra->previous_token= SERVERS; }
END { yyextra->begin= yytext; return yyextra->previous_token= END; }
-ERROR { yyextra->begin= yytext; return yyextra->previous_token= ERROR; }
+CSL_ERROR { yyextra->begin= yytext; return yyextra->previous_token= CSL_ERROR; }
-TRUE { return yyextra->previous_token= TRUE; }
-FALSE { return yyextra->previous_token= FALSE; }
+TRUE { return yyextra->previous_token= CSL_TRUE; }
+FALSE { return yyextra->previous_token= CSL_FALSE; }
"--"[[:alnum:]]* {
diff --git a/libmemcached/csl/server.h b/libmemcached/csl/server.h
index fe97eb91..21915d64 100644
--- a/libmemcached/csl/server.h
+++ b/libmemcached/csl/server.h
@@ -38,7 +38,10 @@
#pragma once
#include <cstdlib>
-#include <arpa/inet.h>
+
+#ifdef HAVE_ARPA_INET_H
+# include <arpa/inet.h>
+#endif
struct server_t
{
diff --git a/libmemcached/do.cc b/libmemcached/do.cc
index db533680..ffb9a48b 100644
--- a/libmemcached/do.cc
+++ b/libmemcached/do.cc
@@ -34,6 +34,7 @@ memcached_return_t memcached_vdo(org::libmemcached::Instance* instance,
**/
if (memcached_is_udp(instance->root))
{
+#ifndef __MINGW32__
if (vector[0].buffer or vector[0].length)
{
return memcached_set_error(*instance->root, MEMCACHED_NOT_SUPPORTED, MEMCACHED_AT,
@@ -74,6 +75,9 @@ memcached_return_t memcached_vdo(org::libmemcached::Instance* instance,
}
return MEMCACHED_SUCCESS;
+#else
+ return MEMCACHED_FAILURE;
+#endif
}
bool sent_success= memcached_io_writev(instance, vector, count, with_flush);
diff --git a/libmemcached/error.cc b/libmemcached/error.cc
index d15f9843..67edcce8 100644
--- a/libmemcached/error.cc
+++ b/libmemcached/error.cc
@@ -141,9 +141,12 @@ static void _set(memcached_st& memc, memcached_string_t *str, memcached_return_t
{
#ifdef STRERROR_R_CHAR_P
errmsg_ptr= strerror_r(local_errno, errmsg, sizeof(errmsg));
-#else
+#elif defined(HAVE_STRERROR_R) && HAVE_STRERROR_R
strerror_r(local_errno, errmsg, sizeof(errmsg));
errmsg_ptr= errmsg;
+#elif defined(HAVE_STRERROR) && HAVE_STRERROR
+ snprintf(errmsg, sizeof(errmsg), "%s", strerror(local_errno));
+ errmsg_ptr= errmsg;
#endif
}
@@ -273,7 +276,7 @@ memcached_return_t memcached_set_error(org::libmemcached::Instance& self, memcac
{
assert_msg(rc != MEMCACHED_ERRNO, "Programmer error, MEMCACHED_ERRNO was set to be returned to client");
assert_msg(rc != MEMCACHED_SOME_ERRORS, "Programmer error, MEMCACHED_SOME_ERRORS was about to be set on a org::libmemcached::Instance");
- if (memcached_fatal(rc) == false)
+ if (memcached_fatal(rc) == false and rc != MEMCACHED_CLIENT_ERROR)
{
return rc;
}
@@ -292,7 +295,7 @@ memcached_return_t memcached_set_error(org::libmemcached::Instance& self, memcac
memcached_string_t error_host= { hostname_port_message, size_t(size) };
- assert(self.root);
+ assert_msg(self.root, "Programmer error, root was not set on instance");
if (self.root == NULL)
{
return rc;
@@ -302,6 +305,7 @@ memcached_return_t memcached_set_error(org::libmemcached::Instance& self, memcac
_set(self, (*self.root));
assert(self.root->error_messages);
assert(self.error_messages);
+ assert(self.error_messages->rc == self.root->error_messages->rc);
return rc;
}
@@ -408,6 +412,15 @@ memcached_return_t memcached_set_errno(org::libmemcached::Instance& self, int lo
_set(*self.root, &error_host, rc, at, local_errno);
_set(self, (*self.root));
+#if 0
+ if (self.root->error_messages->rc != self.error_messages->rc)
+ {
+ fprintf(stderr, "%s:%d %s != %s\n", __FILE__, __LINE__,
+ memcached_strerror(NULL, self.root->error_messages->rc),
+ memcached_strerror(NULL, self.error_messages->rc));
+ }
+#endif
+
return rc;
}
diff --git a/libmemcached/instance.h b/libmemcached/instance.h
index dc9e45ed..e564afaa 100644
--- a/libmemcached/instance.h
+++ b/libmemcached/instance.h
@@ -39,19 +39,21 @@
#pragma once
#ifndef WIN32
-#include <netdb.h>
+# ifdef HAVE_NETDB_H
+# include <netdb.h>
+# endif
#endif
#ifdef NI_MAXHOST
-#define MEMCACHED_NI_MAXHOST NI_MAXHOST
+# define MEMCACHED_NI_MAXHOST NI_MAXHOST
#else
-#define MEMCACHED_NI_MAXHOST 1025
+# define MEMCACHED_NI_MAXHOST 1025
#endif
#ifdef NI_MAXSERV
-#define MEMCACHED_NI_MAXSERV NI_MAXSERV
+# define MEMCACHED_NI_MAXSERV NI_MAXSERV
#else
-#define MEMCACHED_NI_MAXSERV 32
+# define MEMCACHED_NI_MAXSERV 32
#endif
#ifdef __cplusplus
diff --git a/libmemcached/io.cc b/libmemcached/io.cc
index 019eafb6..886476f6 100644
--- a/libmemcached/io.cc
+++ b/libmemcached/io.cc
@@ -240,7 +240,7 @@ static memcached_return_t io_wait(org::libmemcached::Instance* ptr,
int local_errno= EINVAL;
int err;
socklen_t len= sizeof (err);
- if (getsockopt(ptr->fd, SOL_SOCKET, SO_ERROR, &err, &len) == 0)
+ if (getsockopt(ptr->fd, SOL_SOCKET, SO_ERROR, (char*)&err, &len) == 0)
{
if (err == 0) // treat this as EINTR
{
diff --git a/libmemcached/memory.h b/libmemcached/memory.h
index 804bde30..12d02849 100644
--- a/libmemcached/memory.h
+++ b/libmemcached/memory.h
@@ -36,7 +36,7 @@
#pragma once
-#include <config.h>
+#include <mem_config.h>
#include <libmemcached/common.h>
diff --git a/libmemcached/response.cc b/libmemcached/response.cc
index 67b0999f..cb0e682b 100644
--- a/libmemcached/response.cc
+++ b/libmemcached/response.cc
@@ -416,7 +416,17 @@ static memcached_return_t textual_read_one_response(org::libmemcached::Instance*
and buffer[6] == '_'
and buffer[7] == 'E' and buffer[8] == 'R' and buffer[9] == 'R' and buffer[10] == 'O' and buffer[11] == 'R')
{
- return MEMCACHED_CLIENT_ERROR;
+ // Move past the basic error message and whitespace
+ char *startptr= buffer + memcached_literal_param_size("CLIENT_ERROR");
+ if (startptr[0] == ' ')
+ {
+ startptr++;
+ }
+
+ char *endptr= startptr;
+ while (*endptr != '\r' && *endptr != '\n') endptr++;
+
+ return memcached_set_error(*instance, MEMCACHED_CLIENT_ERROR, MEMCACHED_AT, startptr, size_t(endptr - startptr));
}
}
break;
diff --git a/libmemcached/server.hpp b/libmemcached/server.hpp
index 351b34be..8cbdc151 100644
--- a/libmemcached/server.hpp
+++ b/libmemcached/server.hpp
@@ -60,12 +60,12 @@ void __server_free(memcached_server_st *);
static inline bool memcached_is_valid_servername(const memcached_string_t& arg)
{
- return (arg.c_str != NULL or arg.size == 0) and arg.size < NI_MAXHOST;
+ return (arg.c_str != NULL or arg.size == 0) and arg.size < MEMCACHED_NI_MAXHOST;
}
static inline bool memcached_is_valid_filename(const memcached_string_t& arg)
{
- return arg.c_str != NULL and arg.size > 0 and arg.size < NI_MAXHOST;
+ return arg.c_str != NULL and arg.size > 0 and arg.size < MEMCACHED_NI_MAXHOST;
}
void memcached_instance_free(org::libmemcached::Instance *);
diff --git a/libmemcached/server_list.cc b/libmemcached/server_list.cc
index 537e9edd..5ead6fe9 100644
--- a/libmemcached/server_list.cc
+++ b/libmemcached/server_list.cc
@@ -45,11 +45,11 @@ memcached_server_list_append_with_weight(memcached_server_list_st ptr,
uint32_t weight,
memcached_return_t *error)
{
- uint32_t count;
-
memcached_return_t unused;
if (error == NULL)
+ {
error= &unused;
+ }
if (hostname == NULL)
{
@@ -60,14 +60,14 @@ memcached_server_list_append_with_weight(memcached_server_list_st ptr,
{
port = 0;
}
- else if (not port)
+ else if (port == 0)
{
port= MEMCACHED_DEFAULT_PORT;
}
/* Increment count for hosts */
- count= 1;
+ uint32_t count= 1;
if (ptr != NULL)
{
count+= memcached_server_list_count(ptr);
diff --git a/libmemcached/socket.hpp b/libmemcached/socket.hpp
index fb589931..30e296ff 100644
--- a/libmemcached/socket.hpp
+++ b/libmemcached/socket.hpp
@@ -46,15 +46,15 @@
* a lot easier to map back to the unix way with macros than going the other
* way without side effect ;-)
*/
-#ifdef WIN32
-#include "win32/wrappers.h"
-#define get_socket_errno() WSAGetLastError()
+#if defined(WIN32) || defined(__MINGW32__)
+# include "win32/wrappers.h"
+# define get_socket_errno() WSAGetLastError()
#else
-#include <unistd.h>
-#define INVALID_SOCKET -1
-#define SOCKET_ERROR -1
-#define closesocket(a) close(a)
-#define get_socket_errno() errno
+# include <unistd.h>
+# define INVALID_SOCKET -1
+# define SOCKET_ERROR -1
+# define closesocket(a) close(a)
+# define get_socket_errno() errno
#endif
#ifdef __cplusplus
@@ -66,15 +66,15 @@ static inline void memcached_close_socket(int& socket_fd)
#endif
#ifndef HAVE_MSG_NOSIGNAL
-#define MSG_NOSIGNAL 0
+# define MSG_NOSIGNAL 0
#endif
#ifndef HAVE_MSG_DONTWAIT
-#define MSG_DONTWAIT 0
+# define MSG_DONTWAIT 0
#endif
#ifndef HAVE_MSG_MORE
-#define MSG_MORE 0
+# define MSG_MORE 0
#endif
diff --git a/libmemcachedutil/common.h b/libmemcachedutil/common.h
index 6d0dc08b..f8984cc5 100644
--- a/libmemcachedutil/common.h
+++ b/libmemcachedutil/common.h
@@ -38,7 +38,11 @@
#pragma once
-#include <config.h>
+#include "mem_config.h"
+
+#include <cstddef>
+#include <cstdlib>
+#include <cstdio>
#include <libmemcachedutil-1.2/util.h>
diff --git a/libtest/alarm.cc b/libtest/alarm.cc
new file mode 100644
index 00000000..2d662622
--- /dev/null
+++ b/libtest/alarm.cc
@@ -0,0 +1,85 @@
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * Data Differential YATL (i.e. libtest) library
+ *
+ * Copyright (C) 2012 Data Differential, http://datadifferential.com/
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include "mem_config.h"
+#include <libtest/common.h>
+
+#include <sys/time.h>
+#include <cstdlib>
+
+namespace libtest {
+
+static const struct timeval default_it_value= { 600, 0 };
+static const struct timeval default_it_interval= { 0, 0 };
+static const struct itimerval defualt_timer= { default_it_interval, default_it_value };
+
+static const struct itimerval cancel_timer= { default_it_interval, default_it_interval };
+
+
+void set_alarm()
+{
+ if (setitimer(ITIMER_VIRTUAL, &defualt_timer, NULL) == -1)
+ {
+ Error << "setitimer() failed";
+ }
+}
+
+void set_alarm(long tv_sec, long tv_usec)
+{
+#if defined(TARGET_OS_OSX) && TARGET_OS_OSX
+ struct timeval it_value= { time_t(tv_sec), suseconds_t(tv_usec) };
+#else
+ struct timeval it_value= { tv_sec, tv_usec };
+#endif
+
+ struct itimerval timer= { default_it_interval, it_value };
+
+ if (setitimer(ITIMER_VIRTUAL, &timer, NULL) == -1)
+ {
+ Error << "setitimer() failed";
+ }
+}
+
+void cancel_alarm()
+{
+ if (setitimer(ITIMER_VIRTUAL, &cancel_timer, NULL) == -1)
+ {
+ Error << "setitimer() failed";
+ }
+}
+
+} // namespace libtest
+
diff --git a/libtest/alarm.h b/libtest/alarm.h
new file mode 100644
index 00000000..f675c580
--- /dev/null
+++ b/libtest/alarm.h
@@ -0,0 +1,46 @@
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * Data Differential YATL (i.e. libtest) library
+ *
+ * Copyright (C) 2012 Data Differential, http://datadifferential.com/
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#pragma once
+
+namespace libtest {
+
+void set_alarm(long tv_sec, long tv_usec);
+void set_alarm();
+void cancel_alarm();
+
+} // namespace libtest
+
diff --git a/libtest/binaries.cc b/libtest/binaries.cc
index d5e0cc72..f58378f7 100644
--- a/libtest/binaries.cc
+++ b/libtest/binaries.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
namespace libtest {
diff --git a/libtest/blobslap_worker.cc b/libtest/blobslap_worker.cc
index dbd41ac6..a6237b34 100644
--- a/libtest/blobslap_worker.cc
+++ b/libtest/blobslap_worker.cc
@@ -35,7 +35,7 @@
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/common.h>
#include <libtest/blobslap_worker.h>
diff --git a/libtest/client.cc b/libtest/client.cc
new file mode 100644
index 00000000..fa3fcbdb
--- /dev/null
+++ b/libtest/client.cc
@@ -0,0 +1,301 @@
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * Data Differential YATL (i.e. libtest) library
+ *
+ * Copyright (C) 2012 Data Differential, http://datadifferential.com/
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include "mem_config.h"
+
+#include <libtest/common.h>
+
+#ifdef HAVE_POLL_H
+# include <poll.h>
+#endif
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <unistd.h>
+#include <string>
+
+#ifndef HAVE_MSG_NOSIGNAL
+# define MSG_NOSIGNAL 0
+#endif
+
+namespace libtest {
+
+SimpleClient::SimpleClient(const std::string& hostname_, in_port_t port_) :
+ _hostname(hostname_),
+ _port(port_),
+ sock_fd(INVALID_SOCKET),
+ requested_message(1)
+ {
+ }
+
+bool SimpleClient::ready(int event_)
+{
+ struct pollfd fds[1];
+ fds[0].fd= sock_fd;
+ fds[0].events= event_;
+ fds[0].revents= 0;
+
+ int ready_fds= poll(fds, 1, 5000);
+
+ if (ready_fds == -1)
+ {
+ _error= strerror(errno);
+ return false;
+ }
+ else if (ready_fds == 1)
+ {
+ if (fds[0].revents & (POLLERR | POLLHUP | POLLNVAL))
+ {
+ int err;
+ socklen_t len= sizeof (err);
+ // We replace errno with err if getsockopt() passes, but err has been
+ // set.
+ if (getsockopt(fds[0].fd, SOL_SOCKET, SO_ERROR, &err, &len) == 0)
+ {
+ // We check the value to see what happened wth the socket.
+ if (err == 0)
+ {
+ _error= "getsockopt() returned no error but poll() indicated one existed";
+ return false;
+ }
+ errno= err;
+ }
+ _error= strerror(errno);
+
+ return false;
+ }
+
+ if (fds[0].revents & event_)
+ {
+ return true;
+ }
+ }
+
+ fatal_assert(ready_fds == 0);
+ _error= "TIMEOUT";
+
+ return false;
+}
+
+struct addrinfo* SimpleClient::lookup()
+{
+ struct addrinfo *ai= NULL;
+ struct addrinfo hints;
+ memset(&hints, 0, sizeof(struct addrinfo));
+ hints.ai_socktype= SOCK_STREAM;
+ hints.ai_protocol= IPPROTO_TCP;
+
+ char service[NI_MAXSERV];
+ (void)snprintf(service, NI_MAXSERV, "%d", _port);
+
+ int getaddrinfo_error;
+ if ((getaddrinfo_error= getaddrinfo(_hostname.c_str(), service, &hints, &ai)) != 0)
+ {
+ if (getaddrinfo_error != EAI_SYSTEM)
+ {
+ _error= gai_strerror(getaddrinfo_error);
+ return NULL;
+ }
+ else
+ {
+ _error= strerror(getaddrinfo_error);
+ return NULL;
+ }
+ }
+
+ return ai;
+}
+
+SimpleClient::~SimpleClient()
+{
+ close_socket();
+}
+
+void SimpleClient::close_socket()
+{
+ close(sock_fd);
+ sock_fd= INVALID_SOCKET;
+}
+
+bool SimpleClient::instance_connect()
+{
+ struct addrinfo *ai;
+ if ((ai= lookup()))
+ {
+ {
+ struct addrinfo* address_info_next= ai;
+
+ while (address_info_next and sock_fd == INVALID_SOCKET)
+ {
+ if ((sock_fd= socket(address_info_next->ai_family, address_info_next->ai_socktype, address_info_next->ai_protocol)) != SOCKET_ERROR)
+ {
+ if (connect(sock_fd, address_info_next->ai_addr, address_info_next->ai_addrlen) == SOCKET_ERROR)
+ {
+ close_socket();
+ _error= strerror(errno);
+ }
+ }
+ else
+ {
+ fatal_message(strerror(errno));
+ }
+ address_info_next= address_info_next->ai_next;
+ }
+
+ freeaddrinfo(ai);
+ }
+
+ if (sock_fd == INVALID_SOCKET)
+ {
+ fatal_assert(_error.size());
+ }
+
+ return bool(sock_fd != INVALID_SOCKET);
+ }
+
+ return false;
+}
+
+bool SimpleClient::is_valid()
+{
+ _error.clear();
+ if (sock_fd == INVALID_SOCKET)
+ {
+ return instance_connect();
+ }
+
+ return true;
+}
+
+bool SimpleClient::message(const std::string& arg)
+{
+ if (is_valid())
+ {
+ if (ready(POLLOUT))
+ {
+ off_t offset= 0;
+ const char* ptr= arg.c_str();
+ size_t len= arg.size();
+
+ do
+ {
+ ssize_t nw= send(sock_fd, ptr + offset, len - offset, MSG_NOSIGNAL);
+ if (nw == -1)
+ {
+ if (errno != EINTR)
+ {
+ _error= strerror(errno);
+ return false;
+ }
+ }
+ else
+ {
+ offset += nw;
+ }
+ } while (offset < ssize_t(len));
+
+ return true;
+ }
+ }
+
+ fatal_assert(_error.size());
+
+ return false;
+}
+
+bool SimpleClient::send_message(const std::string& arg)
+{
+ if (message(arg) == true)
+ {
+ return message("\r\n");
+ }
+
+ return false;
+}
+
+bool SimpleClient::send_message(const std::string& message_, std::string& response_)
+{
+ requested_message++;
+ if (send_message(message_))
+ {
+ return response(response_);
+ }
+
+ return false;
+}
+
+bool SimpleClient::response(std::string& response_)
+{
+ response_.clear();
+
+ if (is_valid())
+ {
+ if (ready(POLLIN))
+ {
+ bool more= true;
+ char buffer[2];
+ buffer[1]= 0;
+ do
+ {
+ ssize_t nr= recv(sock_fd, buffer, 1, MSG_NOSIGNAL);
+ if (nr == -1)
+ {
+ if (errno != EINTR)
+ {
+ _error= strerror(errno);
+ return false;
+ }
+ }
+ else
+ {
+ fatal_assert(nr == 1);
+ if (buffer[0] == '\n')
+ {
+ more= false;
+ }
+ response_.append(buffer);
+ }
+ } while (more);
+
+ return response_.size();
+ }
+ }
+
+ fatal_assert(_error.size());
+ return false;
+}
+
+} // namespace libtest
diff --git a/libtest/client.hpp b/libtest/client.hpp
new file mode 100644
index 00000000..25d0992f
--- /dev/null
+++ b/libtest/client.hpp
@@ -0,0 +1,77 @@
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * Data Differential YATL (i.e. libtest) library
+ *
+ * Copyright (C) 2012 Data Differential, http://datadifferential.com/
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#pragma once
+
+namespace libtest {
+
+class SimpleClient {
+public:
+ SimpleClient(const std::string& hostname_, in_port_t port_);
+ ~SimpleClient();
+
+ bool send_message(const std::string& arg);
+ bool send_message(const std::string& message_, std::string& response_);
+ bool response(std::string&);
+
+ bool is_valid();
+
+ const std::string& error() const
+ {
+ return _error;
+ }
+
+ bool is_error() const
+ {
+ return _error.size();
+ }
+
+private: // Methods
+ void close_socket();
+ bool instance_connect();
+ struct addrinfo* lookup();
+ bool message(const std::string&);
+ bool ready(int event_);
+
+private:
+ std::string _hostname;
+ in_port_t _port;
+ int sock_fd;
+ std::string _error;
+ int requested_message;
+};
+
+} // namespace libtest
diff --git a/libtest/cmdline.cc b/libtest/cmdline.cc
index 5c3d09f2..97eddd07 100644
--- a/libtest/cmdline.cc
+++ b/libtest/cmdline.cc
@@ -34,8 +34,8 @@
*
*/
-#include <config.h>
-#include <libtest/common.h>
+#include "mem_config.h"
+#include "libtest/common.h"
using namespace libtest;
@@ -45,8 +45,12 @@ using namespace libtest;
#include <fcntl.h>
#include <fstream>
#include <memory>
-#include <poll.h>
-#include <spawn.h>
+#ifdef HAVE_POLL_H
+# include <poll.h>
+#endif
+#ifdef HAVE_SPAWN_H
+# include <spawn.h>
+#endif
#include <sstream>
#include <string>
#include <sys/stat.h>
@@ -59,26 +63,9 @@ using namespace libtest;
static char **environ= NULL;
#endif
-extern "C" {
- static int exited_successfully(int status)
- {
- if (status == 0)
- {
- return EXIT_SUCCESS;
- }
-
- if (WIFEXITED(status) == true)
- {
- return WEXITSTATUS(status);
- }
- else if (WIFSIGNALED(status) == true)
- {
- return WTERMSIG(status);
- }
-
- return EXIT_FAILURE;
- }
-}
+#ifndef FD_CLOEXEC
+# define FD_CLOEXEC 0
+#endif
namespace {
@@ -115,14 +102,16 @@ namespace {
switch (arg)
{
case 127:
- return Application::INVALID;
+ return Application::INVALID_POSIX_SPAWN;
case 0:
return Application::SUCCESS;
- default:
case 1:
return Application::FAILURE;
+
+ default:
+ return Application::UNKNOWN;
}
}
}
@@ -140,7 +129,9 @@ Application::Application(const std::string& arg, const bool _use_libtool_arg) :
stdin_fd(STDIN_FILENO),
stdout_fd(STDOUT_FILENO),
stderr_fd(STDERR_FILENO),
- _pid(-1)
+ _pid(-1),
+ _status(0),
+ _app_exit_state(UNINITIALIZED)
{
if (_use_libtool)
{
@@ -195,9 +186,25 @@ Application::error_t Application::run(const char *args[])
posix_spawnattr_t spawnattr;
posix_spawnattr_init(&spawnattr);
- sigset_t set;
- sigemptyset(&set);
- fatal_assert(posix_spawnattr_setsigmask(&spawnattr, &set) == 0);
+ short flags= 0;
+
+ // Child should not block signals
+ flags |= POSIX_SPAWN_SETSIGMASK;
+
+ sigset_t mask;
+ sigemptyset(&mask);
+
+ fatal_assert(posix_spawnattr_setsigmask(&spawnattr, &mask) == 0);
+
+#if defined(POSIX_SPAWN_USEVFORK) || defined(__linux__)
+ // Use USEVFORK on linux
+ flags |= POSIX_SPAWN_USEVFORK;
+#endif
+
+ flags |= POSIX_SPAWN_SETPGROUP;
+ fatal_assert(posix_spawnattr_setpgroup(&spawnattr, 0) == 0);
+
+ fatal_assert(posix_spawnattr_setflags(&spawnattr, flags) == 0);
create_argv(args);
@@ -254,15 +261,7 @@ Application::error_t Application::run(const char *args[])
}
else
{
-
- if (_use_libtool)
- {
- spawn_ret= posix_spawn(&_pid, built_argv[0], &file_actions, &spawnattr, &built_argv[0], NULL);
- }
- else
- {
- spawn_ret= posix_spawnp(&_pid, built_argv[0], &file_actions, &spawnattr, &built_argv[0], NULL);
- }
+ spawn_ret= posix_spawn(&_pid, built_argv[0], &file_actions, &spawnattr, &built_argv[0], NULL);
}
posix_spawn_file_actions_destroy(&file_actions);
@@ -279,9 +278,25 @@ Application::error_t Application::run(const char *args[])
Error << strerror(spawn_ret) << "(" << spawn_ret << ")";
}
_pid= -1;
- return Application::INVALID;
+ return Application::INVALID_POSIX_SPAWN;
}
+ assert(_pid != -1);
+ if (_pid == -1)
+ {
+ return Application::INVALID_POSIX_SPAWN;
+ }
+
+#if 0
+ app_thread_st* _app_thread= new app_thread_st(_pid, _status, built_argv[0], _app_exit_state);
+ int error;
+ if ((error= pthread_create(&_thread, NULL, &app_thread, _app_thread)) != 0)
+ {
+ Error << "pthread_create() died during pthread_create(" << strerror(error) << ")";
+ return Application::FAILURE;
+ }
+#endif
+
return Application::SUCCESS;
}
@@ -302,29 +317,9 @@ void Application::murder()
int count= 5;
while ((count--) > 0 and check())
{
- int kill_ret= kill(_pid, SIGTERM);
- if (kill_ret == 0)
+ if (kill(_pid, SIGTERM) == 0)
{
- int status= 0;
- pid_t waitpid_ret;
- if ((waitpid_ret= waitpid(_pid, &status, WNOHANG)) == -1)
- {
- switch (errno)
- {
- case ECHILD:
- case EINTR:
- break;
-
- default:
- Error << "waitpid() failed after kill with error of " << strerror(errno);
- break;
- }
- }
-
- if (waitpid_ret == 0)
- {
- libtest::dream(1, 0);
- }
+ join();
}
else
{
@@ -338,6 +333,7 @@ void Application::murder()
// If for whatever reason it lives, kill it hard
if (check())
{
+ Error << "using SIGKILL, things will likely go poorly from this point";
(void)kill(_pid, SIGKILL);
}
}
@@ -409,119 +405,67 @@ bool Application::slurp()
return data_was_read;
}
-Application::error_t Application::wait(bool nohang)
+Application::error_t Application::join()
{
- if (_pid == -1)
- {
- return Application::INVALID;
- }
+ pid_t waited_pid= waitpid(_pid, &_status, 0);
- slurp();
-
- error_t exit_code= FAILURE;
+ if (waited_pid == _pid and WIFEXITED(_status) == false)
{
- int status= 0;
- pid_t waited_pid;
- if ((waited_pid= waitpid(_pid, &status, nohang ? WNOHANG : 0)) == -1)
+ /*
+ What we are looking for here is how the exit status happened.
+ - 127 means that posix_spawn() itself had an error.
+ - If WEXITSTATUS is positive we need to see if it is a signal that we sent to kill the process. If not something bad happened in the process itself.
+ - Finally something has happened that we don't currently understand.
+ */
+ if (WEXITSTATUS(_status) == 127)
{
- switch (errno)
- {
- case ECHILD:
- exit_code= Application::SUCCESS;
- break;
-
- case EINTR:
- break;
-
- default:
- Error << "Error occured while waitpid(" << strerror(errno) << ") on pid " << int(_pid);
- break;
- }
+ _app_exit_state= Application::INVALID_POSIX_SPAWN;
+ std::string error_string("posix_spawn() failed pid:");
+ error_string+= _pid;
+ error_string+= " name:";
+ error_string+= built_argv[0];
+ throw std::logic_error(error_string);
}
- else if (waited_pid == 0)
+ else if WIFSIGNALED(_status)
{
- exit_code= Application::SUCCESS;
+ if (WTERMSIG(_status) != SIGTERM and WTERMSIG(_status) != SIGHUP)
+ {
+ _app_exit_state= Application::INVALID_POSIX_SPAWN;
+ std::string error_string(built_argv[0]);
+ error_string+= " was killed by signal ";
+ error_string+= strsignal(WTERMSIG(_status));
+ throw std::runtime_error(error_string);
+ }
+
+ // If we terminted it on purpose then it counts as a success.
+ Out << "waitpid() application terminated at request"
+ << " pid:" << _pid
+ << " name:" << built_argv[0];
}
else
{
- if (waited_pid != _pid)
- {
- throw libtest::fatal(LIBYATL_DEFAULT_PARAM, "Pid mismatch, %d != %d", int(waited_pid), int(_pid));
- }
- exit_code= int_to_error_t(exited_successfully(status));
+ _app_exit_state= Application::UNKNOWN;
+ Error << "Unknown logic state at exit:" << WEXITSTATUS(_status)
+ << " pid:" << _pid
+ << " name:" << built_argv[0];
}
}
-
- slurp();
-
-#if 0
- if (exit_code == Application::INVALID)
- {
- Error << print_argv(built_argv, _argc);
- }
-#endif
-
- return exit_code;
-}
-
-Application::error_t Application::join()
-{
- if (_pid == -1)
+ else if (waited_pid == _pid and WIFEXITED(_status))
{
- return Application::INVALID;
+ _app_exit_state= int_to_error_t(WEXITSTATUS(_status));
}
-
- slurp();
-
- error_t exit_code= FAILURE;
+ else if (waited_pid == -1)
{
- int status= 0;
- pid_t waited_pid;
- do {
- waited_pid= waitpid(_pid, &status, 0);
- } while (waited_pid == -1 and (errno == EINTR or errno == EAGAIN));
-
- if (waited_pid == -1)
- {
- switch (errno)
- {
- case ECHILD:
- exit_code= Application::SUCCESS;
- break;
-
- case EINTR:
- break;
-
- default:
- Error << "Error occured while waitpid(" << strerror(errno) << ") on pid " << int(_pid);
- break;
- }
- }
- else if (waited_pid == 0)
- {
- exit_code= Application::SUCCESS;
- }
- else
- {
- if (waited_pid != _pid)
- {
- throw libtest::fatal(LIBYATL_DEFAULT_PARAM, "Pid mismatch, %d != %d", int(waited_pid), int(_pid));
- }
-
- exit_code= int_to_error_t(exited_successfully(status));
- }
+ _app_exit_state= Application::UNKNOWN;
+ Error << "waitpid() returned errno:" << strerror(errno);
}
-
- slurp();
-
-#if 0
- if (exit_code == Application::INVALID)
+ else
{
- Error << print_argv(built_argv, _argc);
+ _app_exit_state= Application::UNKNOWN;
+ throw std::logic_error("waitpid() returned an unknown value");
}
-#endif
- return exit_code;
+ return _app_exit_state;
}
void Application::add_long_option(const std::string& name, const std::string& option_value)
@@ -604,14 +548,24 @@ bool Application::Pipe::read(libtest::vchar_t& arg)
void Application::Pipe::nonblock()
{
- int ret;
- if ((ret= fcntl(_pipe_fd[READ], F_GETFL, 0)) == -1)
+ int flags;
+ {
+ flags= fcntl(_pipe_fd[READ], F_GETFL, 0);
+ } while (flags == -1 and (errno == EINTR or errno == EAGAIN));
+
+ if (flags == -1)
{
Error << "fcntl(F_GETFL) " << strerror(errno);
throw strerror(errno);
}
- if ((ret= fcntl(_pipe_fd[READ], F_SETFL, ret | O_NONBLOCK)) == -1)
+ int rval;
+ do
+ {
+ rval= fcntl(_pipe_fd[READ], F_SETFL, flags | O_NONBLOCK);
+ } while (rval == -1 and (errno == EINTR or errno == EAGAIN));
+
+ if (rval == -1)
{
Error << "fcntl(F_SETFL) " << strerror(errno);
throw strerror(errno);
@@ -624,7 +578,7 @@ void Application::Pipe::reset()
close(WRITE);
#if defined(HAVE_PIPE2) && HAVE_PIPE2
- if (pipe2(_pipe_fd, O_NONBLOCK) == -1)
+ if (pipe2(_pipe_fd, O_NONBLOCK|O_CLOEXEC) == -1)
#else
if (pipe(_pipe_fd) == -1)
#endif
@@ -634,26 +588,44 @@ void Application::Pipe::reset()
_open[0]= true;
_open[1]= true;
- if (true)
+#if defined(HAVE_PIPE2) && HAVE_PIPE2
{
nonblock();
cloexec();
}
+#endif
}
void Application::Pipe::cloexec()
{
- int ret;
- if ((ret= fcntl(_pipe_fd[WRITE], F_GETFD, 0)) == -1)
+ //if (SOCK_CLOEXEC == 0)
{
- Error << "fcntl(F_GETFD) " << strerror(errno);
- throw strerror(errno);
- }
+ if (FD_CLOEXEC)
+ {
+ int flags;
+ do
+ {
+ flags= fcntl(_pipe_fd[WRITE], F_GETFD, 0);
+ } while (flags == -1 and (errno == EINTR or errno == EAGAIN));
- if ((ret= fcntl(_pipe_fd[WRITE], F_SETFD, ret | FD_CLOEXEC)) == -1)
- {
- Error << "fcntl(F_SETFD) " << strerror(errno);
- throw strerror(errno);
+ if (flags == -1)
+ {
+ Error << "fcntl(F_GETFD) " << strerror(errno);
+ throw strerror(errno);
+ }
+
+ int rval;
+ do
+ {
+ rval= fcntl(_pipe_fd[WRITE], F_SETFD, flags | FD_CLOEXEC);
+ } while (rval == -1 && (errno == EINTR or errno == EAGAIN));
+
+ if (rval == -1)
+ {
+ Error << "fcntl(F_SETFD) " << strerror(errno);
+ throw strerror(errno);
+ }
+ }
}
}
@@ -716,12 +688,14 @@ void Application::create_argv(const char *args[])
if (_use_valgrind)
{
/*
- valgrind --error-exitcode=1 --leak-check=yes --show-reachable=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE
+ valgrind --error-exitcode=1 --leak-check=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE
*/
built_argv.push_back(strdup("valgrind"));
built_argv.push_back(strdup("--error-exitcode=1"));
built_argv.push_back(strdup("--leak-check=yes"));
+#if 0
built_argv.push_back(strdup("--show-reachable=yes"));
+#endif
built_argv.push_back(strdup("--track-fds=yes"));
#if 0
built_argv[x++]= strdup("--track-origin=yes");
diff --git a/libtest/cmdline.h b/libtest/cmdline.h
index 46f7ad78..ae4d9ba1 100644
--- a/libtest/cmdline.h
+++ b/libtest/cmdline.h
@@ -42,6 +42,14 @@
#define EXIT_SKIP 77
#define EXIT_FATAL 77
+#ifndef EX_NOEXEC
+# define EX_NOEXEC 126
+#endif
+
+#ifndef EX_NOTFOUND
+# define EX_NOTFOUND 127
+#endif
+
namespace libtest {
class Application {
@@ -53,7 +61,11 @@ public:
enum error_t {
SUCCESS= EXIT_SUCCESS,
FAILURE= EXIT_FAILURE,
- INVALID= 127
+ UNINITIALIZED,
+ SIGTERM_KILLED,
+ UNKNOWN,
+ UNKNOWN_SIGNAL,
+ INVALID_POSIX_SPAWN= 127
};
static const char* toString(error_t arg)
@@ -63,12 +75,22 @@ public:
case Application::SUCCESS:
return "EXIT_SUCCESS";
+ case Application::UNINITIALIZED:
+ return "UNINITIALIZED";
+
+ case Application::SIGTERM_KILLED:
+ return "Exit happened via SIGTERM";
+
case Application::FAILURE:
return "EXIT_FAILURE";
- case Application::INVALID:
- return "127";
+ case Application::UNKNOWN_SIGNAL:
+ return "Exit happened via a signal which was not SIGTERM";
+
+ case Application::INVALID_POSIX_SPAWN:
+ return "127: Invalid call to posix_spawn()";
+ case Application::UNKNOWN:
default:
break;
}
@@ -111,7 +133,6 @@ public:
void add_option(const std::string&, const std::string&);
void add_long_option(const std::string& option_name, const std::string& option_value);
error_t run(const char *args[]= NULL);
- error_t wait(bool nohang= true);
Application::error_t join();
libtest::vchar_t stdout_result() const
@@ -201,6 +222,9 @@ private:
pid_t _pid;
libtest::vchar_t _stdout_buffer;
libtest::vchar_t _stderr_buffer;
+ int _status;
+ pthread_t _thread;
+ error_t _app_exit_state;
};
static inline std::ostream& operator<<(std::ostream& output, const enum Application::error_t &arg)
diff --git a/libtest/collection.cc b/libtest/collection.cc
index 26e8bb44..dda1341a 100644
--- a/libtest/collection.cc
+++ b/libtest/collection.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/common.h>
@@ -118,19 +118,21 @@ test_return_t Collection::exec()
}
}
- alarm(600);
+ set_alarm();
+
try
{
return_code= runner_code(_frame, run, _timer);
}
catch (...)
{
- alarm(0);
+ cancel_alarm();
+
throw;
}
- alarm(0);
+ libtest::cancel_alarm();
}
- catch (libtest::exception &e)
+ catch (libtest::fatal &e)
{
stream::cerr(e.file(), e.line(), e.func()) << e.what();
_failed++;
diff --git a/libtest/common.h b/libtest/common.h
index 4d8d5724..6c7e294c 100644
--- a/libtest/common.h
+++ b/libtest/common.h
@@ -46,23 +46,40 @@
#include <string>
#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
+# include <sys/types.h>
#endif
#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
+# include <sys/time.h>
#endif
#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
+# include <sys/wait.h>
#endif
#ifdef HAVE_SYS_RESOURCE_H
-#include <sys/resource.h>
+# include <sys/resource.h>
#endif
#ifdef HAVE_FNMATCH_H
-#include <fnmatch.h>
+# include <fnmatch.h>
+#endif
+
+#ifdef HAVE_ARPA_INET_H
+# include <arpa/inet.h>
+#endif
+
+#if defined(WIN32) || defined(__MINGW32__)
+# include "win32/wrappers.h"
+# define get_socket_errno() WSAGetLastError()
+#else
+# ifdef HAVE_UNISTD_H
+# include <unistd.h>
+# endif
+# define INVALID_SOCKET -1
+# define SOCKET_ERROR -1
+# define closesocket(a) close(a)
+# define get_socket_errno() errno
#endif
#include <libtest/test.hpp>
diff --git a/libtest/comparison.cc b/libtest/comparison.cc
index b670326c..c16399db 100644
--- a/libtest/comparison.cc
+++ b/libtest/comparison.cc
@@ -34,11 +34,21 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/common.h>
namespace libtest {
+bool jenkins_is_caller(void)
+{
+ if (bool(getenv("JENKINS_HOME")))
+ {
+ return true;
+ }
+
+ return false;
+}
+
bool valgrind_is_caller(void)
{
if (bool(getenv("TESTS_ENVIRONMENT")) and strstr(getenv("TESTS_ENVIRONMENT"), "valgrind"))
diff --git a/libtest/comparison.hpp b/libtest/comparison.hpp
index db9cc8a7..b9cef07e 100644
--- a/libtest/comparison.hpp
+++ b/libtest/comparison.hpp
@@ -51,6 +51,9 @@
namespace libtest {
LIBTEST_API
+bool jenkins_is_caller(void);
+
+LIBTEST_API
bool gdb_is_caller(void);
LIBTEST_API
@@ -59,6 +62,9 @@ bool valgrind_is_caller(void);
LIBTEST_API
bool _in_valgrind(const char *file, int line, const char *func);
+LIBTEST_API
+bool helgrind_is_caller(void);
+
template <class T_comparable>
bool _compare_truth(const char *file, int line, const char *func, T_comparable __expected, const char *assertation_label)
{
diff --git a/libtest/core.cc b/libtest/core.cc
index 0ebe3efd..eb2ac3a1 100644
--- a/libtest/core.cc
+++ b/libtest/core.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/common.h>
diff --git a/libtest/core_count.cc b/libtest/core_count.cc
new file mode 100644
index 00000000..3cab0b4f
--- /dev/null
+++ b/libtest/core_count.cc
@@ -0,0 +1,135 @@
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * Data Differential YATL (i.e. libtest) library
+ *
+ * Copyright (C) 2012 Data Differential, http://datadifferential.com/
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include "mem_config.h"
+
+#include <cstdlib>
+#include <fcntl.h>
+#include <getopt.h>
+#include <iostream>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <libtest/cpu.hpp>
+
+static void version_command(const char *command_name, int major_version, int minor_version)
+{
+ std::cout << command_name << " " << major_version << "." << minor_version << std::endl;
+}
+
+static void help_command(const char *command_name,
+ int major_version, int minor_version,
+ const struct option *long_options)
+{
+ std::cout << command_name << " " << major_version << "." << minor_version << std::endl;
+ std::cout << "Prints the number of cores found on the local host." << std::endl << std::endl;
+
+ for (uint32_t x= 0; long_options[x].name; x++)
+ {
+ std::cout << "\t --" << long_options[x].name << char(long_options[x].has_arg ? '=' : ' ') << std::endl;
+ }
+
+ std::cout << std::endl;
+}
+
+enum {
+ OPT_HELP,
+ OPT_VERSION
+};
+
+static void options_parse(int argc, char *argv[])
+{
+ static struct option long_options[]=
+ {
+ { "version", no_argument, NULL, OPT_VERSION},
+ { "help", no_argument, NULL, OPT_HELP},
+ {0, 0, 0, 0},
+ };
+
+ bool opt_version= false;
+ bool opt_help= false;
+ int option_index= 0;
+
+ while (1)
+ {
+ int option_rv= getopt_long(argc, argv, "", long_options, &option_index);
+ if (option_rv == -1)
+ {
+ break;
+ }
+
+ switch (option_rv)
+ {
+ case OPT_HELP: /* --help or -h */
+ opt_help= true;
+ break;
+
+ case OPT_VERSION: /* --version or -v */
+ opt_version= true;
+ break;
+
+ case '?':
+ /* getopt_long already printed an error message. */
+ exit(EXIT_FAILURE);
+
+ default:
+ help_command(argv[0], 1, 0, long_options);
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (opt_version)
+ {
+ version_command(argv[0], 1, 0);
+ exit(EXIT_SUCCESS);
+ }
+
+ if (opt_help)
+ {
+ help_command(argv[0], 1, 0, long_options);
+ exit(EXIT_SUCCESS);
+ }
+}
+
+int main(int argc, char *argv[])
+{
+ options_parse(argc, argv);
+
+ std::cout << libtest::number_of_cpus() << std::endl;
+
+ return EXIT_SUCCESS;
+}
diff --git a/libtest/cpu.cc b/libtest/cpu.cc
index abf2b2ed..a1844c5b 100644
--- a/libtest/cpu.cc
+++ b/libtest/cpu.cc
@@ -34,11 +34,13 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/common.h>
#include <unistd.h>
+#pragma GCC diagnostic ignored "-Wundef"
+
#if defined(HAVE_SYS_SYSCTL_H) && HAVE_SYS_SYSCTL_H
#include <sys/sysctl.h>
#endif
diff --git a/libtest/dns.cc b/libtest/dns.cc
index 2bf094cb..a293caa3 100644
--- a/libtest/dns.cc
+++ b/libtest/dns.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/common.h>
#include <sys/types.h>
diff --git a/libtest/dream.cc b/libtest/dream.cc
index 7b93513e..ebd8291a 100644
--- a/libtest/dream.cc
+++ b/libtest/dream.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/common.h>
namespace libtest {
diff --git a/libtest/drizzled.cc b/libtest/drizzled.cc
index 49fe2969..3653eea2 100644
--- a/libtest/drizzled.cc
+++ b/libtest/drizzled.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/common.h>
#include <libtest/drizzled.h>
diff --git a/libtest/failed.cc b/libtest/failed.cc
index ae79e307..731d4998 100644
--- a/libtest/failed.cc
+++ b/libtest/failed.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/common.h>
#include <libtest/failed.h>
diff --git a/libtest/fatal.cc b/libtest/fatal.cc
index cdccff82..7178d7f9 100644
--- a/libtest/fatal.cc
+++ b/libtest/fatal.cc
@@ -34,26 +34,18 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/common.h>
#include <cstdarg>
namespace libtest {
-exception::exception(const char *file_, int line_, const char *func_) :
- std::runtime_error(func_),
- _file(file_),
- _line(line_),
- _func(func_)
- {
- }
-
-#ifndef __INTEL_COMPILER
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
-#endif
-
-fatal::fatal(const char *file_, int line_, const char *func_, const char *format, ...) :
- exception(file_, line_, func_)
+fatal::fatal(const char *file_arg, int line_arg, const char *func_arg, const char *format, ...) :
+ std::runtime_error(func_arg),
+ _line(line_arg),
+ _file(file_arg),
+ _func(func_arg)
{
va_list args;
va_start(args, format);
@@ -61,6 +53,8 @@ fatal::fatal(const char *file_, int line_, const char *func_, const char *format
int last_error_length= vsnprintf(last_error, sizeof(last_error), format, args);
va_end(args);
+ strncpy(_mesg, last_error, sizeof(_mesg));
+
snprintf(_error_message, sizeof(_error_message), "%.*s", last_error_length, last_error);
}
@@ -74,11 +68,13 @@ bool fatal::is_disabled()
void fatal::disable()
{
+ _counter= 0;
_disabled= true;
}
void fatal::enable()
{
+ _counter= 0;
_disabled= false;
}
@@ -92,26 +88,15 @@ void fatal::increment_disabled_counter()
_counter++;
}
-disconnected::disconnected(const char *file_, int line_, const char *func_,
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+disconnected::disconnected(const char *file_arg, int line_arg, const char *func_arg,
const std::string& instance, const in_port_t port,
const char *format, ...) :
- exception(file_, line_, func_),
- _port(port)
-{
- va_list args;
- va_start(args, format);
- char last_error[BUFSIZ];
- (void)vsnprintf(last_error, sizeof(last_error), format, args);
- va_end(args);
-
- snprintf(_error_message, sizeof(_error_message), "%s:%u %s", instance.c_str(), uint32_t(port), last_error);
-}
-
-start::start(const char *file_, int line_, const char *func_,
- const std::string& instance, const in_port_t port,
- const char *format, ...) :
- exception(file_, line_, func_),
- _port(port)
+ std::runtime_error(func_arg),
+ _port(port),
+ _line(line_arg),
+ _file(file_arg),
+ _func(func_arg)
{
va_list args;
va_start(args, format);
diff --git a/libtest/fatal.hpp b/libtest/fatal.hpp
index 6ac62b77..bb8cc938 100644
--- a/libtest/fatal.hpp
+++ b/libtest/fatal.hpp
@@ -53,45 +53,55 @@
namespace libtest {
-class exception : public std::runtime_error
+class fatal : std::runtime_error
{
public:
- exception(const char *, int, const char *);
+ fatal(const char *file, int line, const char *func, const char *format, ...);
- int line() const
+ const char* what() const throw()
{
- return _line;
+ return _error_message;
}
- const char* file() const
+ const char* mesg() const throw()
{
- return _file;
+ return _error_message;
}
- const char* func() const
+ // The following are just for unittesting the exception class
+ static bool is_disabled();
+ static void disable();
+ static void enable();
+ static uint32_t disabled_counter();
+ static void increment_disabled_counter();
+
+ int line()
{
- return _func;
+ return _line;
}
- const char* mesg() const throw()
+ const char* file()
{
- return _error_message;
+ return _file;
}
-
-protected:
- char _error_message[BUFSIZ];
+ const char* func()
+ {
+ return _func;
+ }
private:
- const char* _file;
+ char _error_message[BUFSIZ];
+ char _mesg[BUFSIZ];
int _line;
+ const char* _file;
const char* _func;
};
-class fatal : public exception
+class disconnected : std::runtime_error
{
public:
- fatal(const char *file, int line, const char *func, const char *format, ...);
+ disconnected(const char *file, int line, const char *func, const std::string&, const in_port_t port, const char *format, ...);
const char* what() const throw()
{
@@ -105,51 +115,28 @@ public:
static uint32_t disabled_counter();
static void increment_disabled_counter();
-private:
-};
-
-class disconnected : public exception
-{
-public:
- disconnected(const char *file, int line, const char *func, const std::string&, const in_port_t port, const char *format, ...);
-
- const char* what() const throw()
+ int line()
{
- return _error_message;
+ return _line;
}
- // The following are just for unittesting the exception class
- static bool is_disabled();
- static void disable();
- static void enable();
- static uint32_t disabled_counter();
- static void increment_disabled_counter();
-
-private:
- in_port_t _port;
- char _instance[1024];
-};
-
-class start : public exception
-{
-public:
- start(const char *file, int line, const char *func, const std::string&, const in_port_t port, const char *format, ...);
-
- const char* what() const throw()
+ const char* file()
{
- return _error_message;
+ return _file;
}
- // The following are just for unittesting the exception class
- static bool is_disabled();
- static void disable();
- static void enable();
- static uint32_t disabled_counter();
- static void increment_disabled_counter();
+ const char* func()
+ {
+ return _func;
+ }
private:
+ char _error_message[BUFSIZ];
in_port_t _port;
char _instance[1024];
+ int _line;
+ const char* _file;
+ const char* _func;
};
diff --git a/libtest/formatter.cc b/libtest/formatter.cc
index f19404d4..8e6b3ffb 100644
--- a/libtest/formatter.cc
+++ b/libtest/formatter.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/common.h>
diff --git a/libtest/framework.cc b/libtest/framework.cc
index 6cca8450..9b351048 100644
--- a/libtest/framework.cc
+++ b/libtest/framework.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/common.h>
#include <libtest/collection.h>
@@ -118,8 +118,7 @@ void Framework::exec()
_total++;
- try
- {
+ try {
switch ((*iter)->exec())
{
case TEST_FAILURE:
@@ -145,7 +144,7 @@ void Framework::exec()
catch (libtest::disconnected& e)
{
_failed++;
- stream::cerr(e.file(), e.line(), e.func()) << "Unhandled disconnection occurred: " << e.mesg();
+ Error << "Unhandled disconnection occurred:" << e.what();
throw;
}
catch (...)
diff --git a/libtest/gearmand.cc b/libtest/gearmand.cc
index f6dbdfce..41a73d3c 100644
--- a/libtest/gearmand.cc
+++ b/libtest/gearmand.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/common.h>
#include <libtest/gearmand.h>
@@ -57,8 +57,6 @@ using namespace libtest;
#include <sys/wait.h>
#include <unistd.h>
-#include <libgearman/gearman.h>
-
#ifndef __INTEL_COMPILER
#pragma GCC diagnostic ignored "-Wold-style-cast"
#endif
@@ -73,37 +71,15 @@ public:
bool ping()
{
- gearman_client_st *client= gearman_client_create(NULL);
- if (client == NULL)
+ if (out_of_ban_killed())
{
- Error << "Could not allocate memory for gearman_client_create()";
return false;
}
- gearman_client_set_timeout(client, 3000);
-
- if (gearman_success(gearman_client_add_server(client, hostname().c_str(), port())))
- {
- gearman_return_t rc= gearman_client_echo(client, test_literal_param("This is my echo test"));
-
- if (gearman_success(rc))
- {
- gearman_client_free(client);
- return true;
- }
-
- if (out_of_ban_killed() == false)
- {
- Error << hostname().c_str() << ":" << port() << " " << gearman_client_error(client);
- }
- }
- else
- {
- Error << "gearman_client_add_server() " << gearman_client_error(client);
- }
- gearman_client_free(client);
+ SimpleClient client(_hostname, _port);
- return false;;
+ std::string response;
+ return client.send_message("version", response);
}
const char *name()
diff --git a/libtest/gearmand.h b/libtest/gearmand.h
index 49c08c9f..ef14ce63 100644
--- a/libtest/gearmand.h
+++ b/libtest/gearmand.h
@@ -36,8 +36,6 @@
#pragma once
-#include <arpa/inet.h>
-
namespace libtest { struct Server; }
namespace libtest {
diff --git a/libtest/has.cc b/libtest/has.cc
index accadf98..1e020a20 100644
--- a/libtest/has.cc
+++ b/libtest/has.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/common.h>
#include <cstdlib>
@@ -44,20 +44,24 @@ namespace libtest {
bool has_libmemcached(void)
{
+#if defined(HAVE_LIBMEMCACHED) && HAVE_LIBMEMCACHED
if (HAVE_LIBMEMCACHED)
{
return true;
}
+#endif
return false;
}
bool has_libdrizzle(void)
{
+#if defined(HAVE_LIBDRIZZLE) && HAVE_LIBDRIZZLE
if (HAVE_LIBDRIZZLE)
{
return true;
}
+#endif
return false;
}
@@ -80,9 +84,9 @@ bool has_postgres_support(void)
bool has_gearmand()
{
+#if defined(HAVE_GEARMAND_BINARY) && HAVE_GEARMAND_BINARY
if (HAVE_GEARMAND_BINARY)
{
-#if defined(HAVE_GEARMAND_BINARY) && HAVE_GEARMAND_BINARY
std::stringstream arg_buffer;
char *getenv_ptr;
@@ -98,8 +102,8 @@ bool has_gearmand()
{
return true;
}
-#endif
}
+#endif
return false;
}
@@ -136,6 +140,7 @@ bool has_mysqld()
bool has_memcached()
{
+#if defined(HAVE_MEMCACHED_BINARY) && HAVE_MEMCACHED_BINARY
if (HAVE_MEMCACHED_BINARY)
{
std::stringstream arg_buffer;
@@ -154,6 +159,7 @@ bool has_memcached()
return true;
}
}
+#endif
return false;
}
diff --git a/libtest/http.cc b/libtest/http.cc
index 0af12925..59497d69 100644
--- a/libtest/http.cc
+++ b/libtest/http.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/common.h>
@@ -68,7 +68,7 @@ static void initialize_curl_startup()
}
static pthread_once_t start_key_once= PTHREAD_ONCE_INIT;
-void initialize_curl(void)
+static void initialize_curl(void)
{
int ret;
if ((ret= pthread_once(&start_key_once, initialize_curl_startup)) != 0)
@@ -82,20 +82,19 @@ namespace http {
#define YATL_USERAGENT "YATL/1.0"
-extern "C" size_t
- http_get_result_callback(void *ptr, size_t size, size_t nmemb, void *data)
- {
- vchar_t *_body= (vchar_t*)data;
+static size_t http_get_result_callback(void *ptr, size_t size, size_t nmemb, void *data)
+{
+ vchar_t *_body= (vchar_t*)data;
- _body->resize(size * nmemb);
- memcpy(&_body[0], ptr, _body->size());
-
- return _body->size();
- }
+ _body->resize(size * nmemb);
+ memcpy(&_body[0], ptr, _body->size());
+ return _body->size();
+}
static void init(CURL *curl, const std::string& url)
{
+ (void)http_get_result_callback;
(void)curl;
(void)url;
if (HAVE_LIBCURL)
diff --git a/libtest/include.am b/libtest/include.am
index 14ce1d20..b09fe364 100644
--- a/libtest/include.am
+++ b/libtest/include.am
@@ -5,7 +5,7 @@
#
LIBTOOL_COMMAND= ${abs_top_builddir}/libtool --mode=execute
-VALGRIND_EXEC_COMMAND= $(LIBTOOL_COMMAND) valgrind --error-exitcode=1 --leak-check=yes --show-reachable=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE
+VALGRIND_EXEC_COMMAND= $(LIBTOOL_COMMAND) valgrind --error-exitcode=1 --leak-check=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE
VALGRIND_COMMAND= TESTS_ENVIRONMENT="valgrind" $(VALGRIND_EXEC_COMMAND)
HELGRIND_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=helgrind --read-var-info=yes --error-exitcode=1 --read-var-info=yes
DRD_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=drd
@@ -34,21 +34,18 @@ drd:
EXTRA_DIST+= libtest/run.gdb
EXTRA_DIST+= libtest/version.h
-CLEANFILES+= tmp_chroot/etc/*
-CLEANFILES+= tmp_chroot/var/drizzle/*
-CLEANFILES+= tmp_chroot/var/log/*
-CLEANFILES+= tmp_chroot/var/run/*
-CLEANFILES+= tmp_chroot/var/tmp/*
-CLEANFILES+= tmp_chroot/*.xml
+CLEANFILES+= tmp_chroot
BUILT_SOURCES+= libtest/version.h
-.PHONY: distclean-libtest-check
-distclean-libtest-check:
+.PHONY: clean-libtest-check
+clean-libtest-check:
-rm -rf tmp_chroot
+noinst_HEADERS+= libtest/client.hpp
noinst_HEADERS+= libtest/formatter.hpp
noinst_HEADERS+= libtest/timer.hpp
+noinst_HEADERS+= libtest/alarm.h
noinst_HEADERS+= libtest/binaries.h
noinst_HEADERS+= libtest/cpu.hpp
noinst_HEADERS+= libtest/blobslap_worker.h
@@ -100,19 +97,21 @@ libtest_libtest_la_DEPENDENCIES=
libtest_libtest_la_LIBADD=
libtest_libtest_la_SOURCES=
+libtest_libtest_la_SOURCES+= libtest/alarm.cc
libtest_libtest_la_SOURCES+= libtest/binaries.cc
-libtest_libtest_la_SOURCES+= libtest/dns.cc
libtest_libtest_la_SOURCES+= libtest/cmdline.cc
-libtest_libtest_la_SOURCES+= libtest/comparison.cc
libtest_libtest_la_SOURCES+= libtest/collection.cc
+libtest_libtest_la_SOURCES+= libtest/comparison.cc
libtest_libtest_la_SOURCES+= libtest/core.cc
libtest_libtest_la_SOURCES+= libtest/cpu.cc
+libtest_libtest_la_SOURCES+= libtest/dns.cc
libtest_libtest_la_SOURCES+= libtest/dream.cc
+libtest_libtest_la_SOURCES+= libtest/drizzled.cc
libtest_libtest_la_SOURCES+= libtest/fatal.cc
libtest_libtest_la_SOURCES+= libtest/formatter.cc
+libtest_libtest_la_SOURCES+= libtest/client.cc
libtest_libtest_la_SOURCES+= libtest/framework.cc
libtest_libtest_la_SOURCES+= libtest/has.cc
-libtest_libtest_la_SOURCES+= libtest/drizzled.cc
libtest_libtest_la_SOURCES+= libtest/http.cc
libtest_libtest_la_SOURCES+= libtest/is_local.cc
libtest_libtest_la_SOURCES+= libtest/killpid.cc
@@ -163,7 +162,7 @@ libtest_unittest_DEPENDENCIES+= libmemcached/libmemcached.la
libtest_unittest_DEPENDENCIES+= libmemcached/libmemcachedutil.la
else
if HAVE_LIBMEMCACHED
-libtest_libtest_la_LIBADD+= $(libmemcached_LIBS)
+libtest_libtest_la_LIBADD+= $(LIBMEMCACHED_UTIL_LDFLAGS)
libtest_libtest_la_SOURCES+= libtest/memcached.cc
else
libtest_libtest_la_CXXFLAGS+= -DHAVE_LIBMEMCACHED=0
@@ -254,5 +253,10 @@ libtest_wait_SOURCES+= libtest/wait.cc
libtest_wait_SOURCES+= libtest/dream.cc
noinst_PROGRAMS+= libtest/wait
+libtest_core_count_SOURCES=
+libtest_core_count_SOURCES+= libtest/cpu.cc
+libtest_core_count_SOURCES+= libtest/core_count.cc
+noinst_PROGRAMS+= libtest/core-count
+
libtest_abort_SOURCES= libtest/abort.cc
noinst_PROGRAMS+= libtest/abort
diff --git a/libtest/is_local.cc b/libtest/is_local.cc
index 7ae7b7f4..b223dd99 100644
--- a/libtest/is_local.cc
+++ b/libtest/is_local.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/common.h>
diff --git a/libtest/killpid.cc b/libtest/killpid.cc
index aae43bb3..4f8f3370 100644
--- a/libtest/killpid.cc
+++ b/libtest/killpid.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/common.h>
#include <cstdlib>
@@ -80,21 +80,34 @@ bool kill_pid(pid_t pid_arg)
}
}
- int status= 0;
- if (waitpid(pid_arg, &status, 0) == -1)
{
- switch (errno)
+ uint32_t this_wait= 0;
+ uint32_t timeout= 20; // This number should be high enough for valgrind startup (which is slow)
+ uint32_t waited;
+ uint32_t retry;
+
+ for (waited= 0, retry= 4; ; retry++, waited+= this_wait)
{
- // Just means that the server has already gone away
- case ECHILD:
+ int status= 0;
+ if (waitpid(pid_arg, &status, WNOHANG) == 0)
{
- return true;
+ break;
+ }
+ else if (errno == ECHILD)
+ {
+ // Server has already gone away
+ break;
+ }
+ else if (waited >= timeout)
+ {
+ // Timeout failed
+ kill(pid_arg, SIGKILL);
+ break;
}
- }
-
- Error << "Error occured while waitpid(" << strerror(errno) << ") on pid " << int(pid_arg);
- return false;
+ this_wait= retry * retry / 3 + 1;
+ libtest::dream(this_wait, 0);
+ }
}
return true;
diff --git a/libtest/libtool.cc b/libtest/libtool.cc
index 64371eae..4a7d3cea 100644
--- a/libtest/libtool.cc
+++ b/libtest/libtool.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/common.h>
#include <string>
diff --git a/libtest/main.cc b/libtest/main.cc
index 6bffa84c..967ec71a 100644
--- a/libtest/main.cc
+++ b/libtest/main.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/common.h>
#include <cassert>
@@ -343,11 +343,6 @@ int main(int argc, char *argv[])
std::cerr << "FATAL:" << e.what() << std::endl;
exit_code= EXIT_FAILURE;
}
- catch (libtest::start& e)
- {
- std::cerr << "Failure to start:" << e.what() << std::endl;
- exit_code= EXIT_FAILURE;
- }
catch (libtest::disconnected& e)
{
std::cerr << "Unhandled disconnection occurred:" << e.what() << std::endl;
diff --git a/libtest/memcached.cc b/libtest/memcached.cc
index 63335bd9..795ba038 100644
--- a/libtest/memcached.cc
+++ b/libtest/memcached.cc
@@ -34,14 +34,13 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
+
#include <libtest/common.h>
#include <libmemcached-1.2/memcached.h>
#include <libmemcachedutil-1.2/util.h>
-using namespace libtest;
-
#include <cassert>
#include <cerrno>
#include <cstdio>
@@ -62,19 +61,7 @@ using namespace libtest;
#pragma GCC diagnostic ignored "-Wold-style-cast"
#endif
-using namespace libtest;
-
-namespace {
- bool is_memcached_libtool()
- {
- if (MEMCACHED_BINARY and strcmp(MEMCACHED_BINARY, "memcached/memcached") == 0)
- {
- return true;
- }
-
- return false;
- }
-}
+namespace libtest {
class Memcached : public libtest::Server
{
@@ -88,14 +75,14 @@ public:
const std::string& username_arg,
const std::string& password_arg) :
libtest::Server(host_arg, port_arg,
- MEMCACHED_BINARY, is_memcached_libtool(), is_socket_arg),
+ MEMCACHED_BINARY, false, is_socket_arg),
_username(username_arg),
_password(password_arg)
{ }
Memcached(const std::string& host_arg, const in_port_t port_arg, const bool is_socket_arg) :
libtest::Server(host_arg, port_arg,
- MEMCACHED_BINARY, is_memcached_libtool(), is_socket_arg)
+ MEMCACHED_BINARY, false, is_socket_arg)
{
set_pid_file();
}
@@ -124,36 +111,20 @@ public:
bool ping()
{
-#if 0
- // Memcached is slow to start, so we need to do this
- if (pid_file().empty() == false)
+ if (out_of_ban_killed())
{
- if (wait_for_pidfile() == false)
- {
- Error << "Pidfile was not found:" << pid_file() << " :" << running();
- return -1;
- }
+ return false;
}
-#endif
- memcached_return_t rc;
- bool ret;
-
- if (has_socket())
- {
- ret= libmemcached_util_ping(socket().c_str(), 0, &rc);
- }
- else
+ if (is_socket())
{
- ret= libmemcached_util_ping(hostname().c_str(), port(), &rc);
+ return _app.check();
}
- if (memcached_failed(rc) or ret == false)
- {
- error(memcached_strerror(NULL, rc));
- }
+ SimpleClient client(_hostname, _port);
- return ret;
+ std::string response;
+ return client.send_message("version", response);
}
const char *name()
@@ -168,7 +139,7 @@ public:
bool is_libtool()
{
- return is_memcached_libtool();
+ return false;
}
virtual void pid_file_option(Application& app, const std::string& arg)
@@ -223,137 +194,6 @@ public:
bool build(size_t argc, const char *argv[]);
};
-class MemcachedLight : public libtest::Server
-{
-
-public:
- MemcachedLight(const std::string& host_arg, const in_port_t port_arg) :
- libtest::Server(host_arg, port_arg, MEMCACHED_LIGHT_BINARY, true)
- {
- set_pid_file();
- }
-
- bool ping()
- {
- // Memcached is slow to start, so we need to do this
- if (not pid_file().empty())
- {
- if (not wait_for_pidfile())
- {
- Error << "Pidfile was not found:" << pid_file();
- return false;
- }
- }
-
- std::stringstream error_message;
- pid_t local_pid= get_pid_from_file(pid_file(), error_message);
- if (local_pid > 0)
- {
- if (::kill(local_pid, 0) == 0)
- {
- return true;
- }
- }
-
- return false;
- }
-
- const char *name()
- {
- return "memcached_light";
- };
-
- const char *executable()
- {
- return MEMCACHED_LIGHT_BINARY;
- }
-
- virtual void port_option(Application& app, in_port_t arg)
- {
- char buffer[1024];
- snprintf(buffer, sizeof(buffer), "--port=%d", int(arg));
- app.add_option(buffer);
- }
-
- bool has_port_option() const
- {
- return true;
- }
-
- bool is_libtool()
- {
- return true;
- }
-
- void log_file_option(Application& app, const std::string& arg)
- {
- if (arg.empty() == false)
- {
- std::string buffer("--log-file=");
- buffer+= arg;
- app.add_option("--verbose");
- app.add_option(buffer);
- }
- }
-
- bool has_log_file_option() const
- {
- return true;
- }
-
- bool build(size_t argc, const char *argv[]);
-};
-
-class MemcachedSaSL : public Memcached
-{
-public:
- MemcachedSaSL(const std::string& host_arg,
- const in_port_t port_arg,
- const bool is_socket_arg,
- const std::string& username_arg,
- const std::string &password_arg) :
- Memcached(host_arg, port_arg, is_socket_arg, username_arg, password_arg)
- { }
-
- const char *name()
- {
- return "memcached-sasl";
- };
-
- const char *sasl() const
- {
- return " -S -B binary ";
- }
-
- const char *executable()
- {
- return MEMCACHED_SASL_BINARY;
- }
-
- bool ping()
- {
- memcached_return_t rc;
- bool ret;
-
- if (has_socket())
- {
- ret= libmemcached_util_ping2(socket().c_str(), 0, username().c_str(), password().c_str(), &rc);
- }
- else
- {
- ret= libmemcached_util_ping2(hostname().c_str(), port(), username().c_str(), password().c_str(), &rc);
- }
-
- if (memcached_failed(rc) or ret == false)
- {
- error(memcached_strerror(NULL, rc));
- }
-
- return ret;
- }
-
-};
-
#include <sstream>
@@ -383,18 +223,6 @@ bool Memcached::build(size_t argc, const char *argv[])
return true;
}
-bool MemcachedLight::build(size_t argc, const char *argv[])
-{
- for (size_t x= 0 ; x < argc ; x++)
- {
- add_option(argv[x]);
- }
-
- return true;
-}
-
-namespace libtest {
-
libtest::Server *build_memcached(const std::string& hostname, const in_port_t try_port)
{
return new Memcached(hostname, try_port, false);
@@ -405,31 +233,15 @@ libtest::Server *build_memcached_socket(const std::string& socket_file, const in
return new Memcached(socket_file, try_port, true);
}
-libtest::Server *build_memcached_light(const std::string& hostname, const in_port_t try_port)
-{
- return new MemcachedLight(hostname, try_port);
-}
-
-
libtest::Server *build_memcached_sasl(const std::string& hostname, const in_port_t try_port, const std::string& username, const std::string &password)
{
if (username.empty())
{
- return new MemcachedSaSL(hostname, try_port, false, "memcached", "memcached");
+ return new Memcached(hostname, try_port, false, "memcached", "memcached");
}
- return new MemcachedSaSL(hostname, try_port, false, username, password);
+ return new Memcached(hostname, try_port, false, username, password);
}
-libtest::Server *build_memcached_sasl_socket(const std::string& socket_file, const in_port_t try_port, const std::string& username, const std::string &password)
-{
- if (username.empty())
- {
- return new MemcachedSaSL(socket_file, try_port, true, "memcached", "memcached");
- }
-
- return new MemcachedSaSL(socket_file, try_port, true, username, password);
-}
-
-}
+} // namespace libtest
diff --git a/libtest/memcached.hpp b/libtest/memcached.hpp
index c4953975..e0e14851 100644
--- a/libtest/memcached.hpp
+++ b/libtest/memcached.hpp
@@ -39,7 +39,7 @@
#if defined(HAVE_LIBMEMCACHED) && HAVE_LIBMEMCACHED
inline bool operator== (const memcached_st& memc, const memcached_return_t rc)
{
- if (memcached_last_error(&memc) == rc)
+ if (memcached_last_error(const_cast<memcached_st *>(&memc)) == rc)
{
return true;
}
@@ -49,7 +49,7 @@ inline bool operator== (const memcached_st& memc, const memcached_return_t rc)
inline bool operator!= (const memcached_st& memc, const memcached_return_t rc)
{
- if (memcached_last_error(&memc) != rc)
+ if (memcached_last_error(const_cast<memcached_st *>(&memc)) != rc)
{
return true;
}
@@ -59,7 +59,7 @@ inline bool operator!= (const memcached_st& memc, const memcached_return_t rc)
inline bool operator!= (const memcached_return_t rc, const memcached_st& memc)
{
- if (memcached_last_error(&memc) != rc)
+ if (memcached_last_error(const_cast<memcached_st *>(&memc)) != rc)
{
return true;
}
diff --git a/libtest/port.cc b/libtest/port.cc
index 01e0e88b..3d48a09c 100644
--- a/libtest/port.cc
+++ b/libtest/port.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/common.h>
#include <cassert>
@@ -57,6 +57,18 @@
#include <libtest/signal.h>
+#ifndef SOCK_CLOEXEC
+# define SOCK_CLOEXEC 0
+#endif
+
+#ifndef SOCK_NONBLOCK
+# define SOCK_NONBLOCK 0
+#endif
+
+#ifndef FD_CLOEXEC
+# define FD_CLOEXEC 0
+#endif
+
#ifndef __INTEL_COMPILER
#pragma GCC diagnostic ignored "-Wold-style-cast"
#endif
@@ -66,6 +78,11 @@ using namespace libtest;
struct socket_st {
typedef std::vector< std::pair< int, in_port_t> > socket_port_t;
socket_port_t _pair;
+ in_port_t last_port;
+
+ socket_st():
+ last_port(0)
+ { }
void release(in_port_t _arg)
{
@@ -116,39 +133,69 @@ void release_port(in_port_t arg)
in_port_t get_free_port()
{
- in_port_t ret_port= in_port_t(0);
+ const in_port_t default_port= in_port_t(-1);
int retries= 1024;
+ in_port_t ret_port;
while (--retries)
{
+ ret_port= default_port;
int sd;
if ((sd= socket(AF_INET, SOCK_STREAM, 0)) != -1)
{
int optval= 1;
if (setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)) != -1)
- {
+ {
struct sockaddr_in sin;
sin.sin_port= 0;
sin.sin_addr.s_addr= 0;
sin.sin_addr.s_addr= INADDR_ANY;
sin.sin_family= AF_INET;
- if (bind(sd, (struct sockaddr *)&sin,sizeof(struct sockaddr_in) ) != -1)
+ int bind_ret;
+ do
{
- socklen_t addrlen= sizeof(sin);
+ if ((bind_ret= bind(sd, (struct sockaddr *)&sin, sizeof(struct sockaddr_in) )) != -1)
+ {
+ socklen_t addrlen= sizeof(sin);
- if (getsockname(sd, (struct sockaddr *)&sin, &addrlen) != -1)
+ if (getsockname(sd, (struct sockaddr *)&sin, &addrlen) != -1)
+ {
+ ret_port= sin.sin_port;
+ }
+ }
+ else
{
- ret_port= sin.sin_port;
+ if (errno != EADDRINUSE)
+ {
+ Error << strerror(errno);
+ }
}
- }
- }
- all_socket_fd._pair.push_back(std::make_pair(sd, ret_port));
+ if (errno == EADDRINUSE)
+ {
+ libtest::dream(2, 0);
+ }
+ } while (bind_ret == -1 and errno == EADDRINUSE);
+
+ all_socket_fd._pair.push_back(std::make_pair(sd, ret_port));
+ }
+ else
+ {
+ Error << strerror(errno);
+ }
+ }
+ else
+ {
+ Error << strerror(errno);
}
- if (ret_port > 1024)
+ if (ret_port == default_port)
+ {
+ Error << "no ret_port set:" << strerror(errno);
+ }
+ else if (ret_port > 1024 and ret_port != all_socket_fd.last_port)
{
break;
}
@@ -165,11 +212,19 @@ in_port_t get_free_port()
fatal_message("No port could be found");
}
+ if (ret_port == default_port)
+ {
+ fatal_message("No port could be found");
+ }
+
if (ret_port <= 1024)
{
fatal_message("No port could be found, though some where available below or at 1024");
}
+ all_socket_fd.last_port= ret_port;
+ release_port(ret_port);
+
return ret_port;
}
diff --git a/libtest/runner.cc b/libtest/runner.cc
index 2d783697..5f1acf56 100644
--- a/libtest/runner.cc
+++ b/libtest/runner.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/common.h>
namespace libtest {
diff --git a/libtest/server.cc b/libtest/server.cc
index b128788a..01d15625 100644
--- a/libtest/server.cc
+++ b/libtest/server.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/common.h>
#include <cassert>
@@ -90,6 +90,22 @@ std::ostream& operator<<(std::ostream& output, const Server &arg)
return output; // for multiple << operators
}
+#ifdef __GLIBC__
+namespace {
+
+class Buffer
+{
+public:
+ Buffer(char *b) : b_(b) {}
+ ~Buffer() { free(b_); }
+ char* buf() { return b_; }
+private:
+ char *b_;
+};
+
+}
+#endif // __GLIBC__
+
#define MAGIC_MEMORY 123570
Server::Server(const std::string& host_arg, const in_port_t port_arg,
@@ -106,6 +122,7 @@ Server::Server(const std::string& host_arg, const in_port_t port_arg,
Server::~Server()
{
+ kill();
}
bool Server::check()
@@ -180,8 +197,8 @@ bool Server::start()
if (port() == LIBTEST_FAIL_PORT)
{
- throw libtest::start(LIBYATL_DEFAULT_PARAM,
- hostname(), port(), "Called failure");
+ throw libtest::disconnected(LIBYATL_DEFAULT_PARAM,
+ hostname(), port(), "Called failure");
}
if (getenv("YATL_PTRCHECK_SERVER"))
@@ -193,18 +210,20 @@ bool Server::start()
_app.use_valgrind();
}
+ out_of_ban_killed(false);
if (args(_app) == false)
{
- throw libtest::start(LIBYATL_DEFAULT_PARAM,
- hostname(), port(), "Could not build command()");
+ throw libtest::disconnected(LIBYATL_DEFAULT_PARAM,
+ hostname(), port(), "Could not build command()");
}
libtest::release_port(_port);
+
Application::error_t ret;
if (Application::SUCCESS != (ret= _app.run()))
{
- throw libtest::start(LIBYATL_DEFAULT_PARAM,
- hostname(), port(), "Application::run() %s", libtest::Application::toString(ret));
+ throw libtest::disconnected(LIBYATL_DEFAULT_PARAM,
+ hostname(), port(), "Application::run() %s", libtest::Application::toString(ret));
return false;
}
_running= _app.print();
@@ -230,9 +249,14 @@ bool Server::start()
continue;
}
+#ifdef __GLIBC__
+ Buffer buf( get_current_dir_name());
+ char *getcwd_buf= buf.buf();
+#else
char buf[PATH_MAX];
char *getcwd_buf= getcwd(buf, sizeof(buf));
- throw libtest::start(LIBYATL_DEFAULT_PARAM,
+#endif // __GLIBC__
+ throw libtest::disconnected(LIBYATL_DEFAULT_PARAM,
hostname(), port(),
"Unable to open pidfile in %s for: %s stderr:%s",
getcwd_buf ? getcwd_buf : "",
@@ -242,15 +266,20 @@ bool Server::start()
}
}
- uint32_t this_wait= 0;
bool pinged= false;
+ uint32_t this_wait= 0;
{
- uint32_t timeout= 20; // This number should be high enough for valgrind startup (which is slow)
+ uint32_t timeout= 40; // This number should be high enough for valgrind startup (which is slow)
uint32_t waited;
uint32_t retry;
- for (waited= 0, retry= 4; ; retry++, waited+= this_wait)
+ for (waited= 0, retry= 7; ; retry++, waited+= this_wait)
{
+ if (_app.check() == false)
+ {
+ break;
+ }
+
if ((pinged= ping()) == true)
{
break;
@@ -260,6 +289,8 @@ bool Server::start()
break;
}
+ Error << "ping(" << _app.pid() << ") wait: " << this_wait << " " << hostname() << ":" << port() << " " << error();
+
this_wait= retry * retry / 3 + 1;
libtest::dream(this_wait, 0);
}
@@ -273,35 +304,35 @@ bool Server::start()
_app.slurp();
if (kill_file(pid_file()) == false)
{
- throw libtest::start(LIBYATL_DEFAULT_PARAM,
- hostname(), port(),
- "Failed to kill off server, waited: %u after startup occurred, when pinging failed: %.*s stderr:%.*s",
- this_wait,
- int(_running.size()), _running.c_str(),
- int(_app.stderr_result_length()), _app.stderr_c_str());
+ throw libtest::disconnected(LIBYATL_DEFAULT_PARAM,
+ hostname(), port(),
+ "Failed to kill off server, waited: %u after startup occurred, when pinging failed: %.*s stderr:%.*s",
+ this_wait,
+ int(_running.size()), _running.c_str(),
+ int(_app.stderr_result_length()), _app.stderr_c_str());
}
else
{
- throw libtest::start(LIBYATL_DEFAULT_PARAM,
- hostname(), port(),
- "Failed native ping(), pid: %d was alive: %s waited: %u server started, having pid_file. exec: %.*s stderr:%.*s",
- int(_app.pid()),
- _app.check() ? "true" : "false",
- this_wait,
- int(_running.size()), _running.c_str(),
- int(_app.stderr_result_length()), _app.stderr_c_str());
+ throw libtest::disconnected(LIBYATL_DEFAULT_PARAM,
+ hostname(), port(),
+ "Failed native ping(), pid: %d was alive: %s waited: %u server started, having pid_file. exec: %.*s stderr:%.*s",
+ int(_app.pid()),
+ _app.check() ? "true" : "false",
+ this_wait,
+ int(_running.size()), _running.c_str(),
+ int(_app.stderr_result_length()), _app.stderr_c_str());
}
}
else
{
- throw libtest::start(LIBYATL_DEFAULT_PARAM,
- hostname(), port(),
- "Failed native ping(), pid: %d is alive: %s waited: %u server started. exec: %.*s stderr:%.*s",
- int(_app.pid()),
- _app.check() ? "true" : "false",
- this_wait,
- int(_running.size()), _running.c_str(),
- int(_app.stderr_result_length()), _app.stderr_c_str());
+ throw libtest::disconnected(LIBYATL_DEFAULT_PARAM,
+ hostname(), port(),
+ "Failed native ping(), pid: %d is alive: %s waited: %u server started. exec: %.*s stderr:%.*s",
+ int(_app.pid()),
+ _app.check() ? "true" : "false",
+ this_wait,
+ int(_running.size()), _running.c_str(),
+ int(_app.stderr_result_length()), _app.stderr_c_str());
}
_running.clear();
@@ -327,9 +358,9 @@ void Server::add_option(const std::string& arg)
_options.push_back(std::make_pair(arg, std::string()));
}
-void Server::add_option(const std::string& name_, const std::string& value)
+void Server::add_option(const std::string& name_, const std::string& value_)
{
- _options.push_back(std::make_pair(name_, value));
+ _options.push_back(std::make_pair(name_, value_));
}
bool Server::set_socket_file()
diff --git a/libtest/server.h b/libtest/server.h
index f27ce08f..7ec3096c 100644
--- a/libtest/server.h
+++ b/libtest/server.h
@@ -232,7 +232,7 @@ public:
bool is_socket() const
{
- return _hostname[0] == '/';
+ return _is_socket;
}
const std::string running() const
diff --git a/libtest/server_container.cc b/libtest/server_container.cc
index 2d7655bc..113f085c 100644
--- a/libtest/server_container.cc
+++ b/libtest/server_container.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/common.h>
#include <cassert>
@@ -259,22 +259,18 @@ bool server_startup_st::start_server(const std::string& server_type, in_port_t t
}
}
}
- else if (server_type.compare("memcached-light") == 0)
- {
- if (MEMCACHED_LIGHT_BINARY)
- {
- if (HAVE_LIBMEMCACHED)
- {
- server= build_memcached_light("localhost", try_port);
- }
- }
- }
if (server == NULL)
{
throw libtest::fatal(LIBYATL_DEFAULT_PARAM, "Launching of an unknown server was attempted: %s", server_type.c_str());
}
+ }
+ catch (...)
+ {
+ throw;
+ }
+ try {
/*
We will now cycle the server we have created.
*/
@@ -296,32 +292,30 @@ bool server_startup_st::start_server(const std::string& server_type, in_port_t t
}
else
#endif
+
if (server->start() == false)
- {
- delete server;
- return false;
- }
- else
- {
- if (opt_startup_message)
{
- Outn();
- Out << "STARTING SERVER(pid:" << server->pid() << "): " << server->running();
- Outn();
+ delete server;
+ return false;
+ }
+ else
+ {
+ if (opt_startup_message)
+ {
+ Outn();
+ Out << "STARTING SERVER(pid:" << server->pid() << "): " << server->running();
+ Outn();
+ }
}
- }
- }
- catch (libtest::start err)
- {
- stream::cerr(err.file(), err.line(), err.func()) << err.what();
- delete server;
- return false;
}
- catch (libtest::disconnected err)
+ catch (libtest::disconnected& err)
{
- stream::cerr(err.file(), err.line(), err.func()) << err.what();
- delete server;
- return false;
+ if (fatal::is_disabled() == false and try_port != LIBTEST_FAIL_PORT)
+ {
+ stream::cerr(err.file(), err.line(), err.func()) << err.what();
+ delete server;
+ return false;
+ }
}
catch (...)
{
@@ -349,24 +343,6 @@ bool server_startup_st::start_socket_server(const std::string& server_type, cons
{
Error << "Socket files are not supported for gearmand yet";
}
- else if (server_type.compare("memcached-sasl") == 0)
- {
- if (MEMCACHED_SASL_BINARY)
- {
- if (HAVE_LIBMEMCACHED)
- {
- server= build_memcached_sasl_socket("localhost", try_port, username(), password());
- }
- else
- {
- Error << "Libmemcached was not found";
- }
- }
- else
- {
- Error << "No memcached binary is available";
- }
- }
else if (server_type.compare("memcached") == 0)
{
if (MEMCACHED_BINARY)
diff --git a/libtest/signal.cc b/libtest/signal.cc
index 86c4a431..e680ccbc 100644
--- a/libtest/signal.cc
+++ b/libtest/signal.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/common.h>
#include <csignal>
@@ -94,10 +94,23 @@ void SignalThread::test()
assert(sigismember(&set, SIGABRT));
assert(sigismember(&set, SIGQUIT));
assert(sigismember(&set, SIGINT));
+ assert(sigismember(&set, SIGVTALRM));
}
assert(sigismember(&set, SIGUSR2));
}
+bool SignalThread::unblock()
+{
+ int error;
+ if ((error= pthread_sigmask(SIG_UNBLOCK, &set, NULL)) != 0)
+ {
+ Error << "While trying to reset signal mask to original set, pthread_sigmask() died during pthread_sigmask(" << strerror(error) << ")";
+ return false;
+ }
+
+ return true;
+}
+
SignalThread::~SignalThread()
{
if (is_shutdown() == false)
@@ -114,11 +127,7 @@ SignalThread::~SignalThread()
#endif
sem_destroy(&lock);
- int error;
- if ((error= pthread_sigmask(SIG_UNBLOCK, &set, NULL)) != 0)
- {
- Error << "While trying to reset signal mask to original set, pthread_sigmask() died during pthread_sigmask(" << strerror(error) << ")";
- }
+ unblock();
}
extern "C" {
@@ -142,6 +151,11 @@ static void *sig_thread(void *arg)
switch (sig)
{
+ case SIGVTALRM:
+ Error << "SIGVTALRM was called";
+ context->unblock();
+ raise(SIGVTALRM);
+
case SIGABRT:
case SIGUSR2:
case SIGINT:
@@ -183,6 +197,7 @@ SignalThread::SignalThread() :
sigaddset(&set, SIGABRT);
sigaddset(&set, SIGQUIT);
sigaddset(&set, SIGINT);
+ sigaddset(&set, SIGVTALRM);
}
sigaddset(&set, SIGPIPE);
@@ -203,10 +218,17 @@ bool SignalThread::setup()
{
Error << strsignal(SIGQUIT) << " has been previously set.";
}
+
if (sigismember(&original_set, SIGINT))
{
Error << strsignal(SIGINT) << " has been previously set.";
}
+
+ if (sigismember(&original_set, SIGVTALRM))
+ {
+ Error << strsignal(SIGVTALRM) << " has been previously set.";
+ }
+
if (sigismember(&original_set, SIGUSR2))
{
Error << strsignal(SIGUSR2) << " has been previously set.";
diff --git a/libtest/signal.h b/libtest/signal.h
index fd7e4a6d..6e68bb38 100644
--- a/libtest/signal.h
+++ b/libtest/signal.h
@@ -65,6 +65,7 @@ public:
void test();
void post();
bool setup();
+ bool unblock();
int wait(int& sig)
{
diff --git a/libtest/skiptest.cc b/libtest/skiptest.cc
index dae33326..2a2ff222 100644
--- a/libtest/skiptest.cc
+++ b/libtest/skiptest.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/test.hpp>
diff --git a/libtest/socket.cc b/libtest/socket.cc
index 7f7037f9..667a0219 100644
--- a/libtest/socket.cc
+++ b/libtest/socket.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/common.h>
static char global_socket[1024]= { 0 };
diff --git a/libtest/strerror.cc b/libtest/strerror.cc
index 27d10365..39108d3c 100644
--- a/libtest/strerror.cc
+++ b/libtest/strerror.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/common.h>
namespace libtest {
diff --git a/libtest/test.hpp b/libtest/test.hpp
index 76760487..7da55bd5 100644
--- a/libtest/test.hpp
+++ b/libtest/test.hpp
@@ -42,17 +42,6 @@
#include <cstdlib>
#include <arpa/inet.h>
-#ifdef TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <ctime>
-#else
-# ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-# else
-# include <ctime>
-# endif
-#endif
-
#include <libtest/visibility.h>
#include <libtest/version.h>
@@ -63,6 +52,7 @@
#include <libtest/error.h>
#include <libtest/strerror.h>
#include <libtest/timer.hpp>
+#include <libtest/alarm.h>
#include <libtest/stream.h>
#include <libtest/comparison.hpp>
#include <libtest/server.h>
@@ -85,3 +75,4 @@
#include <libtest/http.hpp>
#include <libtest/cpu.hpp>
#include <libtest/tmpfile.hpp>
+#include <libtest/client.hpp>
diff --git a/libtest/timer.cc b/libtest/timer.cc
index ffa8a4b6..b34cb4f9 100644
--- a/libtest/timer.cc
+++ b/libtest/timer.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/timer.hpp>
diff --git a/libtest/timer.hpp b/libtest/timer.hpp
index eac51940..28ec4741 100644
--- a/libtest/timer.hpp
+++ b/libtest/timer.hpp
@@ -44,7 +44,6 @@
# include <mach/clock.h>
# include <mach/mach.h>
#else
-# include <time.h>
# include <sys/time.h>
#endif
@@ -123,24 +122,8 @@ private:
mach_port_deallocate(mach_task_self(), _clock_serv);
ts.tv_sec= _mach_timespec.tv_sec;
ts.tv_nsec= _mach_timespec.tv_nsec;
-#elif defined(HAVE_CLOCK_GETTIME) && HAVE_CLOCK_GETTIME
- int ret;
- do
- {
- ret= clock_gettime(CLOCK_REALTIME, &ts);
- } while (ret == -1);
-#elif defined(HAVE_GETTIMEOFDAY) && HAVE_GETTIMEOFDAY
- struct timeval tv;
- int ret;
- do
- {
- ret= gettimeofday(&tv, NULL)
- } while (ret == -1);
- /* Convert from timeval to timespec */
- ts.tv_sec= tv.tv_sec;
- ts.tv_nsec= tv.tv_usec * 1000;
#else
- memset(&ts, 0, sizeof(struct timespec));
+ clock_gettime(CLOCK_REALTIME, &ts);
#endif
}
diff --git a/libtest/unittest.cc b/libtest/unittest.cc
index 6b3efe95..f8432476 100644
--- a/libtest/unittest.cc
+++ b/libtest/unittest.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/test.hpp>
@@ -53,6 +53,9 @@ using namespace libtest;
static std::string testing_service;
+// Used to track setups where we see if failure is happening
+static uint32_t fatal_calls= 0;
+
static test_return_t LIBTOOL_COMMAND_test(void *)
{
test_true(getenv("LIBTOOL_COMMAND"));
@@ -270,7 +273,7 @@ static test_return_t drizzled_cycle_test(void *object)
test_skip(true, has_drizzled());
- test_skip(true, server_startup(*servers, "drizzled", get_free_port(), 0, NULL));
+ test_skip(true, server_startup(*servers, "drizzled", get_free_port(), 0, NULL, false));
return TEST_SUCCESS;
}
@@ -280,30 +283,12 @@ static test_return_t gearmand_cycle_test(void *object)
server_startup_st *servers= (server_startup_st*)object;
test_true(servers and servers->validate());
-#if defined(HAVE_GEARMAND_BINARY) && HAVE_GEARMAND_BINARY
- test_true(has_gearmand());
-#endif
-
test_skip(true, has_gearmand());
-
- test_skip(true, server_startup(*servers, "gearmand", get_free_port(), 0, NULL));
-
- return TEST_SUCCESS;
-}
-
-#if 0
-static test_return_t memcached_light_cycle_TEST(void *object)
-{
- server_startup_st *servers= (server_startup_st*)object;
- test_true(servers);
-
- test_skip(true, bool(HAVE_MEMCACHED_LIGHT_BINARY));
-
- test_true(server_startup(*servers, "memcached-light", get_free_port(), 0, NULL));
+ test_skip(true, server_startup(*servers, "gearmand", get_free_port(), 0, NULL, false));
+ servers->clear();
return TEST_SUCCESS;
}
-#endif
static test_return_t skip_shim(bool a, bool b)
{
@@ -333,7 +318,9 @@ static test_return_t server_startup_fail_TEST(void *object)
server_startup_st *servers= (server_startup_st*)object;
test_true(servers);
- test_compare(servers->start_server(testing_service, LIBTEST_FAIL_PORT, 0, NULL, true), false);
+ fatal::disable();
+ test_compare(servers->start_server(testing_service, LIBTEST_FAIL_PORT, 0, NULL, false), true);
+ fatal::enable();
return TEST_SUCCESS;
}
@@ -343,7 +330,7 @@ static test_return_t server_startup_TEST(void *object)
server_startup_st *servers= (server_startup_st*)object;
test_true(servers);
- test_true(servers->start_server(testing_service, get_free_port(), 0, NULL, true));
+ test_compare(servers->start_server(testing_service, get_free_port(), 0, NULL, false), true);
test_true(servers->last());
pid_t last_pid= servers->last()->pid();
@@ -366,7 +353,7 @@ static test_return_t socket_server_startup_TEST(void *object)
server_startup_st *servers= (server_startup_st*)object;
test_true(servers);
- test_true(servers->start_socket_server(testing_service, get_free_port(), 0, NULL, true));
+ test_true(servers->start_socket_server(testing_service, get_free_port(), 0, NULL, false));
return TEST_SUCCESS;
}
@@ -384,7 +371,7 @@ static test_return_t memcached_sasl_test(void *object)
if (HAVE_LIBMEMCACHED)
{
test_true(has_memcached_sasl());
- test_true(server_startup(*servers, "memcached-sasl", get_free_port(), 0, NULL));
+ test_true(server_startup(*servers, "memcached-sasl", get_free_port(), 0, NULL, false));
return TEST_SUCCESS;
}
@@ -396,10 +383,11 @@ static test_return_t memcached_sasl_test(void *object)
static test_return_t application_true_BINARY(void *)
{
- Application true_app("true");
+ test_skip(0, access("/usr/bin/true", X_OK ));
+ Application true_app("/usr/bin/true");
test_compare(Application::SUCCESS, true_app.run());
- test_compare(Application::SUCCESS, true_app.wait());
+ test_compare(Application::SUCCESS, true_app.join());
return TEST_SUCCESS;
}
@@ -407,11 +395,11 @@ static test_return_t application_true_BINARY(void *)
static test_return_t application_gdb_true_BINARY2(void *)
{
test_skip(0, access("/usr/bin/gdb", X_OK ));
- Application true_app("true");
+ Application true_app("/usr/bin/true");
true_app.use_gdb();
test_compare(Application::SUCCESS, true_app.run());
- test_compare(Application::SUCCESS, true_app.wait());
+ test_compare(Application::SUCCESS, true_app.join());
return TEST_SUCCESS;
}
@@ -419,23 +407,24 @@ static test_return_t application_gdb_true_BINARY2(void *)
static test_return_t application_gdb_true_BINARY(void *)
{
test_skip(0, access("/usr/bin/gdb", X_OK ));
- Application true_app("true");
+ Application true_app("/usr/bin/true");
true_app.use_gdb();
const char *args[]= { "--fubar", 0 };
test_compare(Application::SUCCESS, true_app.run(args));
- test_compare(Application::SUCCESS, true_app.wait());
+ test_compare(Application::SUCCESS, true_app.join());
return TEST_SUCCESS;
}
static test_return_t application_true_fubar_BINARY(void *)
{
- Application true_app("true");
+ test_skip(0, access("/usr/bin/true", X_OK ));
+ Application true_app("/usr/bin/true");
const char *args[]= { "--fubar", 0 };
test_compare(Application::SUCCESS, true_app.run(args));
- test_compare(Application::SUCCESS, true_app.wait());
+ test_compare(Application::SUCCESS, true_app.join());
test_zero(true_app.stdout_result().size());
return TEST_SUCCESS;
@@ -450,10 +439,10 @@ static test_return_t application_doesnotexist_BINARY(void *)
const char *args[]= { "--fubar", 0 };
#if defined(TARGET_OS_OSX) && TARGET_OS_OSX
- test_compare(Application::INVALID, true_app.run(args));
+ test_compare(Application::INVALID_POSIX_SPAWN, true_app.run(args));
#else
test_compare(Application::SUCCESS, true_app.run(args));
- test_compare(Application::INVALID, true_app.wait(false));
+ test_compare(Application::INVALID_POSIX_SPAWN, true_app.join());
#endif
test_zero(true_app.stdout_result().size());
@@ -461,32 +450,6 @@ static test_return_t application_doesnotexist_BINARY(void *)
return TEST_SUCCESS;
}
-static test_return_t application_true_fubar_eq_doh_BINARY(void *)
-{
- Application true_app("true");
-
- const char *args[]= { "--fubar=doh", 0 };
- test_compare(Application::SUCCESS, true_app.run(args));
- test_compare(Application::SUCCESS, true_app.wait());
- test_zero(true_app.stdout_result().size());
-
- return TEST_SUCCESS;
-}
-
-static test_return_t application_true_fubar_eq_doh_option_BINARY(void *)
-{
- Application true_app("true");
-
- true_app.add_option("--fubar=", "doh");
-
- test_compare(Application::SUCCESS, true_app.run());
- test_compare(Application::SUCCESS, true_app.wait());
- test_zero(true_app.stdout_result().size());
-
- return TEST_SUCCESS;
-}
-
-
static test_return_t GET_TEST(void *)
{
libtest::http::GET get("http://foo.example.com/");
@@ -539,57 +502,57 @@ static test_return_t vchar_t_compare_neg_TEST(void *)
static test_return_t application_echo_fubar_BINARY(void *)
{
- Application true_app("echo");
+ if (0)
+ {
+ test_skip(0, access("/bin/echo", X_OK ));
+ Application true_app("/bin/echo");
- const char *args[]= { "fubar", 0 };
- test_compare(Application::SUCCESS, true_app.run(args));
- test_compare(Application::SUCCESS, true_app.wait());
+ const char *args[]= { "fubar", 0 };
+ test_compare(Application::SUCCESS, true_app.run(args));
- while (true_app.slurp() == false) {} ;
+ while (true_app.slurp() == false) {} ;
- libtest::vchar_t response;
- make_vector(response, test_literal_param("fubar\n"));
- test_compare(response, true_app.stdout_result());
+ libtest::vchar_t response;
+ make_vector(response, test_literal_param("fubar\n"));
+ test_compare(response, true_app.stdout_result());
+ }
return TEST_SUCCESS;
}
static test_return_t application_echo_fubar_BINARY2(void *)
{
- Application true_app("echo");
+ if (0)
+ {
+ test_skip(0, access("/bin/echo", X_OK ));
+ Application true_app("/bin/echo");
- true_app.add_option("fubar");
+ true_app.add_option("fubar");
- test_compare(Application::SUCCESS, true_app.run());
- test_compare(Application::SUCCESS, true_app.join());
+ test_compare(Application::SUCCESS, true_app.run());
+ test_compare(Application::SUCCESS, true_app.join());
- libtest::vchar_t response;
- make_vector(response, test_literal_param("fubar\n"));
- test_compare(response, true_app.stdout_result());
+ libtest::vchar_t response;
+ make_vector(response, test_literal_param("fubar\n"));
+ test_compare(response, true_app.stdout_result());
+ }
return TEST_SUCCESS;
}
-static test_return_t true_BINARY(void *)
+static test_return_t echo_fubar_BINARY(void *)
{
- const char *args[]= { 0 };
- test_compare(EXIT_SUCCESS, exec_cmdline("true", args));
+ const char *args[]= { "fubar", 0 };
+ test_compare(EXIT_SUCCESS, exec_cmdline("/bin/echo", args));
return TEST_SUCCESS;
}
-static test_return_t true_fubar_BINARY(void *)
+static test_return_t core_count_BINARY(void *)
{
- const char *args[]= { "--fubar", 0 };
- test_compare(EXIT_SUCCESS, exec_cmdline("true", args));
-
- return TEST_SUCCESS;
-}
+ const char *args[]= { 0 };
-static test_return_t echo_fubar_BINARY(void *)
-{
- const char *args[]= { "fubar", 0 };
- test_compare(EXIT_SUCCESS, exec_cmdline("echo", args));
+ test_compare(EXIT_SUCCESS, exec_cmdline("libtest/core-count", args, true));
return TEST_SUCCESS;
}
@@ -653,7 +616,7 @@ static test_return_t wait_services_appliction_TEST(void *)
const char *args[]= { "/etc/services", 0 };
test_compare(Application::SUCCESS, wait_app.run(args));
- test_compare(Application::SUCCESS, wait_app.wait());
+ test_compare(Application::SUCCESS, wait_app.join());
return TEST_SUCCESS;
}
@@ -673,7 +636,7 @@ static test_return_t gdb_wait_services_appliction_TEST(void *)
const char *args[]= { "/etc/services", 0 };
test_compare(Application::SUCCESS, wait_app.run(args));
- test_compare(Application::SUCCESS, wait_app.wait());
+ test_compare(Application::SUCCESS, wait_app.join());
return TEST_SUCCESS;
}
@@ -691,7 +654,7 @@ static test_return_t gdb_abort_services_appliction_TEST(void *)
abort_app.use_gdb();
test_compare(Application::SUCCESS, abort_app.run());
- test_compare(Application::SUCCESS, abort_app.wait());
+ test_compare(Application::SUCCESS, abort_app.join());
std::string gdb_filename= abort_app.gdb_filename();
test_skip(0, access(gdb_filename.c_str(), R_OK ));
@@ -715,8 +678,6 @@ static test_return_t get_free_port_TEST(void *)
return TEST_SUCCESS;
}
-static uint32_t fatal_calls= 0;
-
static test_return_t fatal_TEST(void *)
{
test_compare(fatal_calls++, fatal::disabled_counter());
@@ -777,7 +738,7 @@ static test_return_t create_tmpfile_TEST(void *)
test_compare(-1, access(tmp.c_str(), R_OK));
test_compare(-1, access(tmp.c_str(), F_OK));
- Application touch_app("touch");
+ Application touch_app("/usr/bin/touch");
const char *args[]= { tmp.c_str(), 0 };
test_compare(Application::SUCCESS, touch_app.run(args));
test_compare(Application::SUCCESS, touch_app.join());
@@ -841,6 +802,17 @@ test_st gearmand_tests[] ={
{0, 0, 0}
};
+static test_return_t clear_servers(void* object)
+{
+ server_startup_st *servers= (server_startup_st*)object;
+ test_true(servers);
+ servers->clear();
+
+ testing_service.clear();
+
+ return TEST_SUCCESS;
+}
+
static test_return_t check_for_libmemcached(void* object)
{
test_skip(true, HAVE_LIBMEMCACHED);
@@ -913,9 +885,8 @@ test_st comparison_tests[] ={
};
test_st cmdline_tests[] ={
- {"true", 0, true_BINARY },
- {"true --fubar", 0, true_fubar_BINARY },
{"echo fubar", 0, echo_fubar_BINARY },
+ {"core-count", 0, core_count_BINARY },
{"wait --quiet", 0, wait_BINARY },
{"wait --quiet --help", 0, wait_help_BINARY },
{"wait --quiet --version", 0, wait_version_BINARY },
@@ -969,8 +940,6 @@ test_st application_tests[] ={
{"gbd true", 0, application_gdb_true_BINARY2 },
{"true --fubar", 0, application_true_fubar_BINARY },
{"doesnotexist --fubar", 0, application_doesnotexist_BINARY },
- {"true --fubar=doh", 0, application_true_fubar_eq_doh_BINARY },
- {"true --fubar=doh add_option()", 0, application_true_fubar_eq_doh_option_BINARY },
{"echo fubar", 0, application_echo_fubar_BINARY },
{"echo fubar (as option)", 0, application_echo_fubar_BINARY2 },
{0, 0, 0}
@@ -984,13 +953,14 @@ static test_return_t check_for_curl(void *)
static test_return_t disable_fatal_exception(void *)
{
+ fatal_calls= 0;
fatal::disable();
return TEST_SUCCESS;
}
static test_return_t enable_fatal_exception(void *)
{
- fatal::disable();
+ fatal::enable();
return TEST_SUCCESS;
}
@@ -1008,9 +978,9 @@ collection_st collection[] ={
{"local", 0, 0, local_log},
{"directories", 0, 0, directories_tests},
{"comparison", 0, 0, comparison_tests},
- {"gearmand", check_for_gearman, 0, gearmand_tests},
- {"memcached", check_for_libmemcached, 0, memcached_TESTS },
- {"drizzled", check_for_drizzle, 0, drizzled_tests},
+ {"gearmand", check_for_gearman, clear_servers, gearmand_tests},
+ {"memcached", check_for_libmemcached, clear_servers, memcached_TESTS },
+ {"drizzled", check_for_drizzle, clear_servers, drizzled_tests},
{"cmdline", 0, 0, cmdline_tests},
{"application", 0, 0, application_tests},
{"http", check_for_curl, 0, http_tests},
diff --git a/libtest/vchar.cc b/libtest/vchar.cc
index 24238060..1473509f 100644
--- a/libtest/vchar.cc
+++ b/libtest/vchar.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/common.h>
namespace libtest {
diff --git a/libtest/wait.cc b/libtest/wait.cc
index f934f5b3..a946d246 100644
--- a/libtest/wait.cc
+++ b/libtest/wait.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include "mem_config.h"
#include <cstdlib>
#include <fcntl.h>
diff --git a/m4/ax_assert.m4 b/m4/ax_assert.m4
index 7ee26d00..d13787cd 100644
--- a/m4/ax_assert.m4
+++ b/m4/ax_assert.m4
@@ -4,7 +4,7 @@
#
# SYNOPSIS
#
-# AX_ASSERT
+# AX_ASSERT()
#
# DESCRIPTION
#
@@ -43,18 +43,22 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#serial 1
+#serial 4
-AC_DEFUN([AX_ASSERT],[
+AC_DEFUN([AX_ASSERT],
+ [AC_PREREQ([2.63])dnl
+ AC_REQUIRE([AX_DEBUG])
AC_ARG_ENABLE([assert],
[AS_HELP_STRING([--enable-assert],
- [Add assert code/turns off optimizations (yes|no) @<:@default=no@:>@])],[
+ [Enable assert, this will be overridden by --enable-debug (yes|no) @<:@default=no@:>@])],[
ax_enable_assert=yes
- dnl enable assert()
- AC_DEFINE(DASSERT,[1],[Define to 1 to enable assertging code.])
],[
ax_enable_assert=no
- AC_DEFINE(DASSERT,[0],[Define to 1 to enable assertging code.])
+ ])
+
+ AS_IF([ test "$ax_enable_assert" = "yes" -o "$ax_enable_debug" = "yes" ],[
+ ax_enable_assert="yes"
+ AC_DEFINE(NDEBUG,[1],[Define to 1 to enable assert'ing code.])
])
AC_MSG_CHECKING([for assert])
diff --git a/m4/ax_compiler_vendor.m4 b/m4/ax_compiler_vendor.m4
index 73e32ea9..13bf7dba 100644
--- a/m4/ax_compiler_vendor.m4
+++ b/m4/ax_compiler_vendor.m4
@@ -4,7 +4,7 @@
#
# SYNOPSIS
#
-# AX_COMPILER_VENDOR
+# AX_COMPILER_VENDOR()
#
# DESCRIPTION
#
diff --git a/m4/ax_compiler_version.m4 b/m4/ax_compiler_version.m4
index a277a9e7..e074cf74 100644
--- a/m4/ax_compiler_version.m4
+++ b/m4/ax_compiler_version.m4
@@ -4,8 +4,7 @@
#
# SYNOPSIS
#
-# AX_C_COMPILER_VERSION
-# AX_CXX_COMPILER_VERSION
+# AX_COMPILER_VERSION()
#
# DESCRIPTION
#
@@ -44,37 +43,58 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#serial 3
+#serial 5
+AC_DEFUN([_C_COMPILER_VERSION],
+ [AC_MSG_CHECKING([C Compiler version])
- AC_DEFUN([AX_C_COMPILER_VERSION],[
- AC_REQUIRE([AX_COMPILER_VENDOR])
- AC_MSG_CHECKING("C Compiler version")
+ AS_CASE(["$ax_cv_c_compiler_vendor"],
+ [sun],[ax_c_compiler_version=`$CC -V 2>&1 | sed 1q`],
+ [intel],[ax_c_compiler_version=`$CC --version 2>&1 | sed 1q`],
+ [clang],[ax_c_compiler_version=`$CC --version 2>&1 | sed 1q`],
+ [gnu],[ax_c_compiler_version=`$CC --version | sed 1q`],
+ [mingw],[ax_c_compiler_version=`$CC --version | sed 1q`],
+ [ax_c_compiler_version="unknown: $ax_cv_c_compiler_vendor"])
- AC_CHECK_DECL([__GNUC_PATCHLEVEL__],[GNUCC="yes"], [GNUCC="no"])
- AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"],[SUNCC="no"])
- AC_CHECK_DECL([__ICC], [INTELCC="yes"],[INTELCC="no"])
- AC_CHECK_DECL([__clang__], [CLANG="yes"],[CLANG="no"])
+ AC_MSG_RESULT(["$ax_c_compiler_version"])
+ AC_SUBST([CC_VERSION_VENDOR],["$ax_cv_c_compiler_vendor"])
+ AC_SUBST([CC_VERSION],["$ax_c_compiler_version"])
+ ])
- ax_cc_version=unknown
- AS_IF([test "$ax_cc_version" = "unknown"],[AS_IF([test "$SUNCC" = "yes"],[ax_cc_version=`$CC -V 2>&1 | sed 1q`])])
- AS_IF([test "$ax_cc_version" = "unknown"],[AS_IF([test "$CLANG" = "yes"],[ax_cc_version=`$CC --version 2>&1 | sed 1q` ])])
- AS_IF([test "$ax_cc_version" = "unknown"],[AS_IF([test "$INTELCC" = "yes"],[ax_cc_version=`$CC --version 2>&1 | sed 1q` ])])
- AS_IF([test "$ax_cc_version" = "unknown"],[AS_IF([test "$GNUCC" = "yes"],[ax_cc_version=`$CC --version | sed 1q` ])])
+AC_DEFUN([_CXX_COMPILER_VERSION],
+ [AC_MSG_CHECKING([C++ Compiler version])
- AC_MSG_RESULT(["$ax_cc_version"])
- AC_SUBST([CC_VERSION],["$ax_cc_version"])
- ])
+ AS_CASE(["$ax_cv_c_compiler_vendor"],
+ [sun],[ax_cxx_compiler_version=`$CXX -V 2>&1 | sed 1q`],
+ [intel],[ax_cxx_compiler_version=`$CXX --version 2>&1 | sed 1q`],
+ [clang],[ax_cxx_compiler_version=`$CXX --version 2>&1 | sed 1q`],
+ [gnu],[ax_cxx_compiler_version=`$CXX --version | sed 1q`],
+ [mingw],[ax_cxx_compiler_version=`$CXX --version | sed 1q`],
+ [ax_cxx_compiler_version="unknown: $ax_cv_c_compiler_vendor"])
+
+ AC_MSG_RESULT(["$ax_cxx_compiler_version"])
+ AC_SUBST([CXX_VERSION_VENDOR],["$ax_cv_c_compiler_vendor"])
+ AC_SUBST([CXX_VERSION],["$ax_cxx_compiler_version"])
+ ])
- AC_DEFUN([AX_CXX_COMPILER_VERSION], [
- AC_REQUIRE([AX_C_COMPILER_VERSION])
- AC_MSG_CHECKING("C++ Compiler version")
+AC_DEFUN([AX_COMPILER_VERSION],
+ [AC_REQUIRE([AX_COMPILER_VENDOR])
- ax_cxx_version=unknown
- AS_IF([test "$ax_cxx_version" = "unknown"],[AS_IF([test "$GNUCC" = "yes"],[ax_cxx_version=`$CXX --version | sed 1q`])])
- AS_IF([test "$ax_cxx_version" = "unknown"],[AS_IF([test "$SUNCC" = "yes"],[ax_cxx_version=`$CXX -V 2>&1 | sed 1q`])])
- AS_IF([test "$ax_cxx_version" = "unknown"],[AS_IF([test "$CLANG" = "yes"],[ax_cxx_version=`$CXX --version 2>&1 | sed 1q`])])
- AS_IF([test "$ax_cxx_version" = "unknown"],[AS_IF([test "$INTELCC" = "yes"],[ax_cc_version=`$CCX --version 2>&1 | sed 1q` ])])
+ AC_MSG_CHECKING([MINGW])
+ AC_CHECK_DECL([__MINGW32__],
+ [MINGW=yes
+ ax_c_compiler_version_vendor=mingw],
+ [MINGW=no])
+ AC_MSG_RESULT([$MINGW])
- AC_MSG_RESULT(["$ax_cxx_version"])
- AC_SUBST([CXX_VERSION], ["$ax_cxx_version"])
+ AC_REQUIRE([_C_COMPILER_VERSION])
+ AC_REQUIRE([_CXX_COMPILER_VERSION])
+ AS_IF([test "x$GCC" = xyes],
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#if !defined(__GNUC__) || (__GNUC__ < 4) || ((__GNUC__ >= 4) && (__GNUC_MINOR__ < 7))
+# error GCC is Too Old!
+#endif
+ ]])],
+ [ac_c_gcc_recent=yes],
+ [ac_c_gcc_recent=no])
])
+ ])
diff --git a/m4/ax_debug.m4 b/m4/ax_debug.m4
index 41d3fa02..d83a87e9 100644
--- a/m4/ax_debug.m4
+++ b/m4/ax_debug.m4
@@ -4,7 +4,7 @@
#
# SYNOPSIS
#
-# AX_DEBUG
+# AX_DEBUG()
#
# DESCRIPTION
#
@@ -43,26 +43,20 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#serial 1
+#serial 3
-AC_DEFUN([AX_DEBUG],[
+AC_DEFUN([AX_DEBUG],
+ [AC_PREREQ([2.63])dnl
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],
[Add debug code/turns off optimizations (yes|no) @<:@default=no@:>@])],[
ax_enable_debug=yes
- dnl Debugging. No optimization.
- AM_CFLAGS="${AM_CFLAGS} ${DEBUG_CFLAGS} -DDEBUG"
- AM_CXXFLAGS="${AM_CXXFLAGS} ${DEBUG_CXXFLAGS} -DDEBUG"
AC_DEFINE(DEBUG, [ 1 ], [Define to 1 to enable debugging code.])
],[
ax_enable_debug=no
- dnl Optimized version. No debug
- AM_CFLAGS="${AM_CFLAGS} ${OPTIMIZE_CFLAGS}"
- AM_CXXFLAGS="${AM_CXXFLAGS} ${OPTIMIZE_CXXFLAGS}"
AC_DEFINE(DEBUG, [ 0 ], [Define to 1 to enable debugging code.])
])
AC_MSG_CHECKING([for debug])
AC_MSG_RESULT([$ax_enable_debug])
- AM_CONDITIONAL([DEBUG_BUILD], [test "x$ax_enable_debug" = "xyes"])
])
diff --git a/m4/ax_endian.m4 b/m4/ax_endian.m4
index ee23fbdd..0dfbcd52 100644
--- a/m4/ax_endian.m4
+++ b/m4/ax_endian.m4
@@ -3,7 +3,7 @@
#
# SYNOPSIS
#
-# AX_ENDIAN
+# AX_ENDIAN()
#
# DESCRIPTION
#
diff --git a/m4/ax_harden_compiler_flags.m4 b/m4/ax_harden_compiler_flags.m4
index e33d41c9..caab7853 100644
--- a/m4/ax_harden_compiler_flags.m4
+++ b/m4/ax_harden_compiler_flags.m4
@@ -4,10 +4,7 @@
#
# SYNOPSIS
#
-# AX_HARDEN_COMPILER_FLAGS()
-# AX_HARDEN_LINKER_FLAGS()
-# AX_HARDEN_CC_COMPILER_FLAGS()
-# AX_HARDEN_CXX_COMPILER_FLAGS()
+# AX_HARDEN_COMPILER_FLAGS() AX_HARDEN_LINKER_FLAGS()
#
# DESCRIPTION
#
@@ -19,23 +16,23 @@
#
# Copyright (C) 2012 Brian Aker
# All rights reserved.
-#
+#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
-#
+#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
-#
+#
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
-#
+#
# * The names of its contributors may not be used to endorse or
# promote products derived from this software without specific prior
# written permission.
-#
+#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -50,167 +47,210 @@
# The Following flags are not checked for
# -Wdeclaration-after-statement is counter to C99
-# AX_APPEND_COMPILE_FLAGS([-std=c++11]) -- Not ready yet
-# AX_APPEND_COMPILE_FLAGS([-pedantic]) -- ?
-# AX_APPEND_COMPILE_FLAGS([-Wstack-protector]) -- Issues on 32bit compile
-# AX_APPEND_COMPILE_FLAGS([-fstack-protector-all]) -- Issues on 32bit compile
-# AX_APPEND_COMPILE_FLAGS([-Wlong-long]) -- Don't turn on for compatibility issues memcached_stat_st
-
-#serial 3
-
- AC_DEFUN([AX_HARDEN_LINKER_FLAGS], [
- AC_REQUIRE([AX_CHECK_LINK_FLAG])
- AC_REQUIRE([AX_VCS_CHECKOUT])
- AC_REQUIRE([AX_DEBUG])
- AC_REQUIRE([AX_CXX_COMPILER_VERSION])
-
- ax_append_compile_flags_extra=
- AS_IF([test "$CLANG" = "yes"],[ax_append_compile_flags_extra="-Werror"])
-
- AS_IF([test "$ac_cv_vcs_checkout" = yes], [
- AX_CHECK_LINK_FLAG([-Werror])
- ax_append_compile_flags_extra=
- ])
- AX_CHECK_LINK_FLAG([-z relro -z now],,[$ax_append_compile_flags_extra])
- AX_CHECK_LINK_FLAG([-pie],,[$ax_append_compile_flags_extra])
- ])
-
- AC_DEFUN([AX_HARDEN_CC_COMPILER_FLAGS], [
- AC_REQUIRE([AX_APPEND_COMPILE_FLAGS])
- AC_REQUIRE([AX_HARDEN_LINKER_FLAGS])
-
- AC_LANG_PUSH([C])
- CFLAGS=
-
- AX_APPEND_COMPILE_FLAGS([-g])
- AS_IF([test "$ax_enable_debug" = yes], [
- AX_APPEND_COMPILE_FLAGS([-ggdb],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-O0],,[$ax_append_compile_flags_extra])
- ],[
- AX_APPEND_COMPILE_FLAGS([-O2],,[$ax_append_compile_flags_extra])
- ])
-
- ac_cv_warnings_as_errors=no
- AS_IF([test "$ac_cv_vcs_checkout" = yes], [
- AX_APPEND_COMPILE_FLAGS([-Werror],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-fstack-check],,[$ax_append_compile_flags_extra])
- ac_cv_warnings_as_errors=yes
- ],[
- AX_APPEND_COMPILE_FLAGS([-Wno-pragmas],,[$ax_append_compile_flags_extra])
- ])
-
- AX_APPEND_COMPILE_FLAGS([-Wall],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wextra],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wunknown-pragmas],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wthis-test-should-fail],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-std=c99],,[$ax_append_compile_flags_extra])
- dnl Anything below this comment please keep sorted.
- AX_APPEND_COMPILE_FLAGS([--param=ssp-buffer-size=1],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Waddress],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Warray-bounds],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wbad-function-cast],,[$ax_append_compile_flags_extra])
- dnl Not in use -Wc++-compat
- AX_APPEND_COMPILE_FLAGS([-Wchar-subscripts],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wcomment],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wfloat-equal],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wformat-security],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wformat=2],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wlogical-op],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wmaybe-uninitialized],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wmissing-field-initializers],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wmissing-noreturn],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wmissing-prototypes],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wnested-externs],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wnormalized=id],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wold-style-definition],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Woverride-init],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wpointer-arith],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wpointer-sign],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wredundant-decls],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wshadow],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wshorten-64-to-32],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wsign-compare],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wstrict-overflow=1],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wstrict-prototypes],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wswitch-enum],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wundef],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wunused-result],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wunused-variable],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wwrite-strings],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-floop-parallelize-all],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-fwrapv],,[$ax_append_compile_flags_extra])
- AC_LANG_POP
-
- ])
-
- AC_DEFUN([AX_HARDEN_CXX_COMPILER_FLAGS], [
- AC_REQUIRE([AX_HARDEN_CC_COMPILER_FLAGS])
- AC_LANG_PUSH([C++])
- CXXFLAGS=
-
- AX_APPEND_COMPILE_FLAGS([-g],,[$ax_append_compile_flags_extra])
- AS_IF([test "$ax_enable_debug" = yes], [
- AX_APPEND_COMPILE_FLAGS([-O0],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-ggdb],,[$ax_append_compile_flags_extra])
- ],[
- AX_APPEND_COMPILE_FLAGS([-O2],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-D_FORTIFY_SOURCE=2],,[$ax_append_compile_flags_extra])
- ])
-
- AS_IF([test "$ac_cv_vcs_checkout" = yes], [
- AX_APPEND_COMPILE_FLAGS([-Werror],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-fstack-check],,[$ax_append_compile_flags_extra])
- ],[
- AX_APPEND_COMPILE_FLAGS([-Wno-pragmas],,[$ax_append_compile_flags_extra])
- ])
-
- AX_APPEND_COMPILE_FLAGS([-Wall],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wextra],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wunknown-pragmas],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wthis-test-should-fail],,[$ax_append_compile_flags_extra])
- dnl Anything below this comment please keep sorted.
- AX_APPEND_COMPILE_FLAGS([--param=ssp-buffer-size=1],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Waddress],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Warray-bounds],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wchar-subscripts],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wcomment],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wctor-dtor-privacy],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wfloat-equal],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wformat=2],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wmaybe-uninitialized],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wmissing-field-initializers],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wmissing-noreturn],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wlogical-op],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wnon-virtual-dtor],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wnormalized=id],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Woverloaded-virtual],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wpointer-arith],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wredundant-decls],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wshadow],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wshorten-64-to-32],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wsign-compare],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wstrict-overflow=1],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wswitch-enum],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wundef],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wc++11-compat],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wunused-result],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wunused-variable],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wwrite-strings],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-Wformat-security],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-floop-parallelize-all],,[$ax_append_compile_flags_extra])
- AX_APPEND_COMPILE_FLAGS([-fwrapv],,[$ax_append_compile_flags_extra])
- AC_LANG_POP
+# _APPEND_COMPILE_FLAGS_ERROR([-std=c++11]) -- Not ready yet
+# _APPEND_COMPILE_FLAGS_ERROR([-pedantic]) --
+# ? _APPEND_COMPILE_FLAGS_ERROR([-Wlong-long]) -- Don't turn on for
+# compatibility issues memcached_stat_st
+
+#serial 6
+
+AC_DEFUN([_APPEND_LINK_FLAGS_ERROR],
+ [AC_REQUIRE([AX_APPEND_LINK_FLAGS])
+ AX_APPEND_LINK_FLAGS([$1],[LIB],[-Werror])
+ ])
+
+AC_DEFUN([_APPEND_COMPILE_FLAGS_ERROR],
+ [AC_REQUIRE([AX_APPEND_COMPILE_FLAGS])
+ AX_APPEND_COMPILE_FLAGS([$1],,[-Werror])
+ ])
+
+AC_DEFUN([_HARDEN_LINKER_FLAGS],
+ [_APPEND_LINK_FLAGS_ERROR([-z relro -z now])
+ _APPEND_LINK_FLAGS_ERROR([-pie])
+ AS_IF([test "x$ac_cv_warnings_as_errors" = xyes],
+ [_APPEND_LINK_FLAGS_ERROR([-Werror])])
+ ])
+
+AC_DEFUN([_HARDEN_CC_COMPILER_FLAGS],
+ [AC_LANG_PUSH([C])dnl
+
+ _APPEND_COMPILE_FLAGS_ERROR([-g])
+ AS_IF([test "x$ax_enable_debug" = xyes],
+ [_APPEND_COMPILE_FLAGS_ERROR([-ggdb])
+ _APPEND_COMPILE_FLAGS_ERROR([-O0])],
+ [_APPEND_COMPILE_FLAGS_ERROR([-O2])])
+
+ _APPEND_COMPILE_FLAGS_ERROR([-Wno-pragmas])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wall])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wextra])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wunknown-pragmas])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wthis-test-should-fail])
+ _APPEND_COMPILE_FLAGS_ERROR([-std=c99])
+# Anything below this comment please keep sorted.
+ _APPEND_COMPILE_FLAGS_ERROR([--param=ssp-buffer-size=1])
+# _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-format-attribute])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wno-attributes])
+ _APPEND_COMPILE_FLAGS_ERROR([-Waddress])
+ _APPEND_COMPILE_FLAGS_ERROR([-Warray-bounds])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wbad-function-cast])
+# Not in use -Wc++-compat
+ _APPEND_COMPILE_FLAGS_ERROR([-Wchar-subscripts])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wcomment])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wfloat-equal])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wformat-security])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wformat=2])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wlogical-op])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wmaybe-uninitialized])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-field-initializers])
+ AS_IF([test "x$MINGW" = xyes],
+ [_APPEND_COMPILE_FLAGS_ERROR([-Wno-missing-noreturn])],
+ [_APPEND_COMPILE_FLAGS_ERROR([-Wmissing-noreturn])])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-prototypes])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wnested-externs])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wnormalized=id])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wold-style-definition])
+ _APPEND_COMPILE_FLAGS_ERROR([-Woverride-init])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wpointer-arith])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wpointer-sign])
+ AS_IF([test "x$MINGW" = xyes],
+ [_APPEND_COMPILE_FLAGS_ERROR([-Wno-suggest-attribute=const])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wno-suggest-attribute=noreturn])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wno-suggest-attribute=pure])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wno-redundant-decls])],
+ [_APPEND_COMPILE_FLAGS_ERROR([-Wredundant-decls])])
+
+ _APPEND_COMPILE_FLAGS_ERROR([-Wshadow])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wshorten-64-to-32])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wsign-compare])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wstrict-overflow=1])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wstrict-prototypes])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wswitch-enum])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wundef])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wunused])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wunused-result])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wunused-variable])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wwrite-strings])
+ _APPEND_COMPILE_FLAGS_ERROR([-floop-parallelize-all])
+ _APPEND_COMPILE_FLAGS_ERROR([-fwrapv])
+ _APPEND_COMPILE_FLAGS_ERROR([-fmudflapt])
+
+ AS_IF([test "x$ac_cv_vcs_checkout" = xyes],
+ [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check])
+ AS_IF([test "x$ac_c_gcc_recent" = xyes],
+ [_APPEND_COMPILE_FLAGS_ERROR([-D_FORTIFY_SOURCE=2])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wstack-protector])
+ _APPEND_COMPILE_FLAGS_ERROR([-fstack-protector])
+ _APPEND_COMPILE_FLAGS_ERROR([-fstack-protector-all])
+ ])])
+
+ AS_IF([test "x$ac_cv_vcs_checkout" = xyes],
+ [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check])],
+ [_APPEND_COMPILE_FLAGS_ERROR([-Wno-pragmas])])
+
+ AC_LANG_POP([C])
])
- AC_DEFUN([AX_HARDEN_COMPILER_FLAGS], [
- AC_REQUIRE([AX_HARDEN_CXX_COMPILER_FLAGS],,[$ax_append_compile_flags_extra])
- ])
+AC_DEFUN([_HARDEN_CXX_COMPILER_FLAGS],
+ [AC_LANG_PUSH([C++])
+ AC_REQUIRE([_APPEND_COMPILE_FLAGS_ERROR])
+
+ _APPEND_COMPILE_FLAGS_ERROR([-g])
+ AS_IF([test "x$ax_enable_debug" = xyes],
+ [_APPEND_COMPILE_FLAGS_ERROR([-O0])
+ _APPEND_COMPILE_FLAGS_ERROR([-ggdb])],
+ [_APPEND_COMPILE_FLAGS_ERROR([-O2])])
+
+ AS_IF([test "x$ac_cv_vcs_checkout" = xyes],
+ [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check])],
+ [_APPEND_COMPILE_FLAGS_ERROR([-Wno-pragmas])])
+
+ _APPEND_COMPILE_FLAGS_ERROR([-Wall])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wextra])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wunknown-pragmas])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wthis-test-should-fail])
+# Anything below this comment please keep sorted.
+ _APPEND_COMPILE_FLAGS_ERROR([--param=ssp-buffer-size=1])
+# _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-format-attribute])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wno-attributes])
+ _APPEND_COMPILE_FLAGS_ERROR([-Waddress])
+ _APPEND_COMPILE_FLAGS_ERROR([-Warray-bounds])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wchar-subscripts])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wcomment])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wctor-dtor-privacy])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wfloat-equal])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wformat=2])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wmaybe-uninitialized])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-field-initializers])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wlogical-op])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wnon-virtual-dtor])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wnormalized=id])
+ _APPEND_COMPILE_FLAGS_ERROR([-Woverloaded-virtual])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wpointer-arith])
+ AS_IF([test "x$MINGW" = xyes],
+ [_APPEND_COMPILE_FLAGS_ERROR([-Wno-suggest-attribute=const])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wno-missing-noreturn])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-noreturn])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wno-suggest-attribute=noreturn])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wno-error=suggest-attribute=noreturn])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wno-redundant-decls])],
+ [_APPEND_COMPILE_FLAGS_ERROR([-Wredundant-decls])])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wshadow])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wshorten-64-to-32])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wsign-compare])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wstrict-overflow=1])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wswitch-enum])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wundef])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wc++11-compat])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wunused])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wunused-result])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wunused-variable])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wwrite-strings])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wformat-security])
+ _APPEND_COMPILE_FLAGS_ERROR([-floop-parallelize-all])
+ _APPEND_COMPILE_FLAGS_ERROR([-fwrapv])
+ _APPEND_COMPILE_FLAGS_ERROR([-fmudflapt])
+
+ AS_IF([test "x$ac_cv_vcs_checkout" = xyes],
+ [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check])
+ AS_IF([test "x$ac_c_gcc_recent" = xyes],
+ [_APPEND_COMPILE_FLAGS_ERROR([-D_FORTIFY_SOURCE=2])
+ _APPEND_COMPILE_FLAGS_ERROR([-Wstack-protector])
+ _APPEND_COMPILE_FLAGS_ERROR([-fstack-protector])
+ _APPEND_COMPILE_FLAGS_ERROR([-fstack-protector-all])
+ ])])
+
+ AS_IF([test "x$ac_cv_warnings_as_errors" = xyes],
+ [_APPEND_COMPILE_FLAGS_ERROR([-Werror])])
+ AC_LANG_POP([C++])
+ ])
+
+ AC_DEFUN([_CC_OTHER_FLAGS],
+ [AC_REQUIRE([_APPEND_COMPILE_FLAGS_ERROR])
+
+ AC_LANG_PUSH([C])
+ _APPEND_COMPILE_FLAGS_ERROR([-pipe])
+ AC_LANG_POP([C])
+ ])
+
+# All of the heavy lifting happens in _HARDEN_LINKER_FLAGS,
+# _HARDEN_CC_COMPILER_FLAGS, _HARDEN_CXX_COMPILER_FLAGS, _CC_OTHER_FLAGS
+ AC_DEFUN([AX_HARDEN_COMPILER_FLAGS],
+ [AC_PREREQ([2.63])dnl
+ AC_REQUIRE([AX_APPEND_LINK_FLAGS])
+ AC_REQUIRE([AX_COMPILER_VERSION])
+ AC_REQUIRE([AX_DEBUG])
+ AC_REQUIRE([AX_VCS_CHECKOUT])
+
+ AC_REQUIRE([gl_VISIBILITY])
+ AS_IF([test -n "$CFLAG_VISIBILITY"],[CPPFLAGS="$CPPFLAGS $CFLAG_VISIBILITY"])
- AC_DEFUN([AX_CC_OTHER_FLAGS], [
- AC_REQUIRE([AX_APPEND_COMPILE_FLAGS])
- AC_REQUIRE([AX_HARDEN_LINKER_FLAGS])
+ AC_CACHE_CHECK([if all warnings into errors],[ac_cv_warnings_as_errors],
+ [AS_IF([test "x$ac_cv_vcs_checkout" = xyes],[ac_cv_warnings_as_errors=yes],
+ [ac_cv_warnings_as_errors=no])
+ ])
- AC_LANG_PUSH([C])
- AX_APPEND_COMPILE_FLAGS([-pipe],,[$ax_append_compile_flags_extra])
- AC_LANG_POP
- ])
+ AC_REQUIRE([_HARDEN_LINKER_FLAGS])
+ AC_REQUIRE([_HARDEN_CC_COMPILER_FLAGS])
+ AC_REQUIRE([_HARDEN_CXX_COMPILER_FLAGS])
+ AC_REQUIRE([_CC_OTHER_FLAGS])
+ ])
diff --git a/m4/ax_hex_version.m4 b/m4/ax_hex_version.m4
index bf1bcc1c..48d3a737 100644
--- a/m4/ax_hex_version.m4
+++ b/m4/ax_hex_version.m4
@@ -19,9 +19,10 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 2
+#serial 3
-AC_DEFUN([AX_HEX_VERSION],[
+AC_DEFUN([AX_HEX_VERSION],
+ [AC_PREREQ([2.63])dnl
string_version_$1=`echo $2 | sed 's|[\-a-z0-9]*$||' | awk -F. '{printf "%d.%d.%d", $[]1, $[]2, $[]3}'`
hex_version_$1=`echo $2 | sed 's|[\-a-z0-9]*$||' | awk -F. '{printf "0x%0.2d%0.3d%0.3d", $[]1, $[]2, $[]3}'`
diff --git a/m4/ax_libevent.m4 b/m4/ax_libevent.m4
index 79999ef7..41392f9d 100644
--- a/m4/ax_libevent.m4
+++ b/m4/ax_libevent.m4
@@ -3,7 +3,7 @@
#
# SYNOPSIS
#
-# AX_LIBEVENT()
+# AX_LIBEVENT(), AX_LIBEVENT2(), AX_LIBEVENT2_EVHTTP()
#
# DESCRIPTION
#
@@ -18,32 +18,101 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 1
+#serial 2
- AC_DEFUN([AX_LIBEVENT],[
- AC_CACHE_CHECK([test for a working libevent], [ax_cv_libevent], [
- AX_SAVE_FLAGS
- LIBS="-levent $LIBS"
- AC_LANG_PUSH([C])
- AC_RUN_IFELSE([
- AC_LANG_PROGRAM([#include <event.h>], [
- struct event_base *tmp_event= event_init();
- event_base_free(tmp_event);
- ])],
- [ax_cv_libevent=yes],
- [ax_cv_libevent=no],
- [AC_MSG_WARN([test program execution failed])])
- AC_LANG_POP
- AX_RESTORE_FLAGS
- ])
-
- AS_IF([test "x$ax_cv_libevent" = "xyes"],[
- LIBEVENT_LDFLAGS="-levent"
- AC_SUBST(LIBEVENT_LDFLAGS)
- AC_DEFINE([HAVE_LIBEVENT],[1],[Define if event_init is present in event.h.])],[
- AC_DEFINE([HAVE_LIBEVENT],[0],[Define if event_init is present in event_init.h.])
- ])
-
- AM_CONDITIONAL(HAVE_LIBEVENT, test "x$ax_cv_libevent" = "xyes")
- ])
+AC_DEFUN([AX_LIBEVENT],
+ [AC_PREREQ([2.63])dnl
+ AC_CACHE_CHECK([test for a working libevent],[ax_cv_libevent],
+ [AX_SAVE_FLAGS
+ LIBS="-levent $LIBS"
+ AC_LANG_PUSH([C])
+ AC_RUN_IFELSE([
+ AC_LANG_PROGRAM([
+#include <sys/types.h>
+#include <sys/time.h>
+#include <stdlib.h>
+#include <event.h>
+ ],[
+ struct event_base *tmp_event= event_init();
+ event_base_free(tmp_event);
+ ])],
+ [ax_cv_libevent=yes],
+ [ax_cv_libevent=no],
+ [AC_MSG_WARN([test program execution failed])])
+ AC_LANG_POP
+ AX_RESTORE_FLAGS
+ ])
+ AS_IF([test "x$ax_cv_libevent" = "xyes"],
+ [LIBEVENT_LDFLAGS="-levent"
+ AC_SUBST(LIBEVENT_LDFLAGS)
+ AC_DEFINE([HAVE_LIBEVENT],[1],[Define if event_init is present in event.h.])],
+ [AC_DEFINE([HAVE_LIBEVENT],[0],[Define if event_init is present in event.h.])])
+
+ AM_CONDITIONAL(HAVE_LIBEVENT, test "x$ax_cv_libevent" = "xyes")
+ ])
+
+ AC_DEFUN([AX_LIBEVENT2],
+ [AC_REQUIRE([AX_LIBEVENT])
+ AC_CACHE_CHECK([test for a working libevent version 2],[ax_cv_libevent2],
+ [AX_SAVE_FLAGS
+ LIBS="-levent $LIBS"
+ AC_LANG_PUSH([C])
+ AC_RUN_IFELSE([
+ AC_LANG_PROGRAM([
+#include <sys/types.h>
+#include <sys/time.h>
+#include <stdlib.h>
+#include <event2/event.h>
+ ],[
+ struct event_base *tmp_event= event_init();
+ event_base_free(tmp_event);
+ ])],
+ [ax_cv_libevent2=yes],
+ [ax_cv_libevent2=no],
+ [AC_MSG_WARN([test program execution failed])])
+ AC_LANG_POP
+ AX_RESTORE_FLAGS
+ ])
+
+ AS_IF([test "x$ax_cv_libevent2" = xyes],
+ [LIBEVENT2_LDFLAGS="-levent"
+ AC_SUBST(LIBEVENT2_LDFLAGS)
+ AC_DEFINE([HAVE_LIBEVENT2],[1],[Define if event_init is present in event2/event.h.])],
+ [AC_DEFINE([HAVE_LIBEVENT2],[0],[Define if event_init is present in event2/event.h.])])
+
+ AM_CONDITIONAL([HAVE_LIBEVENT2], [test "x$ax_cv_libevent2" = xyes])
+ ])
+
+ AC_DEFUN([AX_LIBEVENT2_EVHTTP],
+ [AC_REQUIRE([AX_LIBEVENT2])
+ AC_CACHE_CHECK([test for a working libevent2 evhttp interface], [ax_cv_libevent2_evhttp],
+ [AX_SAVE_FLAGS
+ LIBS="-levent $LIBS"
+ AC_LANG_PUSH([C])
+ AC_RUN_IFELSE([
+ AC_LANG_PROGRAM([
+#include <sys/types.h>
+#include <sys/time.h>
+#include <stdlib.h>
+#include <event2/event.h>
+#include <event2/http.h>
+ ],[
+ struct event_base *libbase= event_base_new();
+ struct evhttp *libsrvr= evhttp_new(libbase);
+ ])],
+ [ax_cv_libevent2_evhttp=yes],
+ [ax_cv_libevent2_evhttp=no],
+ [AC_MSG_WARN([test program execution failed])])
+ AC_LANG_POP
+ AX_RESTORE_FLAGS
+ ])
+
+ AS_IF([test "x$ax_cv_libevent2_evhttp" = "xyes"],
+ [LIBEVENT2_LDFLAGS="-levent"
+ AC_SUBST(LIBEVENT2_LDFLAGS)
+ AC_DEFINE([HAVE_LIBEVENT2],[1],[Define if event_init is present in event2/event.h.])],
+ [AC_DEFINE([HAVE_LIBEVENT2],[0],[Define if event_init is present in event2/event.h.])])
+
+ AM_CONDITIONAL([HAVE_LIBEVENT2_EVHTTP],[test "x$ax_cv_libevent2_evhttp" = xyes])
+ ])
diff --git a/m4/ax_libmemcached.m4 b/m4/ax_libmemcached.m4
index ea385d0f..95e5c9f7 100644
--- a/m4/ax_libmemcached.m4
+++ b/m4/ax_libmemcached.m4
@@ -4,7 +4,7 @@
#
# SYNOPSIS
#
-# AX_LIBMEMCACHED, AX_LIBMEMCACHED_UTIL, AX_WITH_LIBMEMCACHED
+# AX_LIBMEMCACHED, AX_LIBMEMCACHED_UTIL, AX_ENABLE_LIBMEMCACHED
#
# DESCRIPTION
#
@@ -73,10 +73,6 @@ AC_DEFUN([AX_LIBMEMCACHED], [
AS_IF([test "x$ax_cv_libmemcached" = "xyes"], [
AC_DEFINE([HAVE_LIBMEMCACHED_MEMCACHED_H], [1], [Have libmemcached-1.0/memcached.h])
- LIBMEMCACHED_CFLAGS=
- AC_SUBST([LIBMEMCACHED_CFLAGS])
- LIBMEMCACHED_LDFLAGS="-lmemcached"
- AC_SUBST([LIBMEMCACHED_LDFLAGS], [-lmemcached])
],[
AC_DEFINE([HAVE_LIBMEMCACHED_MEMCACHED_H], [0], [Have libmemcached-1.0/memcached.h])
])
@@ -106,34 +102,37 @@ AC_DEFUN([AX_LIBMEMCACHED], [
AS_IF([test "x$ax_cv_libmemcached_util" = "xyes"], [
AC_DEFINE([HAVE_LIBMEMCACHED_UTIL_H], [1], [Have libmemcachedutil-1.0/util.h])
- LIBMEMCACHED_UTIL_LDFLAGS="-lmemcached -lmemcachedutil"
- AC_SUBST([LIBMEMCACHED_UTIL_LDFLAGS])
],[
AC_DEFINE([HAVE_LIBMEMCACHED_UTIL_H], [0], [Have libmemcachedutil-1.0/util.h])
])
])
- AC_DEFUN([_WITH_LIBMEMCACHED], [
- AC_REQUIRE([AX_LIBMEMCACHED_UTIL])
- AC_ARG_ENABLE([libmemcached],
- [AS_HELP_STRING([--disable-libmemcached],
- [Build with libmemcached support @<:@default=on@:>@])],
- [ac_enable_libmemcached="$enableval"],
- [ac_enable_libmemcached="yes"])
+AC_DEFUN([_ENABLE_LIBMEMCACHED], [
+ AC_REQUIRE([AX_LIBMEMCACHED_UTIL])
+ AC_ARG_ENABLE([libmemcached],
+ [AS_HELP_STRING([--disable-libmemcached],
+ [Build with libmemcached support @<:@default=on@:>@])],
+ [ax_enable_libmemcached="$enableval"],
+ [ax_enable_libmemcached="yes"])
- ac_with_libmemcached="no"
- AS_IF([test "x$ac_enable_libmemcached" = "xyes"], [
- AS_IF([test "x$ax_cv_libmemcached" = "xyes"], [
- ac_with_libmemcached="yes"
- ])
- ])
+ AS_IF([test "x$ax_cv_libmemcached" != "xyes"], [
+ ax_enable_libmemcached="not found"
+ ])
- AS_IF([test "x$ac_with_libmemcached" = "xyes"], [
- AC_DEFINE([HAVE_LIBMEMCACHED], [1], [Enable libmemcached support])
- ],[
- AC_DEFINE([HAVE_LIBMEMCACHED], [0], [Enable libmemcached support])
- ])
- AM_CONDITIONAL(HAVE_LIBMEMCACHED, test "x${ac_with_libmemcached}" = "xyes")
- ])
+ AS_IF([test "x$ax_enable_libmemcached" = "xyes"], [
+ AC_DEFINE([HAVE_LIBMEMCACHED], [1], [Enable libmemcached support])
+ LIBMEMCACHED_CFLAGS=
+ AC_SUBST([LIBMEMCACHED_CFLAGS])
+ LIBMEMCACHED_LDFLAGS="-lmemcached"
+ AC_SUBST([LIBMEMCACHED_LDFLAGS])
+ AS_IF([test "x$ax_cv_libmemcached_util" = "xyes"], [
+ LIBMEMCACHED_UTIL_LDFLAGS="-lmemcached -lmemcachedutil"
+ AC_SUBST([LIBMEMCACHED_UTIL_LDFLAGS])
+ ])
+ ],[
+ AC_DEFINE([HAVE_LIBMEMCACHED], [0], [Enable libmemcached support])
+ ])
+ AM_CONDITIONAL(HAVE_LIBMEMCACHED, test "x${ax_enable_libmemcached}" = "xyes")
+ ])
-AC_DEFUN([AX_WITH_LIBMEMCACHED], [ AC_REQUIRE([_WITH_LIBMEMCACHED]) ])
+AC_DEFUN([AX_ENABLE_LIBMEMCACHED], [ AC_REQUIRE([_ENABLE_LIBMEMCACHED]) ])
diff --git a/m4/ax_platform.m4 b/m4/ax_platform.m4
index c1403b8c..bf4ff0e4 100644
--- a/m4/ax_platform.m4
+++ b/m4/ax_platform.m4
@@ -20,21 +20,21 @@
# warranty.
#serial 1
- AC_DEFUN([AX_PLATFORM],[
- AC_REQUIRE([AC_CANONICAL_HOST])
+ AC_DEFUN([AX_PLATFORM],
+ [AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([AC_CANONICAL_TARGET])
- AC_DEFINE_UNQUOTED([HOST_VENDOR], ["$host_vendor"],[Vendor of Build System])
- AC_DEFINE_UNQUOTED([HOST_OS], ["$host_os"], [OS of Build System])
- AC_DEFINE_UNQUOTED([HOST_CPU], ["$host_cpu"], [CPU of Build System])
+ AC_DEFINE_UNQUOTED([HOST_VENDOR],["$host_vendor"],[Vendor of Build System])
+ AC_DEFINE_UNQUOTED([HOST_OS],["$host_os"], [OS of Build System])
+ AC_DEFINE_UNQUOTED([HOST_CPU],["$host_cpu"], [CPU of Build System])
- AC_DEFINE_UNQUOTED([TARGET_VENDOR], ["$target_vendor"],[Vendor of Target System])
- AC_DEFINE_UNQUOTED([TARGET_OS], ["$target_os"], [OS of Target System])
- AC_DEFINE_UNQUOTED([TARGET_CPU], ["$target_cpu"], [CPU of Target System])
+ AC_DEFINE_UNQUOTED([TARGET_VENDOR],["$target_vendor"],[Vendor of Target System])
+ AC_DEFINE_UNQUOTED([TARGET_OS],["$target_os"], [OS of Target System])
+ AC_DEFINE_UNQUOTED([TARGET_CPU],["$target_cpu"], [CPU of Target System])
- AS_CASE([$target_os],[
- *mingw32*],[
- AC_DEFINE([TARGET_OS_WINDOWS], [1], [Whether we are building for Windows])
+ AS_CASE([$target_os],
+ [*mingw32*],
+ [AC_DEFINE([TARGET_OS_WINDOWS], [1], [Whether we are building for Windows])
AC_DEFINE([WINVER], [WindowsXP], [Version of Windows])
AC_DEFINE([_WIN32_WINNT], [0x0501], [Magical number to make things work])
AC_DEFINE([EAI_SYSTEM], [11], [Another magical number])
@@ -44,23 +44,14 @@
# define SHUT_WR SD_SEND
# define SHUT_RDWR SD_BOTH
#endif
- ])
- ],[
- *freebsd*],[
- AC_DEFINE([TARGET_OS_FREEBSD], [1], [Whether we are building for FreeBSD])
- AC_DEFINE([__APPLE_CC__],[1],[Workaround for bug in FreeBSD headers])
- ],[
- *solaris*],[
- AC_DEFINE([TARGET_OS_SOLARIS], [1], [Whether we are building for Solaris])
- ],[
- *darwin*],[
- AC_DEFINE([TARGET_OS_OSX], [1], [Whether we build for OSX])
- ],[
- *linux*],[
- AC_DEFINE([TARGET_OS_LINUX], [1], [Whether we build for Linux])
- ])
+ ])],
+ [*freebsd*],[AC_DEFINE([TARGET_OS_FREEBSD],[1],[Whether we are building for FreeBSD])
+ AC_DEFINE([__APPLE_CC__],[1],[Workaround for bug in FreeBSD headers])],
+ [*solaris*],[AC_DEFINE([TARGET_OS_SOLARIS],[1],[Whether we are building for Solaris])],
+ [*darwin*],[AC_DEFINE([TARGET_OS_OSX],[1],[Whether we build for OSX])],
+ [*linux*],[AC_DEFINE([TARGET_OS_LINUX],[1],[Whether we build for Linux])])
- AM_CONDITIONAL(BUILD_WIN32, [test "x${TARGET_WINDOWS}" = "xtrue"])
- AM_CONDITIONAL(TARGET_OSX, [test "x${TARGET_OSX}" = "xtrue"])
- AM_CONDITIONAL(TARGET_LINUX, [test "x${TARGET_LINUX}" = "xtrue"])
- ])
+ AM_CONDITIONAL([BUILD_WIN32],[test "x${TARGET_WINDOWS}" = "xtrue"])
+ AM_CONDITIONAL([TARGET_OSX],[test "x${TARGET_OSX}" = "xtrue"])
+ AM_CONDITIONAL([TARGET_LINUX],[test "x${TARGET_LINUX}" = "xtrue"])
+ ])
diff --git a/m4/ax_prog_sphinx_build.m4 b/m4/ax_prog_sphinx_build.m4
index 713281bf..8b69df83 100644
--- a/m4/ax_prog_sphinx_build.m4
+++ b/m4/ax_prog_sphinx_build.m4
@@ -4,7 +4,7 @@
#
# SYNOPSIS
#
-# AX_PROG_SPHINX_BUILD
+# AX_PROG_SPHINX_BUILD()
#
# DESCRIPTION
#
@@ -19,26 +19,27 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 1
+#serial 2
- AC_DEFUN([AX_PROG_SPHINX_BUILD], [
- AC_CHECK_PROGS([PERL], [perl])
- AC_CHECK_PROGS([DPKG_GENSYMBOLS], [dpkg-gensymbols], [:])
- AC_CHECK_PROGS([LCOV], [lcov], [echo lcov not found])
- AC_CHECK_PROGS([LCOV_GENHTML], [genhtml], [echo genhtml not found])
+AC_DEFUN([AX_PROG_SPHINX_BUILD],
+ [AC_PREREQ([2.63])dnl
+ AC_CHECK_PROGS([PERL], [perl])
+ AC_CHECK_PROGS([DPKG_GENSYMBOLS], [dpkg-gensymbols], [:])
+ AC_CHECK_PROGS([LCOV], [lcov], [echo lcov not found])
+ AC_CHECK_PROGS([LCOV_GENHTML], [genhtml], [echo genhtml not found])
- AC_CHECK_PROGS([SPHINXBUILD], [sphinx-build], [:])
- AS_IF([test "x${SPHINXBUILD}" != "x:"],[
- AC_CACHE_CHECK([if sphinx is new enough],[ac_cv_recent_sphinx],[
+ AC_CHECK_PROGS([SPHINXBUILD], [sphinx-build], [:])
+ AS_IF([test "x${SPHINXBUILD}" != "x:"],[
+ AC_CACHE_CHECK([if sphinx is new enough],[ac_cv_recent_sphinx],[
- ${SPHINXBUILD} -Q -C -b man -d conftest.d . . >/dev/null 2>&1
- AS_IF([test $? -eq 0],[ac_cv_recent_sphinx=yes],
- [ac_cv_recent_sphinx=no])
- rm -rf conftest.d
- ])
+ ${SPHINXBUILD} -Q -C -b man -d conftest.d . . >/dev/null 2>&1
+ AS_IF([test $? -eq 0],[ac_cv_recent_sphinx=yes],
+ [ac_cv_recent_sphinx=no])
+ rm -rf conftest.d
])
-
- AM_CONDITIONAL(HAVE_DPKG_GENSYMBOLS,[test "x${DPKG_GENSYMBOLS}" != "x:"])
- AM_CONDITIONAL(HAVE_SPHINX,[test "x${SPHINXBUILD}" != "x:"])
- AM_CONDITIONAL(HAVE_RECENT_SPHINX,[test "x${ac_cv_recent_sphinx}" = "xyes"])
])
+
+ AM_CONDITIONAL(HAVE_DPKG_GENSYMBOLS,[test "x${DPKG_GENSYMBOLS}" != "x:"])
+ AM_CONDITIONAL(HAVE_SPHINX,[test "x${SPHINXBUILD}" != "x:"])
+ AM_CONDITIONAL(HAVE_RECENT_SPHINX,[test "x${ac_cv_recent_sphinx}" = "xyes"])
+])
diff --git a/m4/ax_pthread.m4 b/m4/ax_pthread.m4
index e0d54ad9..71b932e0 100644
--- a/m4/ax_pthread.m4
+++ b/m4/ax_pthread.m4
@@ -82,7 +82,7 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 18
+#serial 19
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
AC_DEFUN([AX_PTHREAD], [
diff --git a/m4/ax_pthread_timedjoin_np.m4 b/m4/ax_pthread_timedjoin_np.m4
index d6f0467a..39de8fa8 100644
--- a/m4/ax_pthread_timedjoin_np.m4
+++ b/m4/ax_pthread_timedjoin_np.m4
@@ -4,7 +4,7 @@
#
# SYNOPSIS
#
-# AX_PTHREAD_TIMEDJOIN_NP
+# AX_PTHREAD_TIMEDJOIN_NP()
#
# DESCRIPTION
#
@@ -19,37 +19,32 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 4
+#serial 6
- AC_DEFUN([AX_PTHREAD_TIMEDJOIN_NP], [
- AC_REQUIRE([AX_PTHREAD])
- AC_CACHE_CHECK([check for pthread_timedjoin_np], [ax_cv_pthread_timedjoin_np], [
- save_LDFLAGS="$LDFLAGS"
- LDFLAGS="$PTHREAD_LIBS"
- AC_LANG_PUSH([C])
- AC_LINK_IFELSE([
- AC_LANG_PROGRAM([
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
-#include <stdlib.h>
+AC_DEFUN([AX_PTHREAD_TIMEDJOIN_NP],
+ [AC_PREREQ([2.63])dnl
+ AC_REQUIRE([AX_PTHREAD])
+ AC_CACHE_CHECK([check for pthread_timedjoin_np], [ax_cv_pthread_timedjoin_np],
+ [AX_SAVE_FLAGS
+ CFLAGS="$PTHREAD_CFLAGS"
+ LIBS="$PTHREAD_LIBS"
+ AC_LANG_PUSH([C])
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [
#include <pthread.h>
- ], [
- pthread_t thread;
- pthread_timedjoin_np(thread, NULL);
- ])],
- [ax_cv_pthread_timedjoin_np=yes],
- [])
-
- AC_LANG_POP
- LDFLAGS="$save_LDFLAGS"
-
- ])
+#include <stdlib.h>
+ ],[
+ pthread_t thread;
+ pthread_timedjoin_np(thread, NULL, NULL);
+ ])],
+ [ax_cv_pthread_timedjoin_np=yes],[])
- AS_IF([test "$ax_cv_pthread_timedjoin_np" = yes],[
- AC_DEFINE(HAVE_PTHREAD_TIMEDJOIN_NP,[1],[Define if pthread_timedjoin_np is present in pthread.h.])],[
- AC_DEFINE(HAVE_PTHREAD_TIMEDJOIN_NP,[0],[Define if pthread_timedjoin_np is present in pthread.h.])
- ])
+ AC_LANG_POP
+ AX_RESTORE_FLAGS
])
+ AS_IF([test "$ax_cv_pthread_timedjoin_np" = yes],
+ [AC_DEFINE(HAVE_PTHREAD_TIMEDJOIN_NP,[1],[Define if pthread_timedjoin_np is present in pthread.h.])],
+ [AC_DEFINE(HAVE_PTHREAD_TIMEDJOIN_NP,[0],[Define if pthread_timedjoin_np is present in pthread.h.])])
+ ])
diff --git a/m4/ax_uuid.m4 b/m4/ax_uuid.m4
index 5f272e18..6864b45c 100644
--- a/m4/ax_uuid.m4
+++ b/m4/ax_uuid.m4
@@ -1,11 +1,12 @@
+# vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
# ===========================================================================
# https://github.com/BrianAker/ddm4
# ===========================================================================
#
# SYNOPSIS
#
-# AX_UUID
-# AX_UUID_GENERATE_TIME_SAFE
+# AX_UUID()
+# AX_UUID_GENERATE_TIME_SAFE()
#
# DESCRIPTION
#
@@ -20,30 +21,32 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 4
+#serial 5
-AC_DEFUN([AX_UUID], [
- AC_CHECK_HEADER([uuid/uuid.h], [
- AC_CACHE_CHECK([check to see if -luuid is not needed], [ax_cv_libuuid_is_required], [
- AC_LANG_PUSH([C])
- AC_RUN_IFELSE([
- AC_LANG_PROGRAM([#include <uuid/uuid.h>], [
+AC_DEFUN([AX_UUID],
+ [AC_PREREQ([2.63])dnl
+ AC_CHECK_HEADER([uuid/uuid.h],[
+
+ AC_CACHE_CHECK([check to see if -luuid is needed], [ax_cv_libuuid_is_required],
+ [AC_LANG_PUSH([C])
+ AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM([#include <uuid/uuid.h>], [
uuid_t out;
uuid_generate(out);
])],
[ax_cv_libuuid_is_required=no],
- [ax_cv_libuuid_is_required=maybe],
+ [ax_cv_libuuid_is_required=yes],
[AC_MSG_WARN([test program execution failed])])
AC_LANG_POP
])
- AS_IF([test "$ax_cv_libuuid_is_required" = maybe], [
- AC_CACHE_CHECK([check to see if -luuid is needed], [ax_cv_libuuid_works], [
- save_LIBS="$LIBS"
+ AS_IF([test "$ax_cv_libuuid_is_required" = yes],
+ [AC_CACHE_CHECK([check to see if -luuid is needed], [ax_cv_libuuid_works],
+ [AX_SAVE_FLAGS
LIBS="-luuid $LIBS"
AC_LANG_PUSH([C])
- AC_RUN_IFELSE([
- AC_LANG_PROGRAM([#include <uuid/uuid.h>], [
+ AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM([#include <uuid/uuid.h>], [
uuid_t out;
uuid_generate(out);
])],
@@ -51,31 +54,34 @@ AC_DEFUN([AX_UUID], [
[ax_cv_libuuid_works=no],
[AC_MSG_WARN([test program execution failed])])
AC_LANG_POP
- LIBS="$save_LIBS"
- ])
- AS_IF([test "$ax_cv_libuuid_works" = yes], [
- AC_SUBST([LIBUUID_LDFLAGS],[-luuid])])
+ AX_RESTORE_FLAGS])
])
- AS_IF([test "$ax_cv_libuuid_is_required" = no], [UUID_UUID_H=yes])
- AS_IF([test "$ax_cv_libuuid_works" = yes], [UUID_UUID_H=yes])
- ])
+ AS_IF([test "$ax_cv_libuuid_is_required" = yes],
+ [AS_IF([test "$ax_cv_libuuid_works" = yes],[ax_libuuid=yes])],
+ [ax_libuuid=yes])
+ ],[ax_libuuid=no])
- AS_IF([test "$UUID_UUID_H" = yes], [
- AC_DEFINE([HAVE_UUID_UUID_H], [1], [Have uuid/uuid.h])
- ],[
- AC_DEFINE([HAVE_UUID_UUID_H], [0], [Have uuid/uuid.h])
- ])
+ AS_IF([test "$ax_libuuid" = yes],
+ [AC_DEFINE([HAVE_UUID_UUID_H],[1],[Have uuid/uuid.h])
+ AS_IF([test "$ax_cv_libuuid_is_required" = yes],[ LIBUUID_LDFLAGS='-luuid' ])],
+ [AC_DEFINE([HAVE_UUID_UUID_H],[0],[Have uuid/uuid.h])
+ ])
+
+ AC_SUBST([LIBUUID_LDFLAGS])
+ AM_CONDITIONAL([HAVE_LIBUUID],[test "$ax_libuuid" = yes])
])
- AC_DEFUN([AX_UUID_GENERATE_TIME_SAFE], [
- AC_REQUIRE([AX_UUID])
- AC_CACHE_CHECK([for uuid_generate_time_safe], [ax_cv_uuid_generate_time_safe], [
- save_LIBS="$LIBS"
+ AC_DEFUN([AX_UUID_GENERATE_TIME_SAFE],
+ [AC_PREREQ([2.63])dnl
+ AC_REQUIRE([AX_UUID])dnl
+ AC_CACHE_CHECK([for uuid_generate_time_safe],
+ [ax_cv_uuid_generate_time_safe],
+ [AX_SAVE_FLAGS
LIBS="$LIBUUID_LDFLAGS $LIBS"
AC_LANG_PUSH([C])
AC_RUN_IFELSE([
- AC_LANG_PROGRAM([#include <uuid/uuid.h>], [
+ AC_LANG_PROGRAM([#include <uuid/uuid.h>],[
uuid_t out;
uuid_generate_time_safe(out);
])],
@@ -83,11 +89,10 @@ AC_DEFUN([AX_UUID], [
[ax_cv_uuid_generate_time_safe=no],
[AC_MSG_WARN([test program execution failed])])
AC_LANG_POP
- LIBS="$save_LIBS"
+ AX_RESTORE_FLAGS
])
- AS_IF([test "$ax_cv_uuid_generate_time_safe" = yes],[
- AC_DEFINE([HAVE_UUID_GENERATE_TIME_SAFE],[1],[Define if uuid_generate_time_safe is present in uuid/uuid.h.])],[
- AC_DEFINE([HAVE_UUID_GENERATE_TIME_SAFE],[0],[Define if uuid_generate_time_safe is present in uuid/uuid.h.])
- ])
+ AS_IF([test "$ax_cv_uuid_generate_time_safe" = yes],
+ [AC_DEFINE([HAVE_UUID_GENERATE_TIME_SAFE],[1],[Define if uuid_generate_time_safe is present in uuid/uuid.h.])],
+ [AC_DEFINE([HAVE_UUID_GENERATE_TIME_SAFE],[0],[Define if uuid_generate_time_safe is present in uuid/uuid.h.])])
])
diff --git a/m4/ax_vcs_checkout.m4 b/m4/ax_vcs_checkout.m4
index 7a48561c..4b094c56 100644
--- a/m4/ax_vcs_checkout.m4
+++ b/m4/ax_vcs_checkout.m4
@@ -45,15 +45,30 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#serial 2
+#serial 6
-AC_DEFUN([AX_VCS_CHECKOUT],[
- AC_CACHE_CHECK([for vcs checkout], [ac_cv_vcs_checkout], [
- AS_IF([test -d ".bzr"],[ac_cv_vcs_checkout=yes])
- AS_IF([test -d ".svn"],[ac_cv_vcs_checkout=yes])
- AS_IF([test -d ".hg"], [ac_cv_vcs_checkout=yes])
- AS_IF([test -d ".git"],[ac_cv_vcs_checkout=yes])
- ],[
- ac_cv_vcs_checkout=no
+AC_DEFUN([AX_VCS_SYSTEM],
+ [AC_PREREQ([2.63])dnl
+ AC_CACHE_CHECK([for vcs system], [ac_cv_vcs_system],
+ [ac_cv_vcs_system="none"
+ AS_IF([test -d ".bzr"],[ac_cv_vcs_system="bazaar"])
+ AS_IF([test -d ".svn"],[ac_cv_vcs_system="svn"])
+ AS_IF([test -d ".hg"],[ac_cv_vcs_system="mercurial"])
+ AS_IF([test -d ".git"],[ac_cv_vcs_system="git"])
])
+ AC_DEFINE_UNQUOTED([VCS_SYSTEM],["$ac_cv_vcs_system"],[VCS system])
+ ])
+
+AC_DEFUN([AX_VCS_CHECKOUT],
+ [AC_PREREQ([2.63])dnl
+ AC_REQUIRE([AX_VCS_SYSTEM])
+ AC_CACHE_CHECK([for vcs checkout],[ac_cv_vcs_checkout],
+ [AS_IF([test "x$ac_cv_vcs_system" != "xnone"],
+ [ac_cv_vcs_checkout=yes],
+ [ac_cv_vcs_checkout=no])
+ ])
+
+ AM_CONDITIONAL([IS_VCS_CHECKOUT], [test "x$ac_cv_vcs_checkout" = "xyes"])
+ AS_IF([test "x$ac_cv_vcs_checkout" = "xyes"],[AC_DEFINE([VCS_CHECKOUT],[1],[Define if the code was built from VCS.])],
+ [AC_DEFINE([VCS_CHECKOUT],[0],[Define if the code was built from VCS.])])
])
diff --git a/m4/have_cinttypes.m4 b/m4/have_cinttypes.m4
index 6d03cf5d..3ba1316a 100644
--- a/m4/have_cinttypes.m4
+++ b/m4/have_cinttypes.m4
@@ -4,7 +4,7 @@
#
# SYNOPSIS
#
-# AX_CXX_CINTTYPES
+# AX_CXX_CINTTYPES()
#
# DESCRIPTION
#
@@ -48,7 +48,7 @@ AC_DEFUN([AX_CXX_CINTTYPES], [
AC_REQUIRE([AX_CXX_CSTDINT])
AC_CACHE_CHECK([for location of cinttypes], [ac_cv_cxx_cinttypes], [
- save_CXXFLAGS="${CXXFLAGS}"
+ AX_SAVE_FLAGS
CXXFLAGS="${CXX_STANDARD} ${CXXFLAGS}"
AC_LANG_PUSH([C++])
@@ -73,7 +73,7 @@ AC_DEFUN([AX_CXX_CINTTYPES], [
[ac_cxx_cinttypes_boost_cinttypes_hpp="<boost/cinttypes.hpp>"])
AC_LANG_POP
- CXXFLAGS="${save_CXXFLAGS}"
+ AX_RESTORE_FLAGS
AS_IF([test -n "$ac_cxx_cinttypes_cinttypes"], [ac_cv_cxx_cinttypes=$ac_cxx_cinttypes_cinttypes],
[test -n "$ac_cxx_cinttypes_tr1_cinttypes"], [ac_cv_cxx_cinttypes=$ac_cxx_cinttypes_tr1_cinttypes],
diff --git a/m4/have_cstdint.m4 b/m4/have_cstdint.m4
index 685d4ade..11d9616f 100644
--- a/m4/have_cstdint.m4
+++ b/m4/have_cstdint.m4
@@ -4,7 +4,7 @@
#
# SYNOPSIS
#
-# AX_CXX_CSTDINT
+# AX_CXX_CSTDINT()
#
# DESCRIPTION
#
@@ -49,7 +49,7 @@ AC_DEFUN([AX_CXX_CSTDINT], [
AC_CACHE_CHECK([for location of cstdint], [ac_cv_cxx_cstdint], [
AC_LANG_PUSH([C++])
- save_CXXFLAGS="${CXXFLAGS}"
+ AX_SAVE_FLAGS
CXXFLAGS="${CXX_STANDARD} ${CXXFLAGS}"
AC_COMPILE_IFELSE([
@@ -65,16 +65,14 @@ AC_DEFUN([AX_CXX_CSTDINT], [
[ac_cxx_cstdint_boost_cstdint_hpp="<boost/cstdint.hpp>"])
AC_LANG_POP
- CXXFLAGS="${save_CXXFLAGS}"
+ AX_RESTORE_FLAGS
AS_IF([test -n "$ac_cxx_cstdint_cstdint"], [ac_cv_cxx_cstdint=$ac_cxx_cstdint_cstdint],
[test -n "$ac_cxx_cstdint_tr1_cstdint"], [ac_cv_cxx_cstdint=$ac_cxx_cstdint_tr1_cstdint],
[test -n "$ac_cxx_cstdint_boost_cstdint_hpp"], [ac_cv_cxx_cstdint=$ac_cxx_cstdint_boost_cstdint_hpp])
])
- AS_IF([test -n "$ac_cv_cxx_cstdint"], [
- AC_MSG_RESULT([$ac_cv_cxx_cstdint])
- ],[
+ AS_IF([test -n "$ac_cv_cxx_cstdint"], [AC_MSG_RESULT([$ac_cv_cxx_cstdint])], [
ac_cv_cxx_cstdint="<stdint.h>"
AC_MSG_WARN([Could not find a cstdint header.])
AC_MSG_RESULT([$ac_cv_cxx_cstdint])
diff --git a/m4/socket_send_flags.m4 b/m4/socket_send_flags.m4
index 2501f03e..5c1c7470 100644
--- a/m4/socket_send_flags.m4
+++ b/m4/socket_send_flags.m4
@@ -1,5 +1,5 @@
-dnl Copyright (C) 2012 Data Differential LLC
-dnl Copyright (C) 2011 Trond Norbye
+dnl Copyright (C) 2012 Data Differential LLC
+dnl Copyright (C) 2011 Trond Norbye
dnl This file is free software; Trond Norbye
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -7,36 +7,35 @@ dnl ---------------------------------------------------------------------------
dnl Macro: SOCKET_SEND_FLAGS
dnl ---------------------------------------------------------------------------
-AC_DEFUN([SOCKET_SEND_FLAGS],
-[
+AC_DEFUN([SOCKET_SEND_FLAGS],[
AC_CACHE_CHECK([for MSG_NOSIGNAL], [ac_cv_msg_nosignal], [
AC_LANG_PUSH([C])
- save_CFLAGS="$CFLAGS"
+ AX_SAVE_FLAGS
CFLAGS="$CFLAGS -I${srcdir}"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <netdb.h>], [ int flags= MSG_NOSIGNAL ])], [ac_cv_msg_nosignal="yes"])
AC_LANG_POP
- CFLAGS="$save_CFLAGS"
+ AX_RESTORE_FLAGS
])
AC_CACHE_CHECK([for MSG_DONTWAIT], [ac_cv_msg_dontwait], [
AC_LANG_PUSH([C])
- save_CFLAGS="$CFLAGS"
+ AX_SAVE_FLAGS
CFLAGS="$CFLAGS -I${srcdir}"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <netdb.h>], [ int flags= MSG_DONTWAIT ])], [ac_cv_msg_dontwait="yes"])
AC_LANG_POP
- CFLAGS="$save_CFLAGS"
+ AX_RESTORE_FLAGS
])
AC_CACHE_CHECK([for MSG_MORE], [ac_cv_msg_more], [
AC_LANG_PUSH([C])
- save_CFLAGS="$CFLAGS"
+ AX_SAVE_FLAGS
CFLAGS="$CFLAGS -I${srcdir}"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <netdb.h>], [ int flags= MSG_MORE ])], [ac_cv_msg_more="yes"])
AC_LANG_POP
- CFLAGS="$save_CFLAGS"
+ AX_RESTORE_FLAGS
])
AS_IF([test "x$ac_cv_msg_nosignal" = "xyes"],[ AC_DEFINE(HAVE_MSG_NOSIGNAL, 1, [Define to 1 if you have a MSG_NOSIGNAL])])
diff --git a/man/include.am b/man/include.am
index 46ef9338..621fd612 100644
--- a/man/include.am
+++ b/man/include.am
@@ -4,122 +4,134 @@
if HAVE_RECENT_SPHINX
-man_MANS+= man/hashkit_clone.3
-man_MANS+= man/hashkit_crc32.3
-man_MANS+= man/hashkit_create.3
-man_MANS+= man/hashkit_fnv1_32.3
-man_MANS+= man/hashkit_fnv1_64.3
-man_MANS+= man/hashkit_fnv1a_32.3
-man_MANS+= man/hashkit_fnv1a_64.3
-man_MANS+= man/hashkit_free.3
-man_MANS+= man/hashkit_functions.3
-man_MANS+= man/hashkit_hsieh.3
-man_MANS+= man/hashkit_is_allocated.3
-man_MANS+= man/hashkit_jenkins.3
-man_MANS+= man/hashkit_md5.3
-man_MANS+= man/hashkit_murmur.3
-man_MANS+= man/hashkit_value.3
-man_MANS+= man/libhashkit.3
-man_MANS+= man/libmemcached.3
-man_MANS+= man/libmemcached_examples.3
-man_MANS+= man/libmemcachedutil.3
-man_MANS+= man/memaslap.1
-man_MANS+= man/memcached_add.3
-man_MANS+= man/memcached_add_by_key.3
-man_MANS+= man/memcached_analyze.3
-man_MANS+= man/memcached_append.3
-man_MANS+= man/memcached_append_by_key.3
-man_MANS+= man/memcached_behavior_get.3
-man_MANS+= man/memcached_behavior_set.3
-man_MANS+= man/memcached_callback_get.3
-man_MANS+= man/memcached_callback_set.3
-man_MANS+= man/memcached_cas.3
-man_MANS+= man/memcached_cas_by_key.3
-man_MANS+= man/memcached_clone.3
-man_MANS+= man/memcached_create.3
-man_MANS+= man/memcached_decrement.3
-man_MANS+= man/memcached_decrement_with_initial.3
-man_MANS+= man/memcached_delete.3
-man_MANS+= man/memcached_delete_by_key.3
-man_MANS+= man/libmemcached_check_configuration.3
-man_MANS+= man/libmemcached_configuration.3
-man_MANS+= man/memcached.3
-man_MANS+= man/memcached_destroy_sasl_auth_data.3
-man_MANS+= man/memcached_dump.3
-man_MANS+= man/memcached_exist.3
-man_MANS+= man/memcached_exist_by_key.3
-man_MANS+= man/memcached_fetch.3
-man_MANS+= man/memcached_fetch_execute.3
-man_MANS+= man/memcached_fetch_result.3
-man_MANS+= man/memcached_flush_buffers.3
-man_MANS+= man/memcached_free.3
-man_MANS+= man/memcached_generate_hash.3
-man_MANS+= man/memcached_generate_hash_value.3
-man_MANS+= man/memcached_get.3
-man_MANS+= man/memcached_get_by_key.3
-man_MANS+= man/memcached_get_memory_allocators.3
-man_MANS+= man/memcached_get_sasl_callbacks.3
-man_MANS+= man/memcached_get_user_data.3
-man_MANS+= man/memcached_increment.3
-man_MANS+= man/memcached_increment_with_initial.3
-man_MANS+= man/memcached_lib_version.3
-man_MANS+= man/memcached_mget.3
-man_MANS+= man/memcached_mget_by_key.3
-man_MANS+= man/memcached_mget_execute.3
-man_MANS+= man/memcached_mget_execute_by_key.3
-man_MANS+= man/memcached_pool.3
-man_MANS+= man/memcached_pool_behavior_get.3
-man_MANS+= man/memcached_pool_behavior_set.3
-man_MANS+= man/memcached_pool_create.3
-man_MANS+= man/memcached_pool_destroy.3
-man_MANS+= man/memcached_pool_fetch.3
-man_MANS+= man/memcached_pool_pop.3
-man_MANS+= man/memcached_pool_push.3
-man_MANS+= man/memcached_pool_release.3
-man_MANS+= man/memcached_pool_st.3
-man_MANS+= man/memcached_prepend.3
-man_MANS+= man/memcached_prepend_by_key.3
-man_MANS+= man/memcached_quit.3
-man_MANS+= man/memcached_replace.3
-man_MANS+= man/memcached_replace_by_key.3
-man_MANS+= man/memcached_last_error_message.3
-man_MANS+= man/memcached_sasl_set_auth_data.3
-man_MANS+= man/memcached_server_add.3
-man_MANS+= man/memcached_server_count.3
-man_MANS+= man/memcached_server_cursor.3
-man_MANS+= man/memcached_server_list.3
-man_MANS+= man/memcached_server_list_append.3
-man_MANS+= man/memcached_server_list_count.3
-man_MANS+= man/memcached_server_list_free.3
-man_MANS+= man/memcached_server_push.3
-man_MANS+= man/memcached_servers_parse.3
-man_MANS+= man/memcached_set.3
-man_MANS+= man/memcached_set_by_key.3
-man_MANS+= man/memcached_set_memory_allocators.3
-man_MANS+= man/memcached_set_sasl_callbacks.3
-man_MANS+= man/memcached_set_user_data.3
-man_MANS+= man/memcached_stat.3
-man_MANS+= man/memcached_stat_execute.3
-man_MANS+= man/memcached_stat_get_keys.3
-man_MANS+= man/memcached_stat_get_value.3
-man_MANS+= man/memcached_stat_servername.3
-man_MANS+= man/memcached_strerror.3
-man_MANS+= man/memcached_touch.3
-man_MANS+= man/memcached_touch_by_key.3
-man_MANS+= man/memcached_verbosity.3
-man_MANS+= man/memcached_version.3
-man_MANS+= man/memcapable.1
-man_MANS+= man/memexist.1
-man_MANS+= man/memparse.1
-man_MANS+= man/memping.1
-man_MANS+= man/memcat.1
-man_MANS+= man/memcp.1
-man_MANS+= man/memdump.1
-man_MANS+= man/memtouch.1
-man_MANS+= man/memerror.1
-man_MANS+= man/memflush.1
-man_MANS+= man/memrm.1
-man_MANS+= man/memslap.1
-man_MANS+= man/memstat.1
+if IS_VCS_CHECKOUT
+
+dist-hook: man
+
+# Build rule for documentation
+$(dist_man_MANS): man
+
+endif
+
+BUILT_SOURCES+= $(dist_man_MANS)
+
+dist_man_MANS+= man/memaslap.1
+dist_man_MANS+= man/memcapable.1
+dist_man_MANS+= man/memcat.1
+dist_man_MANS+= man/memcp.1
+dist_man_MANS+= man/memdump.1
+dist_man_MANS+= man/memerror.1
+dist_man_MANS+= man/memexist.1
+dist_man_MANS+= man/memflush.1
+dist_man_MANS+= man/memparse.1
+dist_man_MANS+= man/memping.1
+dist_man_MANS+= man/memrm.1
+dist_man_MANS+= man/memslap.1
+dist_man_MANS+= man/memstat.1
+dist_man_MANS+= man/memtouch.1
+
+dist_man_MANS+= man/hashkit_clone.3
+dist_man_MANS+= man/hashkit_crc32.3
+dist_man_MANS+= man/hashkit_create.3
+dist_man_MANS+= man/hashkit_fnv1_32.3
+dist_man_MANS+= man/hashkit_fnv1_64.3
+dist_man_MANS+= man/hashkit_fnv1a_32.3
+dist_man_MANS+= man/hashkit_fnv1a_64.3
+dist_man_MANS+= man/hashkit_free.3
+dist_man_MANS+= man/hashkit_functions.3
+dist_man_MANS+= man/hashkit_hsieh.3
+dist_man_MANS+= man/hashkit_is_allocated.3
+dist_man_MANS+= man/hashkit_jenkins.3
+dist_man_MANS+= man/hashkit_md5.3
+dist_man_MANS+= man/hashkit_murmur.3
+dist_man_MANS+= man/hashkit_value.3
+dist_man_MANS+= man/libhashkit.3
+dist_man_MANS+= man/libmemcached.3
+dist_man_MANS+= man/libmemcached_check_configuration.3
+dist_man_MANS+= man/libmemcached_configuration.3
+dist_man_MANS+= man/libmemcached_examples.3
+dist_man_MANS+= man/libmemcachedutil.3
+dist_man_MANS+= man/memcached.3
+dist_man_MANS+= man/memcached_add.3
+dist_man_MANS+= man/memcached_add_by_key.3
+dist_man_MANS+= man/memcached_analyze.3
+dist_man_MANS+= man/memcached_append.3
+dist_man_MANS+= man/memcached_append_by_key.3
+dist_man_MANS+= man/memcached_behavior_get.3
+dist_man_MANS+= man/memcached_behavior_set.3
+dist_man_MANS+= man/memcached_callback_get.3
+dist_man_MANS+= man/memcached_callback_set.3
+dist_man_MANS+= man/memcached_cas.3
+dist_man_MANS+= man/memcached_cas_by_key.3
+dist_man_MANS+= man/memcached_clone.3
+dist_man_MANS+= man/memcached_create.3
+dist_man_MANS+= man/memcached_decrement.3
+dist_man_MANS+= man/memcached_decrement_with_initial.3
+dist_man_MANS+= man/memcached_delete.3
+dist_man_MANS+= man/memcached_delete_by_key.3
+dist_man_MANS+= man/memcached_destroy_sasl_auth_data.3
+dist_man_MANS+= man/memcached_dump.3
+dist_man_MANS+= man/memcached_exist.3
+dist_man_MANS+= man/memcached_exist_by_key.3
+dist_man_MANS+= man/memcached_fetch.3
+dist_man_MANS+= man/memcached_fetch_execute.3
+dist_man_MANS+= man/memcached_fetch_result.3
+dist_man_MANS+= man/memcached_flush_buffers.3
+dist_man_MANS+= man/memcached_free.3
+dist_man_MANS+= man/memcached_generate_hash.3
+dist_man_MANS+= man/memcached_generate_hash_value.3
+dist_man_MANS+= man/memcached_get.3
+dist_man_MANS+= man/memcached_get_by_key.3
+dist_man_MANS+= man/memcached_get_memory_allocators.3
+dist_man_MANS+= man/memcached_get_sasl_callbacks.3
+dist_man_MANS+= man/memcached_get_user_data.3
+dist_man_MANS+= man/memcached_increment.3
+dist_man_MANS+= man/memcached_increment_with_initial.3
+dist_man_MANS+= man/memcached_last_error_message.3
+dist_man_MANS+= man/memcached_lib_version.3
+dist_man_MANS+= man/memcached_mget.3
+dist_man_MANS+= man/memcached_mget_by_key.3
+dist_man_MANS+= man/memcached_mget_execute.3
+dist_man_MANS+= man/memcached_mget_execute_by_key.3
+dist_man_MANS+= man/memcached_pool.3
+dist_man_MANS+= man/memcached_pool_behavior_get.3
+dist_man_MANS+= man/memcached_pool_behavior_set.3
+dist_man_MANS+= man/memcached_pool_create.3
+dist_man_MANS+= man/memcached_pool_destroy.3
+dist_man_MANS+= man/memcached_pool_fetch.3
+dist_man_MANS+= man/memcached_pool_pop.3
+dist_man_MANS+= man/memcached_pool_push.3
+dist_man_MANS+= man/memcached_pool_release.3
+dist_man_MANS+= man/memcached_pool_st.3
+dist_man_MANS+= man/memcached_prepend.3
+dist_man_MANS+= man/memcached_prepend_by_key.3
+dist_man_MANS+= man/memcached_quit.3
+dist_man_MANS+= man/memcached_replace.3
+dist_man_MANS+= man/memcached_replace_by_key.3
+dist_man_MANS+= man/memcached_sasl_set_auth_data.3
+dist_man_MANS+= man/memcached_server_add.3
+dist_man_MANS+= man/memcached_server_count.3
+dist_man_MANS+= man/memcached_server_cursor.3
+dist_man_MANS+= man/memcached_server_list.3
+dist_man_MANS+= man/memcached_server_list_append.3
+dist_man_MANS+= man/memcached_server_list_count.3
+dist_man_MANS+= man/memcached_server_list_free.3
+dist_man_MANS+= man/memcached_server_push.3
+dist_man_MANS+= man/memcached_servers_parse.3
+dist_man_MANS+= man/memcached_set.3
+dist_man_MANS+= man/memcached_set_by_key.3
+dist_man_MANS+= man/memcached_set_memory_allocators.3
+dist_man_MANS+= man/memcached_set_sasl_callbacks.3
+dist_man_MANS+= man/memcached_set_user_data.3
+dist_man_MANS+= man/memcached_stat.3
+dist_man_MANS+= man/memcached_stat_execute.3
+dist_man_MANS+= man/memcached_stat_get_keys.3
+dist_man_MANS+= man/memcached_stat_get_value.3
+dist_man_MANS+= man/memcached_stat_servername.3
+dist_man_MANS+= man/memcached_strerror.3
+dist_man_MANS+= man/memcached_touch.3
+dist_man_MANS+= man/memcached_touch_by_key.3
+dist_man_MANS+= man/memcached_verbosity.3
+dist_man_MANS+= man/memcached_version.3
endif
diff --git a/poll/poll.c b/poll/poll.c
index c5aa1115..d7a7d9c7 100644
--- a/poll/poll.c
+++ b/poll/poll.c
@@ -9,9 +9,17 @@
*
*/
#include "config.h"
+
+#if defined(WIN32) || defined(__MINGW32__)
+# include <winsock2.h>
+# include <ws2tcpip.h>
+#endif
+
#include <sys/time.h>
#include <strings.h>
+#include "poll/poll.h"
+
int poll(struct pollfd fds[], nfds_t nfds, int tmo)
{
fd_set readfds, writefds, errorfds;
diff --git a/support/libmemcached.spec.in b/support/libmemcached.spec.in
index 6660ac5d..1530ee5c 100644
--- a/support/libmemcached.spec.in
+++ b/support/libmemcached.spec.in
@@ -113,18 +113,14 @@ you will need to install %{name}-devel.
%exclude %{_libdir}/libmemcached.la
%exclude %{_libdir}/libhashkit.la
%exclude %{_libdir}/libmemcachedutil.la
-%exclude %{_libdir}/libmemcachedprotocol.la
%exclude %{_libdir}/libmemcached.a
%exclude %{_libdir}/libhashkit.a
%exclude %{_libdir}/libmemcachedutil.a
-%exclude %{_libdir}/libmemcachedprotocol.a
%{_libdir}/libhashkit.so.2.0.0
%{_libdir}/libmemcached.so.11.0.0
%{_libdir}/libmemcachedutil.so.2.0.0
-%{_libdir}/libmemcachedprotocol.so.0.0.0
%{_libdir}/libhashkit.so.2
%{_libdir}/libmemcached.so.11
-%{_libdir}/libmemcachedprotocol.so.0
%{_libdir}/libmemcachedutil.so.2
%{_mandir}/man1/memaslap.1.gz
%{_mandir}/man1/memcapable.1.gz
@@ -160,11 +156,6 @@ you will need to install %{name}-devel.
%{_includedir}/libhashkit-1.0/types.h
%{_includedir}/libhashkit-1.0/visibility.h
-%{_includedir}/libmemcachedprotocol-0.0/binary.h
-%{_includedir}/libmemcachedprotocol-0.0/callback.h
-%{_includedir}/libmemcachedprotocol-0.0/handler.h
-%{_includedir}/libmemcachedprotocol-0.0/vbucket.h
-
%{_includedir}/libmemcachedutil-1.0/util.h
%{_includedir}/libmemcachedutil-1.0/flush.h
%{_includedir}/libmemcachedutil-1.0/pid.h
@@ -239,7 +230,6 @@ you will need to install %{name}-devel.
%{_libdir}/libhashkit.so
%{_libdir}/libmemcached.so
-%{_libdir}/libmemcachedprotocol.so
%{_libdir}/libmemcachedutil.so
%{_libdir}/pkgconfig/libmemcached.pc
%{_mandir}/man3/hashkit_clone.3.gz
diff --git a/tests/cpp_example.cc b/tests/cpp_example.cc
index f84af759..c490ac2d 100644
--- a/tests/cpp_example.cc
+++ b/tests/cpp_example.cc
@@ -1,7 +1,7 @@
/*
* An example file showing the usage of the C++ libmemcached interface.
*/
-#include <config.h>
+#include <mem_config.h>
#include <vector>
#include <string>
diff --git a/tests/cycle.cc b/tests/cycle.cc
index 904d4312..3865eeb5 100644
--- a/tests/cycle.cc
+++ b/tests/cycle.cc
@@ -39,7 +39,7 @@
Test that we are cycling the servers we are creating during testing.
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
using namespace libtest;
@@ -57,6 +57,8 @@ static test_return_t server_startup_single_TEST(void *obj)
static test_return_t server_startup_multiple_TEST(void *obj)
{
+ test_skip(true, jenkins_is_caller());
+
server_startup_st *servers= (server_startup_st*)obj;
for (size_t x= 0; x < 10; x++)
{
@@ -118,6 +120,12 @@ collection_st collection[] ={
static void *world_create(server_startup_st& servers, test_return_t& error)
{
+ if (jenkins_is_caller())
+ {
+ error= TEST_SKIPPED;
+ return NULL;
+ }
+
if (libtest::has_memcached() == false)
{
error= TEST_SKIPPED;
diff --git a/tests/failure.cc b/tests/failure.cc
index fe96745d..5bc2d118 100644
--- a/tests/failure.cc
+++ b/tests/failure.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
/*
C++ interface test
diff --git a/tests/hash_plus.cc b/tests/hash_plus.cc
index 257a42ec..1fb2ef2a 100644
--- a/tests/hash_plus.cc
+++ b/tests/hash_plus.cc
@@ -2,7 +2,7 @@
C++ to libhashkit
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
diff --git a/tests/hashkit_functions.cc b/tests/hashkit_functions.cc
index b45be3ae..1e9ec7bd 100644
--- a/tests/hashkit_functions.cc
+++ b/tests/hashkit_functions.cc
@@ -35,7 +35,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
using namespace libtest;
diff --git a/tests/libmemcached-1.0/all_tests.cc b/tests/libmemcached-1.0/all_tests.cc
index aaa89c0a..a471d89a 100644
--- a/tests/libmemcached-1.0/all_tests.cc
+++ b/tests/libmemcached-1.0/all_tests.cc
@@ -35,7 +35,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
#include "tests/basic.h"
diff --git a/tests/libmemcached-1.0/all_tests.h b/tests/libmemcached-1.0/all_tests.h
index 25fda094..74e619d2 100644
--- a/tests/libmemcached-1.0/all_tests.h
+++ b/tests/libmemcached-1.0/all_tests.h
@@ -278,6 +278,8 @@ test_st regression_tests[]= {
{"lp:994772", true, (test_callback_fn*)regression_994772_TEST },
{"lp:1009493", true, (test_callback_fn*)regression_1009493_TEST },
{"lp:1021819", true, (test_callback_fn*)regression_1021819_TEST },
+ {"lp:1048945", true, (test_callback_fn*)regression_1048945_TEST },
+ {"lp:1067242", true, (test_callback_fn*)regression_1067242_TEST },
{0, false, (test_callback_fn*)0}
};
diff --git a/tests/libmemcached-1.0/all_tests_socket.cc b/tests/libmemcached-1.0/all_tests_socket.cc
index 47ab67eb..8321754d 100644
--- a/tests/libmemcached-1.0/all_tests_socket.cc
+++ b/tests/libmemcached-1.0/all_tests_socket.cc
@@ -35,7 +35,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
#include "tests/basic.h"
diff --git a/tests/libmemcached-1.0/atomsmasher.cc b/tests/libmemcached-1.0/atomsmasher.cc
index 5a82833a..72f68f2e 100644
--- a/tests/libmemcached-1.0/atomsmasher.cc
+++ b/tests/libmemcached-1.0/atomsmasher.cc
@@ -12,7 +12,7 @@
/*
Sample test application.
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
diff --git a/tests/libmemcached-1.0/basic.cc b/tests/libmemcached-1.0/basic.cc
index 24754270..fddb7218 100644
--- a/tests/libmemcached-1.0/basic.cc
+++ b/tests/libmemcached-1.0/basic.cc
@@ -35,7 +35,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
#include <libmemcached-1.2/memcached.h>
diff --git a/tests/libmemcached-1.0/callback_counter.cc b/tests/libmemcached-1.0/callback_counter.cc
index 76b08814..468ae846 100644
--- a/tests/libmemcached-1.0/callback_counter.cc
+++ b/tests/libmemcached-1.0/callback_counter.cc
@@ -35,7 +35,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
#include "tests/libmemcached-1.0/callback_counter.h"
diff --git a/tests/libmemcached-1.0/callbacks.cc b/tests/libmemcached-1.0/callbacks.cc
index 72b2f974..13d1b468 100644
--- a/tests/libmemcached-1.0/callbacks.cc
+++ b/tests/libmemcached-1.0/callbacks.cc
@@ -35,7 +35,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
#include <tests/callbacks.h>
diff --git a/tests/libmemcached-1.0/debug.cc b/tests/libmemcached-1.0/debug.cc
index 5110d199..3af0542b 100644
--- a/tests/libmemcached-1.0/debug.cc
+++ b/tests/libmemcached-1.0/debug.cc
@@ -35,7 +35,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
#include <climits>
diff --git a/tests/libmemcached-1.0/deprecated.cc b/tests/libmemcached-1.0/deprecated.cc
index e0932ca5..3016dadb 100644
--- a/tests/libmemcached-1.0/deprecated.cc
+++ b/tests/libmemcached-1.0/deprecated.cc
@@ -35,7 +35,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
#include <libmemcached-1.2/memcached.h>
diff --git a/tests/libmemcached-1.0/dump.cc b/tests/libmemcached-1.0/dump.cc
index aa693f3d..a04a2c93 100644
--- a/tests/libmemcached-1.0/dump.cc
+++ b/tests/libmemcached-1.0/dump.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <cstdlib>
#include <climits>
diff --git a/tests/libmemcached-1.0/encoding_key.cc b/tests/libmemcached-1.0/encoding_key.cc
index dddd122a..98804bb5 100644
--- a/tests/libmemcached-1.0/encoding_key.cc
+++ b/tests/libmemcached-1.0/encoding_key.cc
@@ -35,7 +35,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
#include <libmemcached-1.2/memcached.h>
diff --git a/tests/libmemcached-1.0/error_conditions.cc b/tests/libmemcached-1.0/error_conditions.cc
index 18fa1883..2b082a01 100644
--- a/tests/libmemcached-1.0/error_conditions.cc
+++ b/tests/libmemcached-1.0/error_conditions.cc
@@ -35,7 +35,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
#define BUILDING_LIBMEMCACHED
diff --git a/tests/libmemcached-1.0/exist.cc b/tests/libmemcached-1.0/exist.cc
index 7d1178ff..37495b0a 100644
--- a/tests/libmemcached-1.0/exist.cc
+++ b/tests/libmemcached-1.0/exist.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
#include <tests/exist.h>
diff --git a/tests/libmemcached-1.0/fetch_all_results.cc b/tests/libmemcached-1.0/fetch_all_results.cc
index 2ce4dc2f..aaad9edd 100644
--- a/tests/libmemcached-1.0/fetch_all_results.cc
+++ b/tests/libmemcached-1.0/fetch_all_results.cc
@@ -35,7 +35,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
#include <tests/libmemcached-1.0/fetch_all_results.h>
diff --git a/tests/libmemcached-1.0/generate.cc b/tests/libmemcached-1.0/generate.cc
index 7c19265c..4b3de418 100644
--- a/tests/libmemcached-1.0/generate.cc
+++ b/tests/libmemcached-1.0/generate.cc
@@ -35,7 +35,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
#include <libmemcachedutil-1.2/util.h>
diff --git a/tests/libmemcached-1.0/haldenbrand.cc b/tests/libmemcached-1.0/haldenbrand.cc
index a48b346a..cdc476ab 100644
--- a/tests/libmemcached-1.0/haldenbrand.cc
+++ b/tests/libmemcached-1.0/haldenbrand.cc
@@ -35,7 +35,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
#include "tests/libmemcached-1.0/haldenbrand.h"
diff --git a/tests/libmemcached-1.0/include.am b/tests/libmemcached-1.0/include.am
index e5f00b9b..6ffc2986 100644
--- a/tests/libmemcached-1.0/include.am
+++ b/tests/libmemcached-1.0/include.am
@@ -171,6 +171,9 @@ noinst_PROGRAMS+= tests/libmemcached-1.0/testsocket
test-socket: tests/libmemcached-1.0/testsocket
@tests/libmemcached-1.0/testsocket
+gdb-socket: tests/libmemcached-1.0/testsocket
+ @$(DEBUG_COMMAND) tests/libmemcached-1.0/testsocket
+
tests_libmemcached_1_0_sasl_SOURCES=
tests_libmemcached_1_0_sasl_DEPENDENCIES=
tests_libmemcached_1_0_sasl_LDADD=
diff --git a/tests/libmemcached-1.0/internals.cc b/tests/libmemcached-1.0/internals.cc
index 89d51413..7aff7db8 100644
--- a/tests/libmemcached-1.0/internals.cc
+++ b/tests/libmemcached-1.0/internals.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
using namespace libtest;
diff --git a/tests/libmemcached-1.0/ketama.cc b/tests/libmemcached-1.0/ketama.cc
index 12e78501..9e56fe91 100644
--- a/tests/libmemcached-1.0/ketama.cc
+++ b/tests/libmemcached-1.0/ketama.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
#include <libmemcached-1.2/memcached.h>
diff --git a/tests/libmemcached-1.0/mem_functions.cc b/tests/libmemcached-1.0/mem_functions.cc
index b83ebb86..66144a3a 100644
--- a/tests/libmemcached-1.0/mem_functions.cc
+++ b/tests/libmemcached-1.0/mem_functions.cc
@@ -35,7 +35,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
#if defined(HAVE_LIBUUID) && HAVE_LIBUUID
@@ -823,6 +823,34 @@ test_return_t memcached_add_SUCCESS_TEST(memcached_st *memc)
return TEST_SUCCESS;
}
+test_return_t regression_1067242_TEST(memcached_st *memc)
+{
+ test_compare(MEMCACHED_SUCCESS, memcached_set(memc,
+ test_literal_param(__func__),
+ test_literal_param("-2"),
+ 0, 0));
+
+ memcached_return_t rc;
+ char* value;
+ test_true((value= memcached_get(memc, test_literal_param(__func__), NULL, NULL, &rc)));
+ test_compare(MEMCACHED_SUCCESS, rc);
+ free(value);
+
+ for (size_t x= 0; x < 10; x++)
+ {
+ uint64_t new_number;
+ test_compare(MEMCACHED_CLIENT_ERROR,
+ memcached_increment(memc,
+ test_literal_param(__func__), 1, &new_number));
+ test_compare(MEMCACHED_CLIENT_ERROR, memcached_last_error(memc));
+ test_true((value= memcached_get(memc, test_literal_param(__func__), NULL, NULL, &rc)));
+ test_compare(MEMCACHED_SUCCESS, rc);
+ free(value);
+ }
+
+ return TEST_SUCCESS;
+}
+
/*
Set the value, then quit to make sure it is flushed.
Come back in and test that add fails.
@@ -1845,6 +1873,34 @@ test_return_t add_host_test(memcached_st *memc)
return TEST_SUCCESS;
}
+test_return_t regression_1048945_TEST(memcached_st*)
+{
+ memcached_return_t status;
+
+ memcached_server_st* list= memcached_server_list_append_with_weight(NULL, "a", 11211, 0, &status);
+ test_compare(status, MEMCACHED_SUCCESS);
+
+ list= memcached_server_list_append_with_weight(list, "b", 11211, 0, &status);
+ test_compare(status, MEMCACHED_SUCCESS);
+
+ list= memcached_server_list_append_with_weight(list, "c", 11211, 0, &status);
+ test_compare(status, MEMCACHED_SUCCESS);
+
+ memcached_st* memc= memcached_create(NULL);
+
+ status= memcached_server_push(memc, list);
+ memcached_server_list_free(list);
+ test_compare(status, MEMCACHED_SUCCESS);
+
+ memcached_server_instance_st server= memcached_server_by_key(memc, test_literal_param(__func__), &status);
+ test_true(server);
+ test_compare(status, MEMCACHED_SUCCESS);
+
+ memcached_free(memc);
+
+ return TEST_SUCCESS;
+}
+
test_return_t memcached_fetch_result_NOT_FOUND(memcached_st *memc)
{
memcached_return_t rc;
diff --git a/tests/libmemcached-1.0/mem_functions.h b/tests/libmemcached-1.0/mem_functions.h
index 5d433aa5..104d44ee 100644
--- a/tests/libmemcached-1.0/mem_functions.h
+++ b/tests/libmemcached-1.0/mem_functions.h
@@ -179,3 +179,5 @@ test_return_t kill_HUP_TEST(memcached_st *memc);
test_return_t regression_996813_TEST(memcached_st*);
test_return_t regression_994772_TEST(memcached_st*);
test_return_t regression_1009493_TEST(memcached_st*);
+test_return_t regression_1048945_TEST(memcached_st*);
+test_return_t regression_1067242_TEST(memcached_st*);
diff --git a/tests/libmemcached-1.0/memcached_fetch_execute.cc b/tests/libmemcached-1.0/memcached_fetch_execute.cc
index 6296cff7..20ab0387 100644
--- a/tests/libmemcached-1.0/memcached_fetch_execute.cc
+++ b/tests/libmemcached-1.0/memcached_fetch_execute.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
#include <libmemcached-1.2/memcached.h>
diff --git a/tests/libmemcached-1.0/memcached_get.cc b/tests/libmemcached-1.0/memcached_get.cc
index 08fef67f..38f114c0 100644
--- a/tests/libmemcached-1.0/memcached_get.cc
+++ b/tests/libmemcached-1.0/memcached_get.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
/*
diff --git a/tests/libmemcached-1.0/namespace.cc b/tests/libmemcached-1.0/namespace.cc
index dd19143e..6510a755 100644
--- a/tests/libmemcached-1.0/namespace.cc
+++ b/tests/libmemcached-1.0/namespace.cc
@@ -35,7 +35,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
using namespace libtest;
diff --git a/tests/libmemcached-1.0/parser.cc b/tests/libmemcached-1.0/parser.cc
index ec0e2304..f93ea266 100644
--- a/tests/libmemcached-1.0/parser.cc
+++ b/tests/libmemcached-1.0/parser.cc
@@ -35,7 +35,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
using namespace libtest;
diff --git a/tests/libmemcached-1.0/plus.cpp b/tests/libmemcached-1.0/plus.cpp
index ed14c104..ff6a5ab0 100644
--- a/tests/libmemcached-1.0/plus.cpp
+++ b/tests/libmemcached-1.0/plus.cpp
@@ -35,7 +35,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
/*
C++ interface test
diff --git a/tests/libmemcached-1.0/pool.cc b/tests/libmemcached-1.0/pool.cc
index 75920e04..fcb47d95 100644
--- a/tests/libmemcached-1.0/pool.cc
+++ b/tests/libmemcached-1.0/pool.cc
@@ -35,7 +35,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
using namespace libtest;
diff --git a/tests/libmemcached-1.0/print.cc b/tests/libmemcached-1.0/print.cc
index e738aa04..a05901d0 100644
--- a/tests/libmemcached-1.0/print.cc
+++ b/tests/libmemcached-1.0/print.cc
@@ -35,7 +35,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
using namespace libtest;
diff --git a/tests/libmemcached-1.0/replication.cc b/tests/libmemcached-1.0/replication.cc
index f23c2f49..1439228b 100644
--- a/tests/libmemcached-1.0/replication.cc
+++ b/tests/libmemcached-1.0/replication.cc
@@ -35,7 +35,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
using namespace libtest;
diff --git a/tests/libmemcached-1.0/sasl.cc b/tests/libmemcached-1.0/sasl.cc
index 6f0bd7ac..fbda1cfe 100644
--- a/tests/libmemcached-1.0/sasl.cc
+++ b/tests/libmemcached-1.0/sasl.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
using namespace libtest;
diff --git a/tests/libmemcached-1.0/server_add.cc b/tests/libmemcached-1.0/server_add.cc
index 0c36ea3c..ca952b69 100644
--- a/tests/libmemcached-1.0/server_add.cc
+++ b/tests/libmemcached-1.0/server_add.cc
@@ -35,7 +35,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
using namespace libtest;
diff --git a/tests/libmemcached-1.0/setup_and_teardowns.cc b/tests/libmemcached-1.0/setup_and_teardowns.cc
index 49fea874..493bbb21 100644
--- a/tests/libmemcached-1.0/setup_and_teardowns.cc
+++ b/tests/libmemcached-1.0/setup_and_teardowns.cc
@@ -35,7 +35,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
#include <libmemcachedutil-1.2/util.h>
diff --git a/tests/libmemcached-1.0/stat.cc b/tests/libmemcached-1.0/stat.cc
index bb2bf271..dc993c98 100644
--- a/tests/libmemcached-1.0/stat.cc
+++ b/tests/libmemcached-1.0/stat.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <cstdlib>
#include <climits>
diff --git a/tests/libmemcached-1.0/string.cc b/tests/libmemcached-1.0/string.cc
index 529c7015..0458da5a 100644
--- a/tests/libmemcached-1.0/string.cc
+++ b/tests/libmemcached-1.0/string.cc
@@ -38,7 +38,7 @@
// We let libmemcached/common.h define config since we are looking at
// library internals.
-#include <config.h>
+#include <mem_config.h>
#include <libmemcached-1.2/memcached.h>
diff --git a/tests/libmemcached-1.0/touch.cc b/tests/libmemcached-1.0/touch.cc
index 751137f6..2fbddc67 100644
--- a/tests/libmemcached-1.0/touch.cc
+++ b/tests/libmemcached-1.0/touch.cc
@@ -35,7 +35,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
using namespace libtest;
diff --git a/tests/libmemcached-1.0/virtual_buckets.cc b/tests/libmemcached-1.0/virtual_buckets.cc
index 5348fbb3..f48479b2 100644
--- a/tests/libmemcached-1.0/virtual_buckets.cc
+++ b/tests/libmemcached-1.0/virtual_buckets.cc
@@ -35,7 +35,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
using namespace libtest;
diff --git a/tests/mem_udp.cc b/tests/mem_udp.cc
index a6eedfd5..dcc0bee1 100644
--- a/tests/mem_udp.cc
+++ b/tests/mem_udp.cc
@@ -40,7 +40,7 @@
Sample test application.
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
using namespace libtest;
diff --git a/tests/memcapable.cc b/tests/memcapable.cc
index 647a6341..795fb6f8 100644
--- a/tests/memcapable.cc
+++ b/tests/memcapable.cc
@@ -39,7 +39,7 @@
Test that we are cycling the servers we are creating during testing.
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
#include <libmemcached-1.2/memcached.h>
diff --git a/tests/memcat.cc b/tests/memcat.cc
index 9144fed3..6664bf66 100644
--- a/tests/memcat.cc
+++ b/tests/memcat.cc
@@ -39,7 +39,7 @@
Test that we are cycling the servers we are creating during testing.
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
#include <libmemcached-1.2/memcached.h>
diff --git a/tests/memcp.cc b/tests/memcp.cc
index 27562067..64f17847 100644
--- a/tests/memcp.cc
+++ b/tests/memcp.cc
@@ -39,7 +39,7 @@
Test that we are cycling the servers we are creating during testing.
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
#include <libmemcached-1.2/memcached.h>
diff --git a/tests/memdump.cc b/tests/memdump.cc
index cc4d0023..0d04ea28 100644
--- a/tests/memdump.cc
+++ b/tests/memdump.cc
@@ -39,7 +39,7 @@
Test that we are cycling the servers we are creating during testing.
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
#include <libmemcached-1.2/memcached.h>
@@ -67,7 +67,7 @@ static test_return_t server_test(void *)
snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port()));
const char *args[]= { buffer, 0 };
- test_compare(EXIT_SUCCESS, exec_cmdline(executable, args, true));
+ test_true(exec_cmdline(executable, args, true) <= EXIT_FAILURE);
return TEST_SUCCESS;
}
@@ -91,7 +91,7 @@ static test_return_t FOUND_test(void *)
test_null(memcached_get(memc, test_literal_param("foo"), 0, 0, &rc));
test_compare(MEMCACHED_SUCCESS, rc);
- test_compare(EXIT_SUCCESS, exec_cmdline(executable, args, true));
+ test_true(exec_cmdline(executable, args, true) <= EXIT_FAILURE);
memcached_free(memc);
@@ -121,6 +121,7 @@ static void *world_create(server_startup_st& servers, test_return_t& error)
if (server_startup(servers, "memcached", libtest::default_port(), 0, NULL) == false)
{
error= TEST_FAILURE;
+ return NULL;
}
return &servers;
diff --git a/tests/memerror.cc b/tests/memerror.cc
index b2f90e19..d9628612 100644
--- a/tests/memerror.cc
+++ b/tests/memerror.cc
@@ -39,7 +39,7 @@
Test that we are cycling the servers we are creating during testing.
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
#include <libmemcached-1.2/memcached.h>
diff --git a/tests/memexist.cc b/tests/memexist.cc
index f34b2efe..b2db6e53 100644
--- a/tests/memexist.cc
+++ b/tests/memexist.cc
@@ -39,7 +39,7 @@
Test that we are cycling the servers we are creating during testing.
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
#include <libmemcached-1.2/memcached.h>
diff --git a/tests/memflush.cc b/tests/memflush.cc
index 5a0bb2e3..f3d9c6f9 100644
--- a/tests/memflush.cc
+++ b/tests/memflush.cc
@@ -39,7 +39,7 @@
Test that we are cycling the servers we are creating during testing.
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
#include <libmemcached-1.2/memcached.h>
diff --git a/tests/memrm.cc b/tests/memrm.cc
index d47b58e7..798dd56a 100644
--- a/tests/memrm.cc
+++ b/tests/memrm.cc
@@ -39,7 +39,7 @@
Test that we are cycling the servers we are creating during testing.
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
#include <libmemcached-1.2/memcached.h>
diff --git a/tests/memslap.cc b/tests/memslap.cc
index 3925029a..9dfeca8d 100644
--- a/tests/memslap.cc
+++ b/tests/memslap.cc
@@ -39,7 +39,7 @@
Test that we are cycling the servers we are creating during testing.
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
#include <libmemcached-1.2/memcached.h>
diff --git a/tests/memstat.cc b/tests/memstat.cc
index 57c6a587..2607afdf 100644
--- a/tests/memstat.cc
+++ b/tests/memstat.cc
@@ -39,7 +39,7 @@
Test that we are cycling the servers we are creating during testing.
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
#include <libmemcached-1.2/memcached.h>
diff --git a/tests/memtouch.cc b/tests/memtouch.cc
index bffe48e0..9d55d8c0 100644
--- a/tests/memtouch.cc
+++ b/tests/memtouch.cc
@@ -39,7 +39,7 @@
Test that we are cycling the servers we are creating during testing.
*/
-#include <config.h>
+#include <mem_config.h>
#include <libtest/test.hpp>
#include <libmemcached-1.2/memcached.h>
diff --git a/tests/parser.cc b/tests/parser.cc
index 15dab12b..b4da1dff 100644
--- a/tests/parser.cc
+++ b/tests/parser.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
/*
C++ interface test
diff --git a/util/daemon.cc b/util/daemon.cc
index 68393297..90e29efb 100644
--- a/util/daemon.cc
+++ b/util/daemon.cc
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-#include <config.h>
+#include <mem_config.h>
#if defined __SUNPRO_C || defined __DECC || defined __HP_cc
# pragma ident "@(#)$Header: /cvsroot/wikipedia/willow/src/bin/willow/daemon.c,v 1.1 2005/05/02 19:15:21 kateturner Exp $"
diff --git a/util/instance.cc b/util/instance.cc
index 8b9f5ee9..a1665f36 100644
--- a/util/instance.cc
+++ b/util/instance.cc
@@ -36,7 +36,7 @@
*/
-#include <config.h>
+#include <mem_config.h>
#include "util/instance.hpp"
diff --git a/util/instance.hpp b/util/instance.hpp
index bd9aeaa4..1855ef8d 100644
--- a/util/instance.hpp
+++ b/util/instance.hpp
@@ -37,7 +37,6 @@
#pragma once
-#include <arpa/inet.h>
#include <cstdio>
#include <cerrno>
#include <cassert>
diff --git a/util/operation.cc b/util/operation.cc
index def31a6b..3b84a278 100644
--- a/util/operation.cc
+++ b/util/operation.cc
@@ -36,7 +36,7 @@
*/
-#include <config.h>
+#include <mem_config.h>
#include "util/operation.hpp"
#include <string>
diff --git a/util/signal.cc b/util/signal.cc
index 6eda5645..8e63016f 100644
--- a/util/signal.cc
+++ b/util/signal.cc
@@ -34,7 +34,7 @@
*
*/
-#include <config.h>
+#include <mem_config.h>
#include <cassert>
#include <cerrno>
diff --git a/win32/wrappers.h b/win32/wrappers.h
index 80b44651..976303cb 100644
--- a/win32/wrappers.h
+++ b/win32/wrappers.h
@@ -29,17 +29,42 @@
* WinSock use a separate range for error codes. Let's just map to the
* WinSock ones.
*/
-#define EADDRINUSE WSAEADDRINUSE
-#define EWOULDBLOCK WSAEWOULDBLOCK
-#define EINPROGRESS WSAEINPROGRESS
-#define EALREADY WSAEALREADY
-#define EISCONN WSAEISCONN
-#define ENOTCONN WSAENOTCONN
-#define ENOBUFS WSAENOBUFS
-#define SHUT_RDWR SD_BOTH
+#ifndef EADDRINUSE
+# define EADDRINUSE WSAEADDRINUSE
+#endif
+
+#ifndef EWOULDBLOCK
+# define EWOULDBLOCK WSAEWOULDBLOCK
+#endif
+
+#ifndef EINPROGRESS
+# define EINPROGRESS WSAEINPROGRESS
+#endif
+
+#ifndef EALREADY
+# define EALREADY WSAEALREADY
+#endif
+
+#ifndef EISCONN
+# define EISCONN WSAEISCONN
+#endif
+
+#ifndef ENOTCONN
+# define ENOTCONN WSAENOTCONN
+#endif
+
+#ifndef ENOBUFS
+# define ENOBUFS WSAENOBUFS
+#endif
+
+#ifndef SHUT_RDWR
+# define SHUT_RDWR SD_BOTH
+#endif
/* EAI_SYSTEM isn't defined anywhere... just set it to... 11? */
-#define EAI_SYSTEM 11
+#ifndef EAI_SYSTEM
+# define EAI_SYSTEM 11
+#endif
/* Best effort mapping of functions to alternative functions */
#define index(a,b) strchr(a,b)