From 783c755a8a5886365e2f6b425406432666e3720a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ChangZhuo=20Chen=20=28=E9=99=B3=E6=98=8C=E5=80=AC=29?= Date: Thu, 22 May 2014 22:41:47 +0800 Subject: [PATCH 01/33] Remove auto generated config.h & config.h.in --- config.h | 116 ---------------------------------------------------- config.h.in | 115 --------------------------------------------------- 2 files changed, 231 deletions(-) delete mode 100644 config.h delete mode 100644 config.h.in diff --git a/config.h b/config.h deleted file mode 100644 index 430376f..0000000 --- a/config.h +++ /dev/null @@ -1,116 +0,0 @@ -/* config.h. Generated from config.h.in by configure. */ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* "whether graphviz is enable" */ -#define ENABLE_GRAPHVIZ test "x$enable_graphviz" = "xyes" - -/* Define to 1 if you have the header file. */ -#define HAVE_DLFCN_H 1 - -/* Define to 1 if you have the `gettimeofday' function. */ -#define HAVE_GETTIMEOFDAY 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_JEMALLOC_JEMALLOC_H */ - -/* Define to 1 if your system has a GNU libc compatible `malloc' function, and - to 0 otherwise. */ -#define HAVE_MALLOC 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the `memset' function. */ -#define HAVE_MEMSET 1 - -/* Define to 1 if your system has a GNU libc compatible `realloc' function, - and to 0 otherwise. */ -#define HAVE_REALLOC 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the `strchr' function. */ -#define HAVE_STRCHR 1 - -/* Define to 1 if you have the `strdup' function. */ -#define HAVE_STRDUP 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the `strndup' function. */ -#define HAVE_STRNDUP 1 - -/* Define to 1 if you have the `strstr' function. */ -#define HAVE_STRSTR 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TIME_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#define LT_OBJDIR ".libs/" - -/* Name of package */ -#define PACKAGE "r3" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "r3" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "r3 1.0.0" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "r3" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "1.0.0" - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define to 1 if you have the PATH_MAX macro. */ -/* #undef USE_JEMALLOC */ - -/* Version number of package */ -#define VERSION "1.0.0" - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -/* #undef inline */ -#endif - -/* Define to rpl_malloc if the replacement function should be used. */ -/* #undef malloc */ - -/* Define to rpl_realloc if the replacement function should be used. */ -/* #undef realloc */ - -/* Define to `unsigned int' if does not define. */ -/* #undef size_t */ diff --git a/config.h.in b/config.h.in deleted file mode 100644 index 7ae1a2a..0000000 --- a/config.h.in +++ /dev/null @@ -1,115 +0,0 @@ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* "whether graphviz is enable" */ -#undef ENABLE_GRAPHVIZ - -/* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H - -/* Define to 1 if you have the `gettimeofday' function. */ -#undef HAVE_GETTIMEOFDAY - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_JEMALLOC_JEMALLOC_H - -/* Define to 1 if your system has a GNU libc compatible `malloc' function, and - to 0 otherwise. */ -#undef HAVE_MALLOC - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the `memset' function. */ -#undef HAVE_MEMSET - -/* Define to 1 if your system has a GNU libc compatible `realloc' function, - and to 0 otherwise. */ -#undef HAVE_REALLOC - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the `strchr' function. */ -#undef HAVE_STRCHR - -/* Define to 1 if you have the `strdup' function. */ -#undef HAVE_STRDUP - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the `strndup' function. */ -#undef HAVE_STRNDUP - -/* Define to 1 if you have the `strstr' function. */ -#undef HAVE_STRSTR - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TIME_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#undef LT_OBJDIR - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define to 1 if you have the PATH_MAX macro. */ -#undef USE_JEMALLOC - -/* Version number of package */ -#undef VERSION - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -#undef inline -#endif - -/* Define to rpl_malloc if the replacement function should be used. */ -#undef malloc - -/* Define to rpl_realloc if the replacement function should be used. */ -#undef realloc - -/* Define to `unsigned int' if does not define. */ -#undef size_t From cacfb32d494cb52c4362eff5a2c00c2ebd1add24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ChangZhuo=20Chen=20=28=E9=99=B3=E6=98=8C=E5=80=AC=29?= Date: Thu, 22 May 2014 22:43:55 +0800 Subject: [PATCH 02/33] Remove auto generated install-sh --- install-sh | 527 ----------------------------------------------------- 1 file changed, 527 deletions(-) delete mode 100755 install-sh diff --git a/install-sh b/install-sh deleted file mode 100755 index 377bb86..0000000 --- a/install-sh +++ /dev/null @@ -1,527 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2011-11-20.07; # UTC - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# 'make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. - -nl=' -' -IFS=" "" $nl" - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit=${DOITPROG-} -if test -z "$doit"; then - doit_exec=exec -else - doit_exec=$doit -fi - -# Put in absolute file names if you don't have them in your path; -# or use environment vars. - -chgrpprog=${CHGRPPROG-chgrp} -chmodprog=${CHMODPROG-chmod} -chownprog=${CHOWNPROG-chown} -cmpprog=${CMPPROG-cmp} -cpprog=${CPPROG-cp} -mkdirprog=${MKDIRPROG-mkdir} -mvprog=${MVPROG-mv} -rmprog=${RMPROG-rm} -stripprog=${STRIPPROG-strip} - -posix_glob='?' -initialize_posix_glob=' - test "$posix_glob" != "?" || { - if (set -f) 2>/dev/null; then - posix_glob= - else - posix_glob=: - fi - } -' - -posix_mkdir= - -# Desired mode of installed file. -mode=0755 - -chgrpcmd= -chmodcmd=$chmodprog -chowncmd= -mvcmd=$mvprog -rmcmd="$rmprog -f" -stripcmd= - -src= -dst= -dir_arg= -dst_arg= - -copy_on_change=false -no_target_directory= - -usage="\ -Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: - --help display this help and exit. - --version display version info and exit. - - -c (ignored) - -C install only if different (preserve the last data modification time) - -d create directories instead of installing files. - -g GROUP $chgrpprog installed files to GROUP. - -m MODE $chmodprog installed files to MODE. - -o USER $chownprog installed files to USER. - -s $stripprog installed files. - -t DIRECTORY install into DIRECTORY. - -T report an error if DSTFILE is a directory. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG - RMPROG STRIPPROG -" - -while test $# -ne 0; do - case $1 in - -c) ;; - - -C) copy_on_change=true;; - - -d) dir_arg=true;; - - -g) chgrpcmd="$chgrpprog $2" - shift;; - - --help) echo "$usage"; exit $?;; - - -m) mode=$2 - case $mode in - *' '* | *' '* | *' -'* | *'*'* | *'?'* | *'['*) - echo "$0: invalid mode: $mode" >&2 - exit 1;; - esac - shift;; - - -o) chowncmd="$chownprog $2" - shift;; - - -s) stripcmd=$stripprog;; - - -t) dst_arg=$2 - # Protect names problematic for 'test' and other utilities. - case $dst_arg in - -* | [=\(\)!]) dst_arg=./$dst_arg;; - esac - shift;; - - -T) no_target_directory=true;; - - --version) echo "$0 $scriptversion"; exit $?;; - - --) shift - break;; - - -*) echo "$0: invalid option: $1" >&2 - exit 1;; - - *) break;; - esac - shift -done - -if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then - # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dst_arg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dst_arg" - shift # fnord - fi - shift # arg - dst_arg=$arg - # Protect names problematic for 'test' and other utilities. - case $dst_arg in - -* | [=\(\)!]) dst_arg=./$dst_arg;; - esac - done -fi - -if test $# -eq 0; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call 'install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -if test -z "$dir_arg"; then - do_exit='(exit $ret); exit $ret' - trap "ret=129; $do_exit" 1 - trap "ret=130; $do_exit" 2 - trap "ret=141; $do_exit" 13 - trap "ret=143; $do_exit" 15 - - # Set umask so as not to create temps with too-generous modes. - # However, 'strip' requires both read and write access to temps. - case $mode in - # Optimize common cases. - *644) cp_umask=133;; - *755) cp_umask=22;; - - *[0-7]) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw='% 200' - fi - cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; - *) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw=,u+rw - fi - cp_umask=$mode$u_plus_rw;; - esac -fi - -for src -do - # Protect names problematic for 'test' and other utilities. - case $src in - -* | [=\(\)!]) src=./$src;; - esac - - if test -n "$dir_arg"; then - dst=$src - dstdir=$dst - test -d "$dstdir" - dstdir_status=$? - else - - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dst_arg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - dst=$dst_arg - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dst_arg: Is a directory" >&2 - exit 1 - fi - dstdir=$dst - dst=$dstdir/`basename "$src"` - dstdir_status=0 - else - # Prefer dirname, but fall back on a substitute if dirname fails. - dstdir=` - (dirname "$dst") 2>/dev/null || - expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$dst" : 'X\(//\)[^/]' \| \ - X"$dst" : 'X\(//\)$' \| \ - X"$dst" : 'X\(/\)' \| . 2>/dev/null || - echo X"$dst" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q' - ` - - test -d "$dstdir" - dstdir_status=$? - fi - fi - - obsolete_mkdir_used=false - - if test $dstdir_status != 0; then - case $posix_mkdir in - '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - - # With -d, create the new directory with the user-specified mode. - # Otherwise, rely on $mkdir_umask. - if test -n "$dir_arg"; then - mkdir_mode=-m$mode - else - mkdir_mode= - fi - - posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 - - if (umask $mkdir_umask && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - ls_ld_tmpdir=`ls -ld "$tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/d" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null - fi - trap '' 0;; - esac;; - esac - - if - $posix_mkdir && ( - umask $mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" - ) - then : - else - - # The umask is ridiculous, or mkdir does not conform to POSIX, - # or it failed possibly due to a race condition. Create the - # directory the slow way, step by step, checking for races as we go. - - case $dstdir in - /*) prefix='/';; - [-=\(\)!]*) prefix='./';; - *) prefix='';; - esac - - eval "$initialize_posix_glob" - - oIFS=$IFS - IFS=/ - $posix_glob set -f - set fnord $dstdir - shift - $posix_glob set +f - IFS=$oIFS - - prefixes= - - for d - do - test X"$d" = X && continue - - prefix=$prefix$d - if test -d "$prefix"; then - prefixes= - else - if $posix_mkdir; then - (umask=$mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break - # Don't fail if two instances are running concurrently. - test -d "$prefix" || exit 1 - else - case $prefix in - *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; - *) qprefix=$prefix;; - esac - prefixes="$prefixes '$qprefix'" - fi - fi - prefix=$prefix/ - done - - if test -n "$prefixes"; then - # Don't fail if two instances are running concurrently. - (umask $mkdir_umask && - eval "\$doit_exec \$mkdirprog $prefixes") || - test -d "$dstdir" || exit 1 - obsolete_mkdir_used=true - fi - fi - fi - - if test -n "$dir_arg"; then - { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && - { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || - test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 - else - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - - # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && - { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && - { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && - - # If -C, don't bother to copy if it wouldn't change the file. - if $copy_on_change && - old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && - new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && - - eval "$initialize_posix_glob" && - $posix_glob set -f && - set X $old && old=:$2:$4:$5:$6 && - set X $new && new=:$2:$4:$5:$6 && - $posix_glob set +f && - - test "$old" = "$new" && - $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 - then - rm -f "$dsttmp" - else - # Rename the file to the real destination. - $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || - - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - { - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || - { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } - } || - { echo "$0: cannot unlink or rename $dst" >&2 - (exit 1); exit 1 - } - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dst" - } - fi || exit 1 - - trap '' 0 - fi -done - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: From b8071524907865d2b35036fc04bdef4bb00d0426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ChangZhuo=20Chen=20=28=E9=99=B3=E6=98=8C=E5=80=AC=29?= Date: Thu, 22 May 2014 22:44:06 +0800 Subject: [PATCH 03/33] Remove auto generated test-driver --- test-driver | 139 ---------------------------------------------------- 1 file changed, 139 deletions(-) delete mode 100755 test-driver diff --git a/test-driver b/test-driver deleted file mode 100755 index d306056..0000000 --- a/test-driver +++ /dev/null @@ -1,139 +0,0 @@ -#! /bin/sh -# test-driver - basic testsuite driver script. - -scriptversion=2013-07-13.22; # UTC - -# Copyright (C) 2011-2013 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 2, 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 . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - -# Make unconditional expansion of undefined variables an error. This -# helps a lot in preventing typo-related bugs. -set -u - -usage_error () -{ - echo "$0: $*" >&2 - print_usage >&2 - exit 2 -} - -print_usage () -{ - cat <$log_file 2>&1 -estatus=$? -if test $enable_hard_errors = no && test $estatus -eq 99; then - estatus=1 -fi - -case $estatus:$expect_failure in - 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; - 0:*) col=$grn res=PASS recheck=no gcopy=no;; - 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; - 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; - *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; - *:*) col=$red res=FAIL recheck=yes gcopy=yes;; -esac - -# Report outcome to console. -echo "${col}${res}${std}: $test_name" - -# Register the test result, and other relevant metadata. -echo ":test-result: $res" > $trs_file -echo ":global-test-result: $res" >> $trs_file -echo ":recheck: $recheck" >> $trs_file -echo ":copy-in-global-log: $gcopy" >> $trs_file - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: From fb88655df0098052d7c6d1b36418c31d4dc858d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ChangZhuo=20Chen=20=28=E9=99=B3=E6=98=8C=E5=80=AC=29?= Date: Thu, 22 May 2014 22:53:49 +0800 Subject: [PATCH 04/33] Remove CMake related files --- cmake_modules/FindCheck.cmake | 54 -------------------------------- cmake_modules/FindJemalloc.cmake | 44 -------------------------- cmake_modules/FindJudy.cmake | 37 ---------------------- cmake_modules/FindPCRE.cmake | 37 ---------------------- src/CMakeLists.txt | 17 ---------- tests/CMakeLists.txt | 24 -------------- 6 files changed, 213 deletions(-) delete mode 100644 cmake_modules/FindCheck.cmake delete mode 100644 cmake_modules/FindJemalloc.cmake delete mode 100644 cmake_modules/FindJudy.cmake delete mode 100644 cmake_modules/FindPCRE.cmake delete mode 100644 src/CMakeLists.txt delete mode 100644 tests/CMakeLists.txt diff --git a/cmake_modules/FindCheck.cmake b/cmake_modules/FindCheck.cmake deleted file mode 100644 index 8edcc91..0000000 --- a/cmake_modules/FindCheck.cmake +++ /dev/null @@ -1,54 +0,0 @@ -# - Try to find the CHECK libraries -# Once done this will define -# -# CHECK_FOUND - system has check -# CHECK_INCLUDE_DIRS - the check include directory -# CHECK_LIBRARIES - check library -# -# Copyright (c) 2007 Daniel Gollub -# Copyright (c) 2007-2009 Bjoern Ricks -# -# Redistribution and use is allowed according to the terms of the New -# BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - - -INCLUDE( FindPkgConfig ) - -IF ( Check_FIND_REQUIRED ) - SET( _pkgconfig_REQUIRED "REQUIRED" ) -ELSE( Check_FIND_REQUIRED ) - SET( _pkgconfig_REQUIRED "" ) -ENDIF ( Check_FIND_REQUIRED ) - -IF ( CHECK_MIN_VERSION ) - PKG_SEARCH_MODULE( CHECK ${_pkgconfig_REQUIRED} check>=${CHECK_MIN_VERSION} ) -ELSE ( CHECK_MIN_VERSION ) - PKG_SEARCH_MODULE( CHECK ${_pkgconfig_REQUIRED} check ) -ENDIF ( CHECK_MIN_VERSION ) - -# Look for CHECK include dir and libraries -IF( NOT CHECK_FOUND AND NOT PKG_CONFIG_FOUND ) - - FIND_PATH( CHECK_INCLUDE_DIRS check.h ) - - FIND_LIBRARY( CHECK_LIBRARIES NAMES check ) - - IF ( CHECK_INCLUDE_DIRS AND CHECK_LIBRARIES ) - SET( CHECK_FOUND 1 ) - IF ( NOT Check_FIND_QUIETLY ) - MESSAGE ( STATUS "Found CHECK: ${CHECK_LIBRARIES}" ) - ENDIF ( NOT Check_FIND_QUIETLY ) - ELSE ( CHECK_INCLUDE_DIRS AND CHECK_LIBRARIES ) - IF ( Check_FIND_REQUIRED ) - MESSAGE( FATAL_ERROR "Could NOT find CHECK" ) - ELSE ( Check_FIND_REQUIRED ) - IF ( NOT Check_FIND_QUIETLY ) - MESSAGE( STATUS "Could NOT find CHECK" ) - ENDIF ( NOT Check_FIND_QUIETLY ) - ENDIF ( Check_FIND_REQUIRED ) - ENDIF ( CHECK_INCLUDE_DIRS AND CHECK_LIBRARIES ) -ENDIF( NOT CHECK_FOUND AND NOT PKG_CONFIG_FOUND ) - -# Hide advanced variables from CMake GUIs -MARK_AS_ADVANCED( CHECK_INCLUDE_DIRS CHECK_LIBRARIES ) diff --git a/cmake_modules/FindJemalloc.cmake b/cmake_modules/FindJemalloc.cmake deleted file mode 100644 index c97bb1b..0000000 --- a/cmake_modules/FindJemalloc.cmake +++ /dev/null @@ -1,44 +0,0 @@ -# - Try to find jemalloc headers and libraries. -# -# Usage of this module as follows: -# -# find_package(JeMalloc) -# -# Variables used by this module, they can change the default behaviour and need -# to be set before calling find_package: -# -# JEMALLOC_ROOT_DIR Set this variable to the root installation of -# jemalloc if the module has problems finding -# the proper installation path. -# -# Variables defined by this module: -# -# JEMALLOC_FOUND System has jemalloc libs/headers -# JEMALLOC_LIBRARIES The jemalloc library/libraries -# JEMALLOC_INCLUDE_DIR The location of jemalloc headers - -find_path(JEMALLOC_ROOT_DIR - NAMES include/jemalloc/jemalloc.h -) - -find_library(JEMALLOC_LIBRARIES - NAMES jemalloc - HINTS ${JEMALLOC_ROOT_DIR}/lib -) - -find_path(JEMALLOC_INCLUDE_DIR - NAMES jemalloc/jemalloc.h - HINTS ${JEMALLOC_ROOT_DIR}/include -) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(JeMalloc DEFAULT_MSG - JEMALLOC_LIBRARIES - JEMALLOC_INCLUDE_DIR -) - -mark_as_advanced( - JEMALLOC_ROOT_DIR - JEMALLOC_LIBRARIES - JEMALLOC_INCLUDE_DIR -) diff --git a/cmake_modules/FindJudy.cmake b/cmake_modules/FindJudy.cmake deleted file mode 100644 index 1be69e1..0000000 --- a/cmake_modules/FindJudy.cmake +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright (C) 2007-2009 LuaDist. -# Created by Peter Kapec -# Redistribution and use of this file is allowed according to the terms of the MIT license. -# For details see the COPYRIGHT file distributed with LuaDist. -# Note: -# Searching headers and libraries is very simple and is NOT as powerful as scripts -# distributed with CMake, because LuaDist defines directories to search for. -# Everyone is encouraged to contact the author with improvements. Maybe this file -# becomes part of CMake distribution sometimes. - -# - Find judy -# Find the native Judy headers and libraries. -# -# Judy_INCLUDE_DIRS - where to find judy.h, etc. -# Judy_LIBRARIES - List of libraries when using judy. -# Judy_FOUND - True if judy found. - -# Look for the header file. -FIND_PATH(Judy_INCLUDE_DIR NAMES Judy.h) - -# Look for the library. -FIND_LIBRARY(Judy_LIBRARY NAMES judy) - -# Handle the QUIETLY and REQUIRED arguments and set Judy_FOUND to TRUE if all listed variables are TRUE. -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Judy DEFAULT_MSG Judy_LIBRARY Judy_INCLUDE_DIR) - -# Copy the results to the output variables. -IF(Judy_FOUND) - SET(Judy_LIBRARIES ${Judy_LIBRARY}) - SET(Judy_INCLUDE_DIRS ${Judy_INCLUDE_DIR}) -ELSE(Judy_FOUND) - SET(Judy_LIBRARIES) - SET(Judy_INCLUDE_DIRS) -ENDIF(Judy_FOUND) - -MARK_AS_ADVANCED(Judy_INCLUDE_DIRS Judy_LIBRARIES) diff --git a/cmake_modules/FindPCRE.cmake b/cmake_modules/FindPCRE.cmake deleted file mode 100644 index dbbd60a..0000000 --- a/cmake_modules/FindPCRE.cmake +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright (C) 2007-2009 LuaDist. -# Created by Peter Kapec -# Redistribution and use of this file is allowed according to the terms of the MIT license. -# For details see the COPYRIGHT file distributed with LuaDist. -# Note: -# Searching headers and libraries is very simple and is NOT as powerful as scripts -# distributed with CMake, because LuaDist defines directories to search for. -# Everyone is encouraged to contact the author with improvements. Maybe this file -# becomes part of CMake distribution sometimes. - -# - Find pcre -# Find the native PCRE headers and libraries. -# -# PCRE_INCLUDE_DIRS - where to find pcre.h, etc. -# PCRE_LIBRARIES - List of libraries when using pcre. -# PCRE_FOUND - True if pcre found. - -# Look for the header file. -FIND_PATH(PCRE_INCLUDE_DIR NAMES pcre.h) - -# Look for the library. -FIND_LIBRARY(PCRE_LIBRARY NAMES pcre) - -# Handle the QUIETLY and REQUIRED arguments and set PCRE_FOUND to TRUE if all listed variables are TRUE. -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE DEFAULT_MSG PCRE_LIBRARY PCRE_INCLUDE_DIR) - -# Copy the results to the output variables. -IF(PCRE_FOUND) - SET(PCRE_LIBRARIES ${PCRE_LIBRARY}) - SET(PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR}) -ELSE(PCRE_FOUND) - SET(PCRE_LIBRARIES) - SET(PCRE_INCLUDE_DIRS) -ENDIF(PCRE_FOUND) - -MARK_AS_ADVANCED(PCRE_INCLUDE_DIRS PCRE_LIBRARIES) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt deleted file mode 100644 index 3e0e268..0000000 --- a/src/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8) - -include_directories("${PROJECT_SOURCE_DIR}/include") -# install(TARGETS swiftnav-static DESTINATION lib${LIB_SUFFIX}) - -set(R3_SRCS node.c str.c list.c token.c edge.c zmalloc.c) -set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -Wall -pipe -g3 -funroll-loops -O0") - -# set(LIBS ${LIBS} ${PCRE_LIBRARIES} ${Judy_LIBRARIES} ${Jemalloc_LIBRARIES} r3) -set(LIBS ${LIBS} ${PCRE_LIBRARIES} ${Jemalloc_LIBRARIES} r3) - -# add_library(r3 SHARED ${R3_SRCS}) -add_library(r3 STATIC ${R3_SRCS}) -target_link_libraries(r3 ${LIBS}) -install (TARGETS r3 DESTINATION lib) -# target_link_libraries(r3 cblas) -# install(FILES ${libswiftnav_HEADERS} DESTINATION include/libswiftnav) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt deleted file mode 100644 index 7d8e226..0000000 --- a/tests/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -# set(TEST_LIBS ${TEST_LIBS} ${CHECK_LIBRARIES} judy libr3) -# set(TEST_LIBS ${TEST_LIBS} ${CHECK_LIBRARIES} judy libr3) -find_package(Check REQUIRED) -find_package(PCRE REQUIRED) -# find_package(Judy REQUIRED) - -if (NOT CHECK_FOUND) - message(STATUS "Skipping unit tests, Check library not found!") -else (NOT CHECK_FOUND) - set(TEST_LIBS ${LIBS} ${CHECK_LIBRARIES} ${PCRE_LIBRARIES} r3) - - include_directories(${CHECK_INCLUDE_DIRS}) - # include_directories("${PROJECT_SOURCE_DIR}/include/r2") - add_executable(test_r3 test_tree.c) - target_link_libraries(test_r3 ${TEST_LIBS}) - - add_custom_command( - TARGET test_r3 POST_BUILD - COMMENT "Running unit tests" - COMMAND test_r3 - ) -endif (NOT CHECK_FOUND) - - From 63bf604d9effb51871f4ae4fcfe7a7cd52d5cbdd Mon Sep 17 00:00:00 2001 From: c9s Date: Fri, 23 May 2014 00:21:40 +0800 Subject: [PATCH 05/33] fix request method code --- include/r3.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/r3.h b/include/r3.h index 959aff6..e38029f 100644 --- a/include/r3.h +++ b/include/r3.h @@ -168,7 +168,10 @@ route * r3_tree_match_route(const node *n, match_entry * entry); #define METHOD_GET 2 #define METHOD_POST 2<<1 -#define METHOD_PUT 2<<1 -#define METHOD_DELETE 2<<1 +#define METHOD_PUT 2<<2 +#define METHOD_DELETE 2<<3 +#define METHOD_PATCH 2<<4 +#define METHOD_HEAD 2<<5 +#define METHOD_OPTIONS 2<<6 #endif /* !R3_NODE_H */ From c841de166cc1bf7cb743ad7435615619d64794c5 Mon Sep 17 00:00:00 2001 From: c9s Date: Fri, 23 May 2014 11:14:26 +0800 Subject: [PATCH 06/33] free old pattern --- src/edge.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/edge.c b/src/edge.c index 387ee0c..b89dcb9 100644 --- a/src/edge.c +++ b/src/edge.c @@ -71,9 +71,10 @@ node * r3_edge_branch(edge *e, int dl) { e->child->data = NULL; // truncate the original edge pattern - char *op = e->pattern; + char *oldpattern = e->pattern; e->pattern = zstrndup(e->pattern, dl); e->pattern_len = dl; + zfree(oldpattern); return new_child; } From 59e699795921bab0541c577a5d90c1e9a6faf5f6 Mon Sep 17 00:00:00 2001 From: c9s Date: Fri, 23 May 2014 11:15:57 +0800 Subject: [PATCH 07/33] there is already a pointer guard in zmalloc --- src/edge.c | 4 +--- src/node.c | 16 +++++----------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/edge.c b/src/edge.c index b89dcb9..3f4d646 100644 --- a/src/edge.c +++ b/src/edge.c @@ -80,9 +80,7 @@ node * r3_edge_branch(edge *e, int dl) { } void r3_edge_free(edge * e) { - if (e->pattern) { - zfree(e->pattern); - } + zfree(e->pattern); if ( e->child ) { r3_tree_free(e->child); } diff --git a/src/node.c b/src/node.c index 671974b..c184837 100644 --- a/src/node.c +++ b/src/node.c @@ -70,12 +70,9 @@ void r3_tree_free(node * tree) { r3_edge_free(tree->edges[ i ]); } } - if (tree->edges) { - zfree(tree->edges); - } - if (tree->routes) { - zfree(tree->routes); - } + zfree(tree->edges); + zfree(tree->routes); + if (tree->pcre_pattern) { pcre_free(tree->pcre_pattern); } @@ -84,11 +81,8 @@ void r3_tree_free(node * tree) { pcre_free_study(tree->pcre_extra); } #endif - - if (tree->combined_pattern) - zfree(tree->combined_pattern); - if (tree->ov) - zfree(tree->ov); + zfree(tree->combined_pattern); + zfree(tree->ov); zfree(tree); tree = NULL; } From a41c9187ac988cdcf0ba8aa3b28efcbd0bdfd5b3 Mon Sep 17 00:00:00 2001 From: c9s Date: Fri, 23 May 2014 11:18:15 +0800 Subject: [PATCH 08/33] Add some basic opcode --- include/r3.h | 2 ++ src/str.c | 1 + 2 files changed, 3 insertions(+) diff --git a/include/r3.h b/include/r3.h index e38029f..e6ba33a 100644 --- a/include/r3.h +++ b/include/r3.h @@ -174,4 +174,6 @@ route * r3_tree_match_route(const node *n, match_entry * entry); #define METHOD_HEAD 2<<5 #define METHOD_OPTIONS 2<<6 +enum { OP_EXPECT_DIGITS, OP_EXPECT_WORDS, OP_EXPECT_NOSLASH }; + #endif /* !R3_NODE_H */ diff --git a/src/str.c b/src/str.c index 581cf63..a02da74 100644 --- a/src/str.c +++ b/src/str.c @@ -13,6 +13,7 @@ #include "str_array.h" #include "zmalloc.h" + /** * provide a quick way to count slugs, simply search for '{' */ From 4d93d217a40b88f9841b5c975174c67dfca891c4 Mon Sep 17 00:00:00 2001 From: c9s Date: Fri, 23 May 2014 11:25:25 +0800 Subject: [PATCH 09/33] test r3_pattern_to_opcode --- include/r3.h | 4 +++- src/str.c | 14 ++++++++++++++ tests/check_slug.c | 9 +++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/include/r3.h b/include/r3.h index e6ba33a..2a75460 100644 --- a/include/r3.h +++ b/include/r3.h @@ -174,6 +174,8 @@ route * r3_tree_match_route(const node *n, match_entry * entry); #define METHOD_HEAD 2<<5 #define METHOD_OPTIONS 2<<6 -enum { OP_EXPECT_DIGITS, OP_EXPECT_WORDS, OP_EXPECT_NOSLASH }; +int r3_pattern_to_opcode(char * pattern, int pattern_len); + +enum { OP_EXPECT_DIGITS = 1, OP_EXPECT_WORDS, OP_EXPECT_NOSLASH }; #endif /* !R3_NODE_H */ diff --git a/src/str.c b/src/str.c index a02da74..1d63873 100644 --- a/src/str.c +++ b/src/str.c @@ -13,6 +13,20 @@ #include "str_array.h" #include "zmalloc.h" +int r3_pattern_to_opcode(char * pattern, int pattern_len) { + if ( strncmp(pattern, "\\w+", pattern_len) == 0 ) { + return OP_EXPECT_WORDS; + } + if ( strncmp(pattern, "\\d+", pattern_len) == 0 ) { + return OP_EXPECT_DIGITS; + } + if ( strncmp(pattern, "[^/]+", pattern_len) == 0 ) { + return OP_EXPECT_NOSLASH; + } + return 0; +} + + /** * provide a quick way to count slugs, simply search for '{' diff --git a/tests/check_slug.c b/tests/check_slug.c index 1453fd2..6acb7fa 100644 --- a/tests/check_slug.c +++ b/tests/check_slug.c @@ -13,6 +13,14 @@ #include "str_array.h" #include "zmalloc.h" +START_TEST (test_pattern_to_opcode) +{ + ck_assert( r3_pattern_to_opcode("\\w+", sizeof("\\w+") - 1) == OP_EXPECT_WORDS ); + ck_assert( r3_pattern_to_opcode("\\d+", sizeof("\\d+") - 1) == OP_EXPECT_DIGITS ); + ck_assert( r3_pattern_to_opcode("[^/]+", sizeof("[^/]+") - 1) == OP_EXPECT_NOSLASH ); +} +END_TEST + START_TEST (test_slug_compile) { char * path = "/user/{id}"; @@ -106,6 +114,7 @@ Suite* r3_suite (void) { tcase_add_test(tcase, test_find_slug_placeholder_with_broken_slug); tcase_add_test(tcase, test_slug_count); tcase_add_test(tcase, test_slug_compile); + tcase_add_test(tcase, test_pattern_to_opcode); suite_add_tcase(suite, tcase); return suite; From c1e5ea43930386c4c0275a77a8bb7d7c9c1235c6 Mon Sep 17 00:00:00 2001 From: c9s Date: Fri, 23 May 2014 11:28:19 +0800 Subject: [PATCH 10/33] Add OP_EXPECT_NODASH opcode --- include/r3.h | 2 +- src/str.c | 3 +++ tests/check_slug.c | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/r3.h b/include/r3.h index 2a75460..ecd69e0 100644 --- a/include/r3.h +++ b/include/r3.h @@ -176,6 +176,6 @@ route * r3_tree_match_route(const node *n, match_entry * entry); int r3_pattern_to_opcode(char * pattern, int pattern_len); -enum { OP_EXPECT_DIGITS = 1, OP_EXPECT_WORDS, OP_EXPECT_NOSLASH }; +enum { OP_EXPECT_DIGITS = 1, OP_EXPECT_WORDS, OP_EXPECT_NOSLASH, OP_EXPECT_NODASH }; #endif /* !R3_NODE_H */ diff --git a/src/str.c b/src/str.c index 1d63873..9485b16 100644 --- a/src/str.c +++ b/src/str.c @@ -23,6 +23,9 @@ int r3_pattern_to_opcode(char * pattern, int pattern_len) { if ( strncmp(pattern, "[^/]+", pattern_len) == 0 ) { return OP_EXPECT_NOSLASH; } + if ( strncmp(pattern, "[^-]+", pattern_len) == 0 ) { + return OP_EXPECT_NODASH; + } return 0; } diff --git a/tests/check_slug.c b/tests/check_slug.c index 6acb7fa..64263cb 100644 --- a/tests/check_slug.c +++ b/tests/check_slug.c @@ -18,6 +18,7 @@ START_TEST (test_pattern_to_opcode) ck_assert( r3_pattern_to_opcode("\\w+", sizeof("\\w+") - 1) == OP_EXPECT_WORDS ); ck_assert( r3_pattern_to_opcode("\\d+", sizeof("\\d+") - 1) == OP_EXPECT_DIGITS ); ck_assert( r3_pattern_to_opcode("[^/]+", sizeof("[^/]+") - 1) == OP_EXPECT_NOSLASH ); + ck_assert( r3_pattern_to_opcode("[^-]+", sizeof("[^-]+") - 1) == OP_EXPECT_NODASH ); } END_TEST From 3f4fcb8c27b417dca2fce8f49177c71aef95309f Mon Sep 17 00:00:00 2001 From: c9s Date: Fri, 23 May 2014 11:29:44 +0800 Subject: [PATCH 11/33] remove duplicate header include --- src/node.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/node.c b/src/node.c index c184837..89eb080 100644 --- a/src/node.c +++ b/src/node.c @@ -14,7 +14,6 @@ // #include #include "r3.h" -#include "r3_define.h" #include "r3_str.h" #include "str_array.h" #include "zmalloc.h" From ad6b7b236f56a2a32b9c7955e40ceba2be62e53f Mon Sep 17 00:00:00 2001 From: c9s Date: Fri, 23 May 2014 11:30:15 +0800 Subject: [PATCH 12/33] combined_pattern_len is not used --- include/r3.h | 1 - src/node.c | 1 - 2 files changed, 2 deletions(-) diff --git a/include/r3.h b/include/r3.h index ecd69e0..45bfde8 100644 --- a/include/r3.h +++ b/include/r3.h @@ -41,7 +41,6 @@ struct _node { /* the combined regexp pattern string from pattern_tokens */ char * combined_pattern; - int combined_pattern_len; int ov_cnt; int * ov; pcre * pcre_pattern; diff --git a/src/node.c b/src/node.c index 89eb080..1e98dda 100644 --- a/src/node.c +++ b/src/node.c @@ -194,7 +194,6 @@ void r3_tree_compile_patterns(node * n) { n->combined_pattern = cpat; - n->combined_pattern_len = p - cpat; const char *error; From 93f4654c54a5257e037837bd9ce0134f40ca6346 Mon Sep 17 00:00:00 2001 From: c9s Date: Fri, 23 May 2014 11:31:19 +0800 Subject: [PATCH 13/33] pass studied pattern --- src/node.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/node.c b/src/node.c index 1e98dda..28e1920 100644 --- a/src/node.c +++ b/src/node.c @@ -268,13 +268,11 @@ node * r3_tree_matchl(const node * n, char * path, int path_len, match_entry * e rc = pcre_exec( n->pcre_pattern, /* the compiled pattern */ - - // PCRE Study makes this slow - NULL, // n->pcre_extra, /* no extra data - we didn't study the pattern */ - path, /* the subject string */ - path_len, /* the length of the subject */ - 0, /* start at offset 0 in the subject */ - 0, /* default options */ + n->pcre_extra, + path, /* the subject string */ + path_len, /* the length of the subject */ + 0, /* start at offset 0 in the subject */ + 0, /* default options */ n->ov, /* output vector for substring information */ n->ov_cnt); /* number of elements in the output vector */ From be899b7bcb94155b4a1aa4e1551d725a6273216f Mon Sep 17 00:00:00 2001 From: c9s Date: Fri, 23 May 2014 11:32:28 +0800 Subject: [PATCH 14/33] move bench_str.csv --- bench.html | 2 +- bench_str.csv | 450 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 451 insertions(+), 1 deletion(-) create mode 100644 bench_str.csv diff --git a/bench.html b/bench.html index c0a3de5..9b62e96 100644 --- a/bench.html +++ b/bench.html @@ -9,7 +9,7 @@