mdbx-windows: add mdbx_strdup() to avoid dependency from CRT.

12 of 17 for https://github.com/leo-yuriev/libmdbx/issues/43

Change-Id: Ib1379d75dc25e34f56daf8988848c41f59b6cd6b
This commit is contained in:
Leonid Yuriev
2018-10-14 11:24:59 +03:00
parent b47badb3ee
commit e229dbe9dc
2 changed files with 15 additions and 6 deletions

View File

@@ -288,6 +288,18 @@ void mdbx_memalign_free(void *ptr) {
}
#endif /* mdbx_memalign_free */
#ifndef mdbx_strdup
char *mdbx_strdup(const char *str) {
if (!str)
return NULL;
size_t bytes = strlen(str) + 1;
char *dup = mdbx_malloc(bytes);
if (dup)
memcpy(dup, str, bytes);
return dup;
}
#endif /* mdbx_strdup */
/*----------------------------------------------------------------------------*/
int mdbx_condmutex_init(mdbx_condmutex_t *condmutex) {