From 7dfcc480ba1e19bd3232349fc733caef94034292 Mon Sep 17 00:00:00 2001 From: stainer_t Date: Mon, 8 Sep 2025 13:48:49 +0200 Subject: Initial commit from Polytechnique Montreal --- Ganlib/src/setara_c.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Ganlib/src/setara_c.c (limited to 'Ganlib/src/setara_c.c') diff --git a/Ganlib/src/setara_c.c b/Ganlib/src/setara_c.c new file mode 100644 index 0000000..1cd3918 --- /dev/null +++ b/Ganlib/src/setara_c.c @@ -0,0 +1,46 @@ +/* + ----------------------------------------------------------------------- + Copyright (C) 2002 Ecole Polytechnique de Montreal + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + DYNAMIC ALLOCATION/LIBERATION OF MEMORY WITH SETARA/RLSARA IN C. + + SETARA PARAMETERS: + LENGTH : NUMBER OF SINGLE PRECISION WORDS TO BE ALLOCATED BY SETARA. + IOF : OFFSET OF THE ALLOCATED SPACE. + + RLSARA PARAMETER: + BASE : FIRST WORD OF THE MEMORY SPACE TO BE DEALLOCATED. + + ----------------------------------------------------------------------- + */ + +#include +#include +#include +#include "ganlib.h" + +static char AbortString[80]; + +int_32 * setara_c(int_32 length) +{ + char *nomsub="setara_c"; + int_32 *kaddr; + + kaddr = (int_32 *)malloc(length*sizeof(int_32)); + if (kaddr == 0) { + sprintf(AbortString,"%s: invalid return code %ld length=%d",nomsub,(long)kaddr,(int)length); + xabort_c(AbortString); + } + return kaddr; +} +/* Function rlsara_c */ +void rlsara_c(int_32 *iof) +{ + free(iof); + return; +} -- cgit v1.2.3