Skip to content

Commit 4a71f48

Browse files
committed
move allocator functionality to one module to enable easier testing
1 parent db4f1a6 commit 4a71f48

16 files changed

Lines changed: 6 additions & 56 deletions

File tree

include/express/memory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#ifndef __MEMORY_H
22
#define __MEMORY_H
33

4-
void MEMinit();
4+
void MEMORYinitialize();
55

66
#endif // __MEMORY_H

src/express/alg.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,6 @@ Scope ALGcreate( char type ) {
7575

7676
/** Initialize the Algorithm module. */
7777
void ALGinitialize( void ) {
78-
ALLOCinitialize( &FUNC_fl, sizeof( struct Function_ ), 100, 50 );
79-
ALLOCinitialize( &RULE_fl, sizeof( struct Rule_ ), 100, 50 );
80-
ALLOCinitialize( &PROC_fl, sizeof( struct Procedure_ ), 100, 50 );
81-
ALLOCinitialize( &WHERE_fl, sizeof( struct Where_ ), 100, 50 );
8278
}
8379

8480
void ALGput_full_text( Scope s, int start, int end ) {

src/express/caseitem.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
/** Initialize the Case Item module. */
3737
void
3838
CASE_ITinitialize( void ) {
39-
ALLOCinitialize( &CASE_IT_fl, sizeof( struct Case_Item_ ), 500, 100 );
4039
}
4140

4241
/**

src/express/entity.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,6 @@ Entity ENTITYcopy( Entity e ) {
298298

299299
/** Initialize the Entity module. */
300300
void ENTITYinitialize() {
301-
ALLOCinitialize( &ENTITY_fl, sizeof( struct Entity_ ), 500, 100 );
302301
}
303302

304303
/**

src/express/error.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,6 @@ void ERRORcleanup( void ) {
187187
/** Need the LIST routines to complete ERROR initialization */
188188
void ERRORinitialize_after_LIST( void ) {
189189
ERRORwarnings = LISTcreate();
190-
191-
ALLOCinitialize( &ERROR_OPT_fl, sizeof( struct Error_Warning_ ), 5, 5 );
192190
}
193191

194192
void ERRORcreate_warning( char * name, Error error ) {

src/express/expr.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,6 @@ Expression EXPcreate_from_symbol( Type type, Symbol * symbol ) {
143143

144144
/** Description: Initialize the Expression module. */
145145
void EXPinitialize( void ) {
146-
ALLOCinitialize( &EXP_fl, sizeof( struct Expression_ ), 500, 200 );
147-
ALLOCinitialize( &OP_fl, sizeof( struct Op_Subexpression ), 500, 100 );
148-
ALLOCinitialize( &QUERY_fl, sizeof( struct Query_ ), 50, 10 );
149-
ALLOCinitialize( &QUAL_ATTR_fl, sizeof( struct Query_ ), 20, 10 );
150146

151147
#ifdef does_not_appear_to_be_necessary_or_even_make_sense
152148
LITERAL_EMPTY_SET = EXPcreate_simple( Type_Set );

src/express/express.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
#include <setjmp.h>
7575
#include <errno.h>
7676

77+
#include "express/memory.h"
7778
#include "express/basic.h"
7879
#include "express/express.h"
7980
#include "express/resolve.h"
@@ -259,7 +260,7 @@ void PASSinitialize() {
259260

260261
/** Initialize the Express package. */
261262
void EXPRESSinitialize( void ) {
262-
_ALLOCinitialize();
263+
MEMORYinitialize();
263264
ERRORinitialize();
264265

265266
HASHinitialize(); /* comes first - used by just about everything else! */

src/express/hash.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,6 @@ static long HashAccesses, HashCollisions;
132132

133133
void
134134
HASHinitialize() {
135-
if( HASH_Table_fl.size_elt == 0 ) {
136-
ALLOCinitialize( &HASH_Table_fl, sizeof( struct Hash_Table_ ), 50, 50 );
137-
}
138-
if( HASH_Element_fl.size_elt == 0 ) {
139-
ALLOCinitialize( &HASH_Element_fl, sizeof( struct Element_ ), 500, 100 );
140-
}
141135
}
142136

143137
Hash_Table

src/express/linklist.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
Error ERROR_empty_list = ERROR_none;
2828

2929
void LISTinitialize( void ) {
30-
ALLOCinitialize( &LINK_fl, sizeof( struct Link_ ), 500, 100 );
31-
ALLOCinitialize( &LIST_fl, sizeof( struct Linked_List_ ), 100, 50 );
3230
ERROR_empty_list = ERRORcreate( "Empty list in %s.", SEVERITY_ERROR );
3331
}
3432

src/express/memory.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ struct freelist_head SYMBOL_fl;
1919

2020
struct freelist_head SCOPE_fl;
2121
struct freelist_head SCHEMA_fl;
22+
struct freelist_head REN_fl;
2223

2324
struct freelist_head TYPEHEAD_fl;
2425
struct freelist_head TYPEBODY_fl;
@@ -50,7 +51,7 @@ struct freelist_head PCALL_fl;
5051
struct freelist_head RET_fl;
5152
struct freelist_head INCR_fl;
5253

53-
void MEMinit() {
54+
void MEMORYinitialize() {
5455
_ALLOCinitialize();
5556

5657
ALLOCinitialize( &HASH_Table_fl, sizeof( struct Hash_Table_ ), 50, 50 );
@@ -78,6 +79,7 @@ void MEMinit() {
7879
ALLOCinitialize( &ENTITY_fl, sizeof( struct Entity_ ), 500, 100 );
7980

8081
ALLOCinitialize( &SCHEMA_fl, sizeof( struct Schema_ ), 40, 20 );
82+
ALLOCinitialize( &REN_fl, sizeof( struct Rename ), 30, 30 );
8183

8284
ALLOCinitialize( &CASE_IT_fl, sizeof( struct Case_Item_ ), 500, 100 );
8385

0 commit comments

Comments
 (0)