110-compat_macros.patch 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. Index: uClibc-0.9.29/include/string.h
  2. ===================================================================
  3. --- uClibc-0.9.29.orig/include/string.h 2007-12-30 00:44:19.638696968 +0100
  4. +++ uClibc-0.9.29/include/string.h 2007-12-30 01:12:52.097715154 +0100
  5. @@ -320,18 +320,40 @@
  6. /* Find the last occurrence of C in S (same as strrchr). */
  7. extern char *rindex (__const char *__s, int __c)
  8. __THROW __attribute_pure__ __nonnull ((1));
  9. -# else
  10. -# ifdef __UCLIBC_SUSV3_LEGACY_MACROS__
  11. +# elif defined(__UCLIBC_SUSV3_LEGACY_MACROS__) && !defined(_STRINGS_H)
  12. /* bcopy/bzero/bcmp/index/rindex are marked LEGACY in SuSv3.
  13. * They are replaced as proposed by SuSv3. Don't sync this part
  14. * with glibc and keep it in sync with strings.h. */
  15. -# define bcopy(src,dest,n) (memmove((dest), (src), (n)), (void) 0)
  16. -# define bzero(s,n) (memset((s), '\0', (n)), (void) 0)
  17. -# define bcmp(s1,s2,n) memcmp((s1), (s2), (size_t)(n))
  18. -# define index(s,c) strchr((s), (c))
  19. -# define rindex(s,c) strrchr((s), (c))
  20. -# endif
  21. +/* Copy N bytes of SRC to DEST (like memmove, but args reversed). */
  22. +static __inline__ void bcopy (__const void *__src, void *__dest, size_t __n)
  23. +{
  24. + memmove(__dest, __src, __n);
  25. +}
  26. +
  27. +/* Set N bytes of S to 0. */
  28. +static __inline__ void bzero (void *__s, size_t __n)
  29. +{
  30. + memset(__s, 0, __n);
  31. +}
  32. +
  33. +/* Compare N bytes of S1 and S2 (same as memcmp). */
  34. +static __inline__ int bcmp (__const void *__s1, __const void *__s2, size_t __n)
  35. +{
  36. + return memcmp(__s1, __s2, __n);
  37. +}
  38. +
  39. +/* Find the first occurrence of C in S (same as strchr). */
  40. +static __inline__ char *index (__const char *__s, int __c)
  41. +{
  42. + return strchr(__s, __c);
  43. +}
  44. +
  45. +/* Find the last occurrence of C in S (same as strrchr). */
  46. +static __inline__ char *rindex (__const char *__s, int __c)
  47. +{
  48. + return strrchr(__s, __c);
  49. +}
  50. # endif
  51. /* Return the position of the first bit set in I, or 0 if none are set.
  52. Index: uClibc-0.9.29/include/strings.h
  53. ===================================================================
  54. --- uClibc-0.9.29.orig/include/strings.h 2007-12-30 00:49:00.462700217 +0100
  55. +++ uClibc-0.9.29/include/strings.h 2007-12-30 00:52:57.844227820 +0100
  56. @@ -58,11 +58,36 @@
  57. * They are replaced as proposed by SuSv3. Don't sync this part
  58. * with glibc and keep it in sync with string.h. */
  59. -# define bcopy(src,dest,n) (memmove((dest), (src), (n)), (void) 0)
  60. -# define bzero(s,n) (memset((s), '\0', (n)), (void) 0)
  61. -# define bcmp(s1,s2,n) memcmp((s1), (s2), (size_t)(n))
  62. -# define index(s,c) strchr((s), (c))
  63. -# define rindex(s,c) strrchr((s), (c))
  64. +
  65. +/* Copy N bytes of SRC to DEST (like memmove, but args reversed). */
  66. +static __inline__ void bcopy (__const void *__src, void *__dest, size_t __n)
  67. +{
  68. + memmove(__dest, __src, __n);
  69. +}
  70. +
  71. +/* Set N bytes of S to 0. */
  72. +static __inline__ void bzero (void *__s, size_t __n)
  73. +{
  74. + memset(__s, 0, __n);
  75. +}
  76. +
  77. +/* Compare N bytes of S1 and S2 (same as memcmp). */
  78. +static __inline__ int bcmp (__const void *__s1, __const void *__s2, size_t __n)
  79. +{
  80. + return memcmp(__s1, __s2, __n);
  81. +}
  82. +
  83. +/* Find the first occurrence of C in S (same as strchr). */
  84. +static __inline__ char *index (__const char *__s, int __c)
  85. +{
  86. + return strchr(__s, __c);
  87. +}
  88. +
  89. +/* Find the last occurrence of C in S (same as strrchr). */
  90. +static __inline__ char *rindex (__const char *__s, int __c)
  91. +{
  92. + return strrchr(__s, __c);
  93. +}
  94. # endif
  95. # endif