/* * Copyright (C) 2010 Tobias Klauser * * This file is part of nios2sim-ng. * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. */ #include #include #include "nios2sim-ng.h" #include "util.h" /** * Allocate memory which is set to zero. * * @param size requested size of memory in bytes * @return pointer to the allocated and zeroed memory on success, NULL on * error */ void *zalloc(const size_t size) { void *ret = malloc(size); if (likely(ret != NULL)) memset(ret, 0x00, size); return ret; }