* grub-core/lib/posix_wrap/limits.h (SHRT_MAX): New define.
(INT_MAX): Likewise. * grub-core/lib/posix_wrap/stdio.h (snprintf): New function. * grub-core/lib/posix_wrap/stdlib.h (abs): Likewise. * grub-core/lib/posix_wrap/string.h (memcmp): Likewise. (strcpy): Likewise. (strstr): Likewise. (strchr): Likewise. (strncpy): Likewise. (strcat): Likewise. (strncat): Likewise. (strcoll): Likewise. * include/grub/types.h (GRUB_SHRT_MAX): New define. (GRUB_INT_MAX): Likewise.
This commit is contained in:
parent
db7337a3d3
commit
0b3b3b38bd
6 changed files with 91 additions and 1 deletions
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
||||||
|
2012-01-29 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/lib/posix_wrap/limits.h (SHRT_MAX): New define.
|
||||||
|
(INT_MAX): Likewise.
|
||||||
|
* grub-core/lib/posix_wrap/stdio.h (snprintf): New function.
|
||||||
|
* grub-core/lib/posix_wrap/stdlib.h (abs): Likewise.
|
||||||
|
* grub-core/lib/posix_wrap/string.h (memcmp): Likewise.
|
||||||
|
(strcpy): Likewise.
|
||||||
|
(strstr): Likewise.
|
||||||
|
(strchr): Likewise.
|
||||||
|
(strncpy): Likewise.
|
||||||
|
(strcat): Likewise.
|
||||||
|
(strncat): Likewise.
|
||||||
|
(strcoll): Likewise.
|
||||||
|
* include/grub/types.h (GRUB_SHRT_MAX): New define.
|
||||||
|
(GRUB_INT_MAX): Likewise.
|
||||||
|
|
||||||
2012-01-29 Vladimir Serbinenko <phcoder@gmail.com>
|
2012-01-29 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* grub-core/gnulib/regcomp.c (regerror): Don't use abort on
|
* grub-core/gnulib/regcomp.c (regerror): Don't use abort on
|
||||||
|
|
|
@ -26,6 +26,9 @@
|
||||||
#define UINT_MAX GRUB_UINT_MAX
|
#define UINT_MAX GRUB_UINT_MAX
|
||||||
#define ULONG_MAX GRUB_ULONG_MAX
|
#define ULONG_MAX GRUB_ULONG_MAX
|
||||||
|
|
||||||
|
#define SHRT_MAX GRUB_SHRT_MAX
|
||||||
|
#define INT_MAX GRUB_INT_MAX
|
||||||
|
|
||||||
#define CHAR_BIT 8
|
#define CHAR_BIT 8
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -26,4 +26,17 @@ typedef struct grub_file FILE;
|
||||||
|
|
||||||
#define EOF -1
|
#define EOF -1
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
snprintf (char *str, size_t n, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
va_start (ap, fmt);
|
||||||
|
ret = grub_vsnprintf (str, n, fmt, ap);
|
||||||
|
va_end (ap);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -46,4 +46,10 @@ realloc (void *ptr, grub_size_t size)
|
||||||
return grub_realloc (ptr, size);
|
return grub_realloc (ptr, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
abs (int c)
|
||||||
|
{
|
||||||
|
return (c >= 0) ? c : -c;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -45,6 +45,55 @@ memcpy (void *dest, const void *src, grub_size_t n)
|
||||||
{
|
{
|
||||||
return grub_memcpy (dest, src, n);
|
return grub_memcpy (dest, src, n);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
static inline int
|
||||||
|
memcmp (const void *s1, const void *s2, size_t n)
|
||||||
|
{
|
||||||
|
return grub_memcmp (s1, s2, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static inline char *
|
||||||
|
strcpy (char *dest, const char *src)
|
||||||
|
{
|
||||||
|
return grub_strcpy (dest, src);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline char *
|
||||||
|
strstr (const char *haystack, const char *needle)
|
||||||
|
{
|
||||||
|
return grub_strstr (haystack, needle);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline char *
|
||||||
|
strchr (const char *s, int c)
|
||||||
|
{
|
||||||
|
return grub_strchr (s, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline char *
|
||||||
|
strncpy (char *dest, const char *src, size_t n)
|
||||||
|
{
|
||||||
|
return grub_strncpy (dest, src, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline char *
|
||||||
|
strcat (char *dest, const char *src)
|
||||||
|
{
|
||||||
|
return grub_strcat (dest, src);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline char *
|
||||||
|
strncat (char *dest, const char *src, size_t n)
|
||||||
|
{
|
||||||
|
return grub_strncat (dest, src, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
strcoll (const char *s1, const char *s2)
|
||||||
|
{
|
||||||
|
return grub_strcmp (s1, s2);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -121,7 +121,9 @@ typedef grub_int32_t grub_ssize_t;
|
||||||
|
|
||||||
#define GRUB_UCHAR_MAX 0xFF
|
#define GRUB_UCHAR_MAX 0xFF
|
||||||
#define GRUB_USHRT_MAX 65535
|
#define GRUB_USHRT_MAX 65535
|
||||||
|
#define GRUB_SHRT_MAX 0x7fff
|
||||||
#define GRUB_UINT_MAX 4294967295U
|
#define GRUB_UINT_MAX 4294967295U
|
||||||
|
#define GRUB_INT_MAX 0x7fffffff
|
||||||
|
|
||||||
#if GRUB_CPU_SIZEOF_LONG == 8
|
#if GRUB_CPU_SIZEOF_LONG == 8
|
||||||
# define GRUB_ULONG_MAX 18446744073709551615UL
|
# define GRUB_ULONG_MAX 18446744073709551615UL
|
||||||
|
|
Loading…
Reference in a new issue