Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/xamarin/macdoc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremie Laval <jeremie.laval@gmail.com>2012-04-03 19:30:19 +0400
committerJeremie Laval <jeremie.laval@gmail.com>2012-04-03 19:30:19 +0400
commitf787f5bad4f95020ccadb7f88d4194dc89cf34ab (patch)
treec1362005dba071ad926832bab01730bf685c1406
parent247b9fb76eec25c81a9884f037c52e10b4ea8b7b (diff)
[macdoc] Thanks Mac OS X
-rw-r--r--monostub.m20
1 files changed, 20 insertions, 0 deletions
diff --git a/monostub.m b/monostub.m
index d3ac187..38478a4 100644
--- a/monostub.m
+++ b/monostub.m
@@ -215,6 +215,26 @@ decode_qstring (unsigned char **in, unsigned char qchar)
return value;
}
+/* Taken from http://opensource.apple.com/source/gcc/gcc-5575.11/libiberty/strndup.c
+ * Mac OS X < Lion don't natively implement strndup
+ */
+char *
+strndup (const char *s, size_t n)
+{
+ char *result;
+ size_t len = strlen (s);
+
+ if (n < len)
+ len = n;
+
+ result = (char *) malloc (len + 1);
+ if (!result)
+ return 0;
+
+ result[len] = '\0';
+ return (char *) memcpy (result, s, len);
+}
+
static char **
get_mono_env_options (int *count)
{