blob: a714387147926f4d39dedfdc1f24e720cf9d68f3 (
plain) (
blame)
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
|
/* See LICENSE file for copyright and license details. */
#include "libsimple.h"
#ifndef TEST
char *
libsimple_aligned_strndup(const char *s, size_t alignment, size_t n) /* TODO test */
{
char *ret;
n = strnlen(s, n);
ret = aligned_alloc(alignment, (n + 1) + (alignment - (n + 1) % alignment) % alignment);
if (!ret)
return NULL;
memcpy(ret, s, n);
ret[n] = '\0';
return ret;
}
#else
#include "test.h"
int
main(void)
{
return 0;
}
#endif
|