diff options
author | Alexey Yakovenko <waker@users.sourceforge.net> | 2013-09-17 18:51:46 +0200 |
---|---|---|
committer | Alexey Yakovenko <waker@users.sourceforge.net> | 2013-09-17 18:53:01 +0200 |
commit | 146d976dec3ce9de80ed311da80c4aa1d9dfa70a (patch) | |
tree | f634a9a41a6eed9a653e7b981afceb5608932d1b /plugins/mms | |
parent | e33f207c2e465b6211873ce24fb1a1959317e63a (diff) |
mms: strndup fix on osx
Diffstat (limited to 'plugins/mms')
-rw-r--r-- | plugins/mms/libmms/uri.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/plugins/mms/libmms/uri.c b/plugins/mms/libmms/uri.c index 6b6475eb..111ca128 100644 --- a/plugins/mms/libmms/uri.c +++ b/plugins/mms/libmms/uri.c @@ -26,6 +26,22 @@ #include "uri.h" #include <string.h> +#ifndef strndup +# define strndup(s, n) ({\ + char *out;\ + char *c = memchr (s, n, 0);\ + if (c) {\ + out = strdup (s);\ + }\ + else {\ + out = malloc (n+1);\ + memcpy (out, s, n);\ + out[n] = 0;\ + }\ + out;\ +}) +#endif + static void field_unescape (char *str); static char* field_escape (char* str, unsigned char mask); |