@@ -18,10 +18,11 @@ #include #include #include #include +#include #if defined(OF_APPLE_RUNTIME) # import #endif @@ -409,5 +410,19 @@ of_dimension(width, height) }; return rectangle; } + +static OF_INLINE char* +of_strdup(const char *string) +{ + char *copy; + size_t length = strlen(string); + + if ((copy = malloc(length + 1)) == NULL) + return NULL; + + memcpy(copy, string, length + 1); + + return copy; +}