aboutsummaryrefslogtreecommitdiffstats
path: root/sdk/other/memdup.c
blob: af1f3cff12ac4a94997f8f2ddb14c60f6efe89bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
 * Duplicate object into a memory pool.
 * $Id$
 * Copyright (c) 1997 by Tycho Softworks.
 * For conditions of distribution and reuse see product license.
 */

#include <std/string.h>
#include <other/memory.h>

void    *memdup(void *obj, size_t size)
{
        void    *new = (void *)malloc(size);

        if(!new)
                return NULL;

        memcpy(new, obj, size);
        return new;
}