https://github.com/Singular/Sources
Tip revision: 35c6e2c47bae1f858ec6f4a0cdab911b80a1c383 authored by Hans Schoenemann on 22 January 2021, 14:55:14 UTC
fix: map Z, Zn ->Zp, mpz_z ->Zp
fix: map Z, Zn ->Zp, mpz_z ->Zp
Tip revision: 35c6e2c
omAllocEmulate.c
/*******************************************************************
* File: omAllocEmulate.c
* Purpose: implementation of emulated omalloc routines
* Author: obachman (Olaf Bachmann)
* Created: 11/99
*******************************************************************/
#include <stdlib.h>
#include <string.h>
#include "omMalloc.h"
#ifdef OM_EMULATE_OMALLOC
void* omEmulateAlloc0(size_t size)
{
void* addr = OM_MALLOC_MALLOC(size);
memset(addr, 0, size);
return addr;
}
void* omEmulateRealloc0Size(void* o_addr, size_t o_size, size_t n_size)
{
void* addr = OM_MALLOC_REALLOC(o_addr, n_size);
if (n_size > o_size)
memset((char *)addr + o_size, 0, n_size - o_size);
return addr;
}
void* omEmulateRealloc0(void* o_addr, size_t n_size)
{
size_t o_size = OM_MALLOC_SIZEOF_ADDR(o_addr);
void* addr = OM_MALLOC_REALLOC(o_addr, n_size);
if (n_size > o_size)
memset((char *)addr + o_size, 0, n_size - o_size);
return addr;
}
#endif