musl-strndupa.patch 662 B

12345678910111213141516171819
  1. --- src/unstrip.c.orig 2017-04-27 14:26:26.000000000 +0000
  2. +++ src/unstrip.c 2017-05-05 15:51:33.515154220 +0000
  3. @@ -56,6 +56,15 @@
  4. # define _(str) gettext (str)
  5. #endif
  6. +#ifndef strndupa
  7. +#define strndupa(s, n) \
  8. + (__extension__ ({const char *__in = (s); \
  9. + size_t __len = strnlen (__in, (n)) + 1; \
  10. + char *__out = (char *) alloca (__len); \
  11. + __out[__len-1] = '\0'; \
  12. + (char *) memcpy (__out, __in, __len-1);}))
  13. +#endif
  14. +
  15. /* Name and version of program. */
  16. ARGP_PROGRAM_VERSION_HOOK_DEF = print_version;