mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-10-05 07:38:41 +00:00
Provide strdup() compat
Make strdup() available on all platforms.
This commit is contained in:
parent
ace438e52a
commit
c0dde0fade
3 changed files with 30 additions and 0 deletions
14
app/src/compat.c
Normal file
14
app/src/compat.c
Normal file
|
@ -0,0 +1,14 @@
|
|||
#include "compat.h"
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifndef HAVE_STRDUP
|
||||
char *strdup(const char *s) {
|
||||
size_t size = strlen(s) + 1;
|
||||
char *dup = malloc(size);
|
||||
if (dup) {
|
||||
memcpy(dup, s, size);
|
||||
}
|
||||
return dup;
|
||||
}
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue