Skip to content

Commit f5d0cc5

Browse files
committed
Added fedex_plus/express cleanup functions.
* A lot of memory allocated in EXPRESSinitialize was not cleaned up. Added EXPRESScleanup function and subfunctions to clean up that memory.
1 parent bd320c4 commit f5d0cc5

File tree

20 files changed

+180
-4
lines changed

20 files changed

+180
-4
lines changed

include/express/dict.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ GLOBAL SCL_EXPRESS_EXPORT char DICT_type; /**< set as a side-effect of DICT loo
106106
/***********************/
107107

108108
extern SCL_EXPRESS_EXPORT void DICTinitialize PROTO( ( void ) );
109+
extern SCL_EXPRESS_EXPORT void DICTcleanup PROTO( ( void ) );
109110
extern SCL_EXPRESS_EXPORT int DICTdefine PROTO( ( Dictionary, char *, Generic, Symbol *, char ) );
110111
extern SCL_EXPRESS_EXPORT int DICT_define PROTO( ( Dictionary, char *, Generic, Symbol *, char ) );
111112
extern SCL_EXPRESS_EXPORT void DICTundefine PROTO( ( Dictionary, char * ) );

include/express/error.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,12 @@ static_inline void ERRORflush_messages( void ) {
184184

185185
extern SCL_EXPRESS_EXPORT void ERRORinitialize PROTO( ( void ) );
186186
extern SCL_EXPRESS_EXPORT void ERRORinitialize_after_LIST PROTO( ( void ) );
187+
extern SCL_EXPRESS_EXPORT void ERRORcleanup PROTO( ( void ) );
187188
extern SCL_EXPRESS_EXPORT void ERRORnospace PROTO( ( void ) );
188189
extern SCL_EXPRESS_EXPORT void ERRORabort PROTO( ( int ) );
189190
extern SCL_EXPRESS_EXPORT Error ERRORcreate PROTO( ( char *, Severity ) );
190191
extern SCL_EXPRESS_EXPORT void ERRORreport PROTO( ( Error, ... ) );
192+
extern SCL_EXPRESS_EXPORT void ERRORdestroy PROTO( ( Error ) );
191193

192194
struct Symbol_; /* mention Symbol to avoid warning on following line */
193195
extern SCL_EXPRESS_EXPORT void ERRORreport_with_symbol PROTO( ( Error, struct Symbol_ *, ... ) );

include/express/expr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ extern SCL_EXPRESS_EXPORT Expression BIN_EXPcreate PROTO( ( Op_Code, Expressio
270270
extern SCL_EXPRESS_EXPORT Expression TERN_EXPcreate PROTO( ( Op_Code, Expression, Expression, Expression ) );
271271
extern SCL_EXPRESS_EXPORT Expression QUERYcreate PROTO( ( Symbol *, Expression ) );
272272
extern SCL_EXPRESS_EXPORT void EXPinitialize PROTO( ( void ) );
273+
extern SCL_EXPRESS_EXPORT void EXPcleanup PROTO( ( void ) );
273274
extern SCL_EXPRESS_EXPORT Type EXPtype PROTO( ( Expression, struct Scope_ * ) );
274275
extern SCL_EXPRESS_EXPORT int EXPget_integer_value PROTO( ( Expression ) );
275276

include/express/express.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,10 @@ GLOBAL SCL_EXPRESS_EXPORT char * KW_XOR INITIALLY( "XOR" );
266266
/***********************/
267267

268268
extern SCL_EXPRESS_EXPORT Express EXPRESScreate PROTO( ( void ) );
269+
extern SCL_EXPRESS_EXPORT void EXPRESSdestroy PROTO( ( Express ) );
269270
extern SCL_EXPRESS_EXPORT void EXPRESSparse PROTO( ( Express, FILE *, char * ) );
270271
extern SCL_EXPRESS_EXPORT void EXPRESSinitialize PROTO( ( void ) );
272+
extern SCL_EXPRESS_EXPORT void EXPRESScleanup PROTO( ( void ) );
271273
extern SCL_EXPRESS_EXPORT void EXPRESSresolve PROTO( ( Express ) );
272274
extern SCL_EXPRESS_EXPORT char * EXPRESSversion PROTO( ( void ) );
273275
extern SCL_EXPRESS_EXPORT int EXPRESS_fail PROTO( ( Express ) );

include/express/linklist.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ GLOBAL SCL_EXPRESS_EXPORT Linked_List LINK__l; /* for LISTcreate_with macro
135135
/***********************/
136136

137137
extern SCL_EXPRESS_EXPORT void LISTinitialize PROTO( ( void ) );
138+
extern SCL_EXPRESS_EXPORT void LISTcleanup PROTO( ( void ) );
138139
extern SCL_EXPRESS_EXPORT Linked_List LISTcreate PROTO( ( void ) );
139140
extern SCL_EXPRESS_EXPORT Linked_List LISTcopy PROTO( ( Linked_List ) );
140141
extern SCL_EXPRESS_EXPORT Generic LISTadd_first PROTO( ( Linked_List, Generic ) );

include/express/object.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ GLOBAL SCL_EXPRESS_EXPORT struct Object * OBJ;
108108
/***********************/
109109

110110
extern SCL_EXPRESS_EXPORT void OBJinitialize PROTO( ( void ) );
111+
extern SCL_EXPRESS_EXPORT void OBJcleanup PROTO( ( void ) );
111112
extern SCL_EXPRESS_EXPORT void OBJcreate PROTO( ( char, struct Symbol_ * ( * )( Generic ), char *, int ) );
112113
extern SCL_EXPRESS_EXPORT Symbol * UNK_get_symbol PROTO( ( Generic x ) );
113114

include/express/resolve.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ GLOBAL SCL_EXPRESS_EXPORT Error ERROR_ambiguous_group INITIALLY( ERROR_
8282
/***********************/
8383

8484
extern SCL_EXPRESS_EXPORT void RESOLVEinitialize PROTO( ( void ) );
85+
extern SCL_EXPRESS_EXPORT void RESOLVEcleanup PROTO( ( void ) );
8586
extern SCL_EXPRESS_EXPORT void SCOPEresolve_expressions_statements PROTO( ( Scope ) );
8687
extern SCL_EXPRESS_EXPORT void SCOPEresolve_subsupers PROTO( ( Scope ) );
8788
extern SCL_EXPRESS_EXPORT void SCOPEresolve_types PROTO( ( Scope ) );

include/express/schema.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ extern SCL_EXPRESS_EXPORT Generic SCHEMAfind PROTO( ( Schema, char * name, int
155155
extern SCL_EXPRESS_EXPORT Scope SCOPEcreate PROTO( ( char ) );
156156
extern SCL_EXPRESS_EXPORT Scope SCOPEcreate_tiny PROTO( ( char ) );
157157
extern SCL_EXPRESS_EXPORT Scope SCOPEcreate_nostab PROTO( ( char ) );
158+
extern SCL_EXPRESS_EXPORT void SCOPEdestroy PROTO( ( Scope ) );
158159
extern SCL_EXPRESS_EXPORT Linked_List SCHEMAget_entities_use PROTO( ( Scope ) );
159160
extern SCL_EXPRESS_EXPORT Linked_List SCHEMAget_entities_ref PROTO( ( Scope ) );
160161

include/express/type.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ extern SCL_EXPRESS_EXPORT Type TYPEcreate_name PROTO( ( struct Symbol_ * ) );
304304
extern SCL_EXPRESS_EXPORT Type TYPEcreate_nostab PROTO( ( struct Symbol_ *, Scope, char ) );
305305
extern SCL_EXPRESS_EXPORT TypeBody TYPEBODYcreate PROTO( ( enum type_enum ) );
306306
extern SCL_EXPRESS_EXPORT void TYPEinitialize PROTO( ( void ) );
307+
extern SCL_EXPRESS_EXPORT void TYPEcleanup PROTO( ( void ) );
307308

308309
extern SCL_EXPRESS_EXPORT bool TYPEinherits_from PROTO( ( Type, enum type_enum ) );
309310
extern SCL_EXPRESS_EXPORT Type TYPEget_nonaggregate_base_type PROTO( ( Type ) );

src/express/dict.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ void DICTinitialize( void ) {
6363
"Redeclaration of %s. Previous declaration was on line %d in file %s.", SEVERITY_ERROR );
6464
}
6565

66+
/** Clean up the Dictionary module */
67+
void DICTcleanup( void ) {
68+
ERRORdestroy( ERROR_duplicate_decl );
69+
ERRORdestroy( ERROR_duplicate_decl_diff_file );
70+
}
71+
6672
/** \def DICTcreate
6773
** \param size - estimated (initial) max # of entries
6874
** \return a new dictionary of the specified size

0 commit comments

Comments
 (0)