1PMEMCTO_STRDUP(3) PMDK Programmer's Manual PMEMCTO_STRDUP(3)
2
3
4
6 pmemcto_strdup -- duplicate a string
7
9 #include <libpmemcto.h>
10
11 char *pmemcto_strdup(PMEMctopool *pcp, const char *s);
12
14 The pmemcto_strdup() function provides the same semantics as strdup(3),
15 but operates on the memory pool pcp instead of the process heap sup‐
16 plied by the system. It returns a pointer to a new string which is a
17 duplicate of the string s. Memory for the new string is obtained with
18 pmemcto_malloc(3), on the given memory pool, and can be freed with
19 pmemcto_free(3) on the same memory pool.
20
22 On success, the pmemcto_strdup() function returns a pointer to the du‐
23 plicated string. If pmemcto_strdup() is unable to satisfy the alloca‐
24 tion request, a NULL pointer is returned and errno is set appropriate‐
25 ly.
26
28 ENOMEM Insufficient memory available to allocate duplicated string.
29
31 jemalloc(3), malloc(3), strdup(3), wcsdup(3), pmemcto_malloc(3), pmemc‐
32 to_wcsdup(3), libpmemcto(7) and <http://pmem.io>
33
34
35
36PMDK - libpmemcto API version 1.0 2018-03-13 PMEMCTO_STRDUP(3)