Fix hang/crash when requesting ZPOOL with incorrect backing device
[grub2/phcoder.git] / script / lua / grub_lua.h
bloba181b52f1fe3a641e3bfa574c63c8dbcfc056405
1 /*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2009 Free Software Foundation, Inc.
5 * GRUB is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef GRUB_LUA_HEADER
20 #define GRUB_LUA_HEADER 1
22 #include <grub/types.h>
23 #include <grub/mm.h>
24 #include <grub/err.h>
25 #include <grub/misc.h>
26 #include <grub/setjmp.h>
28 #define INT_MAX GRUB_LONG_MAX
29 #define UCHAR_MAX 255
30 #define SHRT_MAX 32767
32 #undef UNUSED
33 #define UNUSED (void)
35 #define memcpy grub_memcpy
36 #define memcmp grub_memcmp
37 #define strcpy grub_strcpy
38 #define strstr grub_strstr
39 #define strchr grub_strchr
40 #define strlen grub_strlen
41 #define strtoul grub_strtoul
42 #define strtod(s,e) grub_strtoul(s,e,0)
43 #define sprintf grub_sprintf
44 #define strncpy grub_strncpy
45 #define strcat grub_strcat
46 #define strncat grub_strncat
47 #define strcoll grub_strcmp
48 #define strcmp grub_strcmp
49 #define tolower grub_tolower
50 #define toupper grub_toupper
52 #define malloc grub_malloc
53 #define realloc grub_realloc
54 #define free grub_free
56 #define exit(a) grub_exit()
57 #define jmp_buf grub_jmp_buf
58 #define setjmp grub_setjmp
59 #define longjmp grub_longjmp
61 #define fputs(s,f) grub_printf(s)
63 #define isdigit grub_isdigit
64 #define isalpha grub_isalpha
65 #define isspace grub_isspace
67 static inline int
68 isalnum (int c)
70 return (isalpha (c) || isdigit (c));
73 static inline int
74 iscntrl (int c)
76 return ((c <= 0x1f) || (c == 0x7f));
79 static inline int
80 strcspn(const char *s1, const char *s2)
82 int size = 0;
84 while (*s1)
86 const char *p = s2;
88 while (*p)
90 if (*s1 == *p)
91 return size;
92 p++;
95 s1++;
96 size++;
99 return size;
102 static inline int
103 abs (int c)
105 return (c >= 0) ? : -c;
108 #endif