diff --git a/ChangeLog b/ChangeLog index 9507e44..ea87d74 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-01-23 + + * hxi/Hxi_SimStruct.[hC]: + - move mxFree into the compilation unit that allocates memory + 2014-01-22 * README.html, README.md, INSTALL.html, Makefile, doc/Doxyfile.in: diff --git a/hxi/Hxi_SimStruct.C b/hxi/Hxi_SimStruct.C index d9b06aa..fe44e40 100644 --- a/hxi/Hxi_SimStruct.C +++ b/hxi/Hxi_SimStruct.C @@ -9,7 +9,7 @@ */ /* - Copyright (C) 1994--2010 Ruediger Franke + Copyright (C) 1994--2014 Ruediger Franke This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -1136,6 +1136,11 @@ HXI_EXTERN void Hxi_SimStruct_destroy(SimStruct *S) { delete (Hxi::SimStruct*)S; } +/* Free memory allocated through mx methods, e.g. mxArrayToString. */ +HXI_EXTERN void mxFree(void *p) { + free(p); +} + #if !defined(HXI_INLINE_S_FUNCTION) /** Initialize SimStruct for specific model. */ diff --git a/hxi/Hxi_SimStruct.h b/hxi/Hxi_SimStruct.h index 35272b0..512bb31 100644 --- a/hxi/Hxi_SimStruct.h +++ b/hxi/Hxi_SimStruct.h @@ -40,9 +40,6 @@ /** @name Definitions used outside S-functions as well */ /*@{*/ #define CONTINUOUS_SAMPLE_TIME 0.0 - -/** Free memory allocated though mx methods, e.g. mxArrayToString. */ -#define mxFree(p) free(p) /*@}*/ /* forward declare SimStruct and mxArray */ @@ -75,6 +72,9 @@ HXI_EXTERN SimStruct *Hxi_SimStruct_create(const char *path); /** Delete a SimStruct. */ HXI_EXTERN void Hxi_SimStruct_destroy(SimStruct *S); +/** Free memory allocated though mx methods, e.g. mxArrayToString. */ +HXI_EXTERN void mxFree(void *p); + #if !defined(HXI_INLINE_S_FUNCTION) /** @name Supported S-function methods. */ /*@{*/