Skip to content

Commit 885828c

Browse files
author
Nicholas Reed
committed
use scl_memmgr in express; SCL git 82c84e7 and 4d6d249
1 parent e12f7c7 commit 885828c

23 files changed

Lines changed: 38 additions & 15 deletions

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ include_directories(
288288
${SCL_BINARY_DIR}/include
289289
)
290290

291-
#ADD_SUBDIRECTORY(src/base)
291+
ADD_SUBDIRECTORY(src/base)
292292
ADD_SUBDIRECTORY(src/express)
293293
ADD_SUBDIRECTORY(src/exppp)
294294
ADD_SUBDIRECTORY(src/fedex_plus)

src/base/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ set(SCL_BASE_SOURCES
44
)
55

66
include_directories(
7-
${SCL_SOURCE_DIR}/include
7+
${CMAKE_CURRENT_BINARY_DIR}
8+
${CMAKE_CURRENT_SOURCE_DIR}
9+
${SCL_SOURCE_DIR}/include
810
)
911

1012
option(SCL_MEMMGR_ENABLE_CHECKS "Enable scl_memmgr's memory leak detection" OFF)

src/express/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
include_directories(
22
${CMAKE_CURRENT_BINARY_DIR}
33
${CMAKE_CURRENT_SOURCE_DIR}
4+
${SCL_SOURCE_DIR}/src/base
45
)
56

67
find_package(LEMON)
@@ -42,5 +43,5 @@ SET(EXPRESS_PRIVATE_HDRS
4243
stack.h
4344
)
4445

45-
SCL_ADDLIB(express "${EXPRESS_SOURCES}" "")
46+
SCL_ADDLIB(express "${EXPRESS_SOURCES}" "base")
4647
SCL_ADDEXEC(fedex "${FEDEX_SOURCES}" express)

src/express/alg.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
* prettied up interface to print_objects_when_running
3939
*/
4040

41+
#include <scl_memmgr.h>
4142
#include "express/alg.h"
4243
#include "express/object.h"
4344
#include "express/schema.h"

src/express/caseitem.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
* prettied up interface to print_objects_when_running
3030
*/
3131

32+
#include <scl_memmgr.h>
3233
#include "express/caseitem.h"
3334

3435
struct freelist_head CASE_IT_fl;

src/express/dict.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
* Initial revision
3434
*/
3535

36+
#include <scl_memmgr.h>
3637
#include "express/dict.h"
3738
#include "express/object.h"
3839
#include "express/expbasic.h"

src/express/entity.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
*
112112
*/
113113

114+
#include <scl_memmgr.h>
114115
#include "express/entity.h"
115116
#include "express/express.h"
116117
#include "express/object.h"

src/express/error.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
* prettied up interface to print_objects_when_running
5252
*/
5353

54+
#include <scl_memmgr.h>
5455
#include <stdlib.h>
5556
#include <setjmp.h>
5657

@@ -123,7 +124,7 @@ void ERRORinitialize( void ) {
123124
ERROR_syntax_expecting =
124125
ERRORcreate( "%s, expecting %s in %s %s", SEVERITY_EXIT );
125126

126-
ERROR_string_base = ( char * )calloc( 1, ERROR_MAX_SPACE );
127+
ERROR_string_base = ( char * )scl_malloc( ERROR_MAX_SPACE );
127128
ERROR_start_message_buffer();
128129

129130

@@ -428,7 +429,7 @@ void ERRORnospace() {
428429
Error ERRORcreate( char * message, Severity severity ) {
429430
Error n;
430431

431-
n = ( struct Error_ * )malloc( sizeof( struct Error_ ) );
432+
n = ( struct Error_ * )scl_malloc( sizeof( struct Error_ ) );
432433
n->message = message;
433434
n->severity = severity;
434435
n->enabled = true;

src/express/expr.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
*
7171
*/
7272

73+
#include <scl_memmgr.h>
7374
#include "express/expr.h"
7475
#include "express/resolve.h"
7576

src/express/express.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
*
6969
*/
7070

71+
#include "scl_memmgr.h"
7172
#include "express/basic.h"
7273
#include <ctype.h>
7374
#include <stdlib.h>
@@ -274,7 +275,7 @@ Symbol * EXPRESS_get_symbol( Generic e ) {
274275

275276
Express EXPRESScreate() {
276277
Express model = SCOPEcreate( OBJ_EXPRESS );
277-
model->u.express = ( struct Express_ * )calloc( 1, sizeof( struct Express_ ) );
278+
model->u.express = ( struct Express_ * )scl_calloc( 1, sizeof( struct Express_ ) );
278279
return model;
279280
}
280281

@@ -293,7 +294,7 @@ static void EXPRESS_PATHinit() {
293294
p = getenv( "EXPRESS_PATH" );
294295
if( !p ) {
295296
/* if no EXPRESS_PATH, search current directory anyway */
296-
dir = ( Dir * )malloc( sizeof( Dir ) );
297+
dir = ( Dir * )scl_malloc( sizeof( Dir ) );
297298
dir->leaf = dir->full;
298299
LISTadd( EXPRESS_path, ( Generic )dir );
299300
} else {
@@ -325,7 +326,7 @@ static void EXPRESS_PATHinit() {
325326
}
326327
p++; /* leave p after terminating null */
327328

328-
dir = ( Dir * )malloc( sizeof( Dir ) );
329+
dir = ( Dir * )scl_malloc( sizeof( Dir ) );
329330

330331
/* if it's just ".", make it as if it was */
331332
/* just "" to make error messages cleaner */
@@ -523,7 +524,7 @@ void EXPRESSparse( Express model, FILE * fp, char * filename ) {
523524
length -= 4;
524525
}
525526

526-
model->u.express->basename = ( char * )malloc( length + 1 );
527+
model->u.express->basename = ( char * )scl_malloc( length + 1 );
527528
memcpy( model->u.express->basename, filename, length );
528529
model->u.express->basename[length] = '\0';
529530

0 commit comments

Comments
 (0)