/*
 * $Header: /san01/cvs/ashpool/csrc/continuity/mecha/Attic/mem.c,v 1.9 2004/04/30 13:41:56 aleigh Exp $ 
 */

/*
 * Copyright (c) 2004 Alex Leigh, All Rights Reserved
 * 
 * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ALEX LEIGH The copyright
 * notice above does not evidence any actual or intended publication of such
 * source code.
 * 
 * Disclosure, copying, distribution, or transmission of of this code without
 * express permission is prohibited.
 */

#include "mecha.h"

void *memFdup(const void *p, size_t len)
{
    char *a;

    assert(p != NULL);

    /* add an extra byte to put a trailing NULL */
    a = malloc(len + 1);

    assert(a != NULL);

    memFcopy(p, a, len);

    /* add a trailing NULL incase this is a string */
    a[len] = 0;

    return a;
}
