]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/lib/posix_wrap/limits.h (SHRT_MAX): New define.
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sun, 29 Jan 2012 22:27:31 +0000 (23:27 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sun, 29 Jan 2012 22:27:31 +0000 (23:27 +0100)
(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.

ChangeLog
grub-core/lib/posix_wrap/limits.h
grub-core/lib/posix_wrap/stdio.h
grub-core/lib/posix_wrap/stdlib.h
grub-core/lib/posix_wrap/string.h
include/grub/types.h

index 943c433724e744675ecefc8689efb13246d73862..4ff81bbebf56746cd63fb026884e680f373fe143 100644 (file)
--- a/ChangeLog
+++ b/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>
 
        * grub-core/gnulib/regcomp.c (regerror): Don't use abort on
index fe8523e685f8a9ecef462da097ebb2412463c1fb..588e5899a6a1aa8434f9dac0154c0c4e8bc1e3f5 100644 (file)
@@ -26,6 +26,9 @@
 #define UINT_MAX GRUB_UINT_MAX
 #define ULONG_MAX GRUB_ULONG_MAX
 
+#define SHRT_MAX GRUB_SHRT_MAX
+#define INT_MAX GRUB_INT_MAX
+
 #define CHAR_BIT 8
 
 #endif
index 701fceaa48a307ba05d49a0699d474479707e182..e6b1178c5b33d60b732842b878dcd507ee7cd900 100644 (file)
@@ -26,4 +26,17 @@ typedef struct grub_file FILE;
 
 #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
index 31fe055a727c0d7b214f8592f758832f34dad3de..3b46f47ff5040d1f3cd5e838e664b1c9125e29b1 100644 (file)
@@ -46,4 +46,10 @@ realloc (void *ptr, grub_size_t size)
   return grub_realloc (ptr, size);
 }
 
+static inline int
+abs (int c)
+{
+  return (c >= 0) ? c : -c;
+}
+
 #endif
index f38c97ba4e980114c439d85b7a163b163a482cfd..7e18b1a04c41f69cb3fac897f8548da342d82cff 100644 (file)
@@ -45,6 +45,55 @@ memcpy (void *dest, const void *src, grub_size_t n)
 {
   return grub_memcpy (dest, src, n);
 }
+
+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
index 89c1697d22333ecdfe2e1cefd3aba2c488063c7f..94badaa1d851a2acbedda7151eac739dddb09741 100644 (file)
@@ -121,7 +121,9 @@ typedef grub_int32_t        grub_ssize_t;
 
 #define GRUB_UCHAR_MAX 0xFF
 #define GRUB_USHRT_MAX 65535
+#define GRUB_SHRT_MAX 0x7fff
 #define GRUB_UINT_MAX 4294967295U
+#define GRUB_INT_MAX 0x7fffffff
 
 #if GRUB_CPU_SIZEOF_LONG == 8
 # define GRUB_ULONG_MAX 18446744073709551615UL