mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
16 lines
287 B
C
16 lines
287 B
C
#include <stdbool.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include "util/mem.h"
|
|
|
|
bool memdup(void *out, const void *src, size_t size) {
|
|
void *dst = malloc(size);
|
|
if (dst == NULL) {
|
|
return false;
|
|
}
|
|
memcpy(dst, src, size);
|
|
void **dst_ptr = out;
|
|
*dst_ptr = dst;
|
|
return true;
|
|
}
|