Correct PPTP server firewall rules chain.
[tomato/davidwu.git] / release / src / router / lzo / examples / portab.h
blobd8217ed3d2eeb737bae0e5de26424776624a4040
1 /* portab.h -- portability layer
3 This file is part of the LZO real-time data compression library.
5 Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer
6 All Rights Reserved.
8 The LZO library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of
11 the License, or (at your option) any later version.
13 The LZO library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with the LZO library; see the file COPYING.
20 If not, write to the Free Software Foundation, Inc.,
21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 Markus F.X.J. Oberhumer
24 <markus@oberhumer.com>
25 http://www.oberhumer.com/opensource/lzo/
29 #include "lzo/lzoconf.h"
31 #if (LZO_CC_MSC && (_MSC_VER >= 1000 && _MSC_VER < 1200))
32 /* avoid '-W4' warnings in system header files */
33 # pragma warning(disable: 4201 4214 4514)
34 #endif
35 #if (LZO_CC_MSC && (_MSC_VER >= 1300))
36 /* avoid '-Wall' warnings in system header files */
37 # pragma warning(disable: 4163 4255 4820)
38 /* avoid warnings about inlining */
39 # pragma warning(disable: 4710 4711)
40 #endif
41 /* disable silly warnings about using "deprecated" POSIX functions like "fopen" */
42 #if (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 1100))
43 # pragma warning(disable: 1786)
44 #elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 1000))
45 # pragma warning(disable: 1478)
46 #elif (LZO_CC_MSC && (_MSC_VER >= 1400))
47 # pragma warning(disable: 4996)
48 #endif
49 #if (LZO_CC_PELLESC && (__POCC__ >= 290))
50 # pragma warn(disable:2002)
51 #endif
54 /*************************************************************************
56 **************************************************************************/
58 #if defined(LZO_WANT_ACCLIB_GETOPT) || !(defined(LZO_LIBC_ISOC90) || defined(LZO_LIBC_ISOC99))
60 #include "examples/portab_a.h"
62 #else
64 /* On any halfway modern machine we can use the following pure ANSI-C code. */
66 #include <stddef.h>
67 #include <stdlib.h>
68 #include <stdio.h>
69 #include <string.h>
70 #include <ctype.h>
71 #include <time.h>
72 #if defined(CLK_TCK) && !defined(CLOCKS_PER_SEC)
73 # define CLOCKS_PER_SEC CLK_TCK
74 #endif
76 #if defined(WANT_LZO_MALLOC)
77 # define lzo_malloc(a) (malloc(a))
78 # define lzo_free(a) (free(a))
79 #endif
80 #if defined(WANT_LZO_FREAD)
81 # define lzo_fread(f,b,s) (fread(b,1,s,f))
82 # define lzo_fwrite(f,b,s) (fwrite(b,1,s,f))
83 #endif
84 #if defined(WANT_LZO_PCLOCK)
85 # define lzo_pclock_handle_t int
86 # define lzo_pclock_t double
87 # define lzo_pclock_open_default(a) ((void)(a))
88 # define lzo_pclock_close(a) ((void)(a))
89 # define lzo_pclock_read(a,b) *(b) = (clock() / (double)(CLOCKS_PER_SEC))
90 # define lzo_pclock_get_elapsed(a,b,c) (*(c) - *(b))
91 # define lzo_pclock_flush_cpu_cache(a,b) ((void)(a))
92 #endif
93 #if defined(WANT_LZO_WILDARGV)
94 # define lzo_wildargv(a,b) ((void)0)
95 #endif
97 #endif
100 /*************************************************************************
101 // misc
102 **************************************************************************/
104 /* turn on assertions */
105 #undef NDEBUG
106 #include <assert.h>
108 /* just in case */
109 #undef xmalloc
110 #undef xfree
111 #undef xread
112 #undef xwrite
113 #undef xputc
114 #undef xgetc
115 #undef xread32
116 #undef xwrite32
119 #if defined(WANT_XMALLOC)
120 static lzo_voidp xmalloc(lzo_uint len)
122 lzo_voidp p;
123 lzo_uint align = (lzo_uint) sizeof(lzo_align_t);
125 p = (lzo_voidp) lzo_malloc(len > 0 ? len : 1);
126 if (p == NULL)
128 printf("%s: out of memory\n", progname);
129 exit(1);
131 if (len >= align && __lzo_align_gap(p, align) != 0)
133 printf("%s: C library problem: malloc() returned misaligned pointer!\n", progname);
134 exit(1);
136 return p;
138 #endif
141 /* vim:set ts=4 sw=4 et: */