git / brickware / marrow.git - 81d366f

(45 minutes ago)commit 7790c99: Meh. Halfway vector implementation. Not happy with the name

tree / ldup.c

ldup.c

raw

/***
 * ldup.c
 */

#include <stdint.h>
#include <stdlib.h>
#include <string.h>

#include "./allocator.h"
#include "./vector.h"


int32_t
ldup(const struct allocator alloc, void **dest, size_t *const length, const void *src, const size_t num, const size_t size)
{
    int32_t rc;

    rc = lensure(alloc, dest, length, 0, num, size);
    if (VEC_OKAY == rc) {
        memcpy(*dest, src, num * size);
    }

    return (rc);
}