Skip to content

Commit

Permalink
move mxFree into the compilation unit that allocates memory
Browse files Browse the repository at this point in the history
  • Loading branch information
rfranke committed Jan 23, 2014
1 parent 022a4d2 commit 23645fb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2014-01-23 <rfranke>

* hxi/Hxi_SimStruct.[hC]:
- move mxFree into the compilation unit that allocates memory

2014-01-22 <rfranke>

* README.html, README.md, INSTALL.html, Makefile, doc/Doxyfile.in:
Expand Down
7 changes: 6 additions & 1 deletion hxi/Hxi_SimStruct.C
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1136,6 +1136,11 @@ HXI_EXTERN void Hxi_SimStruct_destroy(SimStruct *S) {
delete (Hxi::SimStruct<real_T>*)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. */
Expand Down
6 changes: 3 additions & 3 deletions hxi/Hxi_SimStruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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. */
/*@{*/
Expand Down

0 comments on commit 23645fb

Please sign in to comment.