/[hydra]/hydra/src/escape.h
ViewVC logotype

Contents of /hydra/src/escape.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (vendor branch)
Sat Sep 21 13:53:16 2002 UTC (21 years, 6 months ago) by nmav
Branch: boas, MAIN
CVS Tags: hydra_0_1_6_without_hic, BOAS_WITH_RANGES_AND_CGI, hydra_0_0_10, start, hydra_0_0_8, hydra_0_0_9, hydra_0_0_2, hydra_0_0_3, hydra_0_0_6, hydra_0_0_7, hydra_0_0_4, hydra_0_0_5, hydra_0_1_3, hydra_0_1_2, hydra_0_1_1, hydra_0_1_0, hydra_0_1_7, hydra_0_1_6, hydra_0_1_4, hydra_0_1_8, HEAD
Branch point for: hydra_0_1_0_patches
Changes since 1.1: +0 -0 lines
File MIME type: text/plain
Imported sources

1 /*
2 * Boa, an http server
3 * Copyright (C) 1995 Paul Phillips <paulp@go2net.com>
4 * Copyright (C) 2001 Jon Nelson <jnelson@boa.org>
5 * Copyright (C) 2001 Larry Doolittle <ldoolitt@boa.org>
6
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 1, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 *
21 */
22
23 /* $Id: escape.h,v 1.1.1.1 2002/09/21 13:53:16 nmav Exp $ */
24
25 #include "config.h"
26
27 /* Highest character number that can possibly be passed through un-escaped */
28 #define NEEDS_ESCAPE_BITS 128
29
30 #ifndef NEEDS_ESCAPE_SHIFT
31 #define NEEDS_ESCAPE_SHIFT 5 /* 1 << 5 is 32 bits */
32 #endif
33
34 #define NEEDS_ESCAPE_WORD_LENGTH (1<<NEEDS_ESCAPE_SHIFT)
35
36 #define NEEDS_ESCAPE_INDEX(c) ((c)>>NEEDS_ESCAPE_SHIFT)
37
38 /* Assume variable shift is fast, otherwise this could be a table lookup */
39 #define NEEDS_ESCAPE_MASK(c) (1<<((c)&(NEEDS_ESCAPE_WORD_LENGTH - 1)))
40
41 /* Newer compilers could use an inline function.
42 * This macro works great, as long as you pass unsigned int or unsigned char.
43 */
44 #define needs_escape(c) ((c)>=NEEDS_ESCAPE_BITS || _needs_escape[NEEDS_ESCAPE_INDEX(c)]&NEEDS_ESCAPE_MASK(c))
45
46 extern unsigned long _needs_escape[(NEEDS_ESCAPE_BITS+NEEDS_ESCAPE_WORD_LENGTH-1)/NEEDS_ESCAPE_WORD_LENGTH];
47 void build_needs_escape(void);

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26