From 5b6ad615e9c14b29c20b5048a9d37ef40eef051a Mon Sep 17 00:00:00 2001 From: phk Date: Sun, 15 Jun 2008 15:43:21 +0000 Subject: [PATCH] On further consideration: give VCT it's own header file. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2685 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/include/libvarnish.h | 27 -------------- varnish-cache/include/vct.h | 58 ++++++++++++++++++++++++++++++ varnish-cache/lib/libvarnish/vct.c | 2 +- 3 files changed, 59 insertions(+), 28 deletions(-) create mode 100644 varnish-cache/include/vct.h diff --git a/varnish-cache/include/libvarnish.h b/varnish-cache/include/libvarnish.h index ab90e3dd..0f378b25 100644 --- a/varnish-cache/include/libvarnish.h +++ b/varnish-cache/include/libvarnish.h @@ -54,33 +54,6 @@ time_t TIM_parse(const char *p); double TIM_mono(void); double TIM_real(void); -/* from libvarnish/vct.c */ -#define VCT_SP (1<<0) -#define VCT_CRLF (1<<1) -#define VCT_LWS (VCT_CRLF | VCT_SP) -#define VCT_CTL (1<<2) -#define VCT_UALPHA (1<<3) -#define VCT_LOALPHA (1<<4) -#define VCT_DIGIT (1<<5) -#define VCT_HEX (1<<6) - -extern unsigned char vct_typtab[256]; - -static inline int -vct_is(unsigned char x, unsigned char y) -{ - - return (vct_typtab[x] & (y)); -} - -#define vct_issp(x) vct_is(x, VCT_SP) -#define vct_iscrlf(x) vct_is(x, VCT_CRLF) -#define vct_islws(x) vct_is(x, VCT_LWS) -#define vct_isctl(x) vct_is(x, VCT_CTL) - -/* NB: VCT always operate in ASCII, don't replace 0x0d with \r etc. */ -#define vct_skipcrlf(p) (p[0] == 0x0d && p[1] == 0x0a ? 2 : 1) - /* from libvarnish/version.c */ void varnish_version(const char *); diff --git a/varnish-cache/include/vct.h b/varnish-cache/include/vct.h new file mode 100644 index 00000000..6d9a218c --- /dev/null +++ b/varnish-cache/include/vct.h @@ -0,0 +1,58 @@ +/*- + * Copyright (c) 2006 Verdens Gang AS + * Copyright (c) 2006-2008 Linpro AS + * All rights reserved. + * + * Author: Poul-Henning Kamp + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * $Id$ + */ + +/* from libvarnish/vct.c */ + +#define VCT_SP (1<<0) +#define VCT_CRLF (1<<1) +#define VCT_LWS (VCT_CRLF | VCT_SP) +#define VCT_CTL (1<<2) +#define VCT_UALPHA (1<<3) +#define VCT_LOALPHA (1<<4) +#define VCT_DIGIT (1<<5) +#define VCT_HEX (1<<6) + +extern unsigned char vct_typtab[256]; + +static inline int +vct_is(unsigned char x, unsigned char y) +{ + + return (vct_typtab[x] & (y)); +} + +#define vct_issp(x) vct_is(x, VCT_SP) +#define vct_iscrlf(x) vct_is(x, VCT_CRLF) +#define vct_islws(x) vct_is(x, VCT_LWS) +#define vct_isctl(x) vct_is(x, VCT_CTL) + +/* NB: VCT always operate in ASCII, don't replace 0x0d with \r etc. */ +#define vct_skipcrlf(p) (p[0] == 0x0d && p[1] == 0x0a ? 2 : 1) diff --git a/varnish-cache/lib/libvarnish/vct.c b/varnish-cache/lib/libvarnish/vct.c index 4613b775..5e41e0dd 100644 --- a/varnish-cache/lib/libvarnish/vct.c +++ b/varnish-cache/lib/libvarnish/vct.c @@ -30,7 +30,7 @@ * ctype(3) like functions, according to RFC2616 */ -#include +#include /* NB: VCT always operate in ASCII, don't replace 0x0d with \r etc. */ -- 2.39.5