forked from rougier/freetype-gl
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplatform.c
More file actions
32 lines (27 loc) · 668 Bytes
/
platform.c
File metadata and controls
32 lines (27 loc) · 668 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* Freetype GL - A C OpenGL Freetype engine
*
* Distributed under the OSI-approved BSD 2-Clause License. See accompanying
* file `LICENSE` for more details.
*/
#include <string.h>
#include "platform.h"
#if defined(_WIN32) || defined(_WIN64)
#include <math.h>
// strndup() is not available on Windows
char *strndup( const char *s1, size_t n)
{
char *copy= (char*)malloc( n+1 );
memcpy( copy, s1, n );
copy[n] = 0;
return copy;
};
#endif
// strndup() was only added in OSX lion
#if defined(__APPLE__)
char *strndup( const char *s1, size_t n)
{
char *copy = calloc( n+1, sizeof(char) );
memcpy( copy, s1, n );
return copy;
};
#endif