Added use of scl_memmgr to exppp library.
* Replaced malloc, calloc, realloc and free with scl_memmgr versions. * Added scl_memmgr.h includes.
This commit is contained in:
@@ -10,18 +10,20 @@ set(LIBEXPPP_SOURCES
|
||||
include_directories(
|
||||
${SCL_SOURCE_DIR}/include
|
||||
${SCL_SOURCE_DIR}/include/exppp
|
||||
${SCL_SOURCE_DIR}/src/base
|
||||
)
|
||||
|
||||
if(MSVC OR BORLAND)
|
||||
add_definitions( -DSCL_EXPPP_DLL_EXPORTS )
|
||||
add_definitions( -DSCL_EXPRESS_DLL_IMPORTS )
|
||||
add_definitions( -DSCL_BASE_DLL_IMPORTS )
|
||||
endif()
|
||||
|
||||
if(BORLAND)
|
||||
add_definitions( -D__STDC__ )
|
||||
endif()
|
||||
|
||||
SCL_ADDLIB(libexppp "${LIBEXPPP_SOURCES}" express)
|
||||
SCL_ADDLIB(libexppp "${LIBEXPPP_SOURCES}" "express base")
|
||||
set_target_properties(libexppp PROPERTIES PREFIX "")
|
||||
|
||||
#SCL_ADDEXEC(exppp "${EXPPP_SOURCES}" "libexppp express")
|
||||
|
||||
+5
-4
@@ -1,4 +1,5 @@
|
||||
#include <scl_cf.h>
|
||||
#include <scl_memmgr.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <memory.h>
|
||||
@@ -1501,7 +1502,7 @@ TYPE_body_out( Type t, int level ) {
|
||||
while( 0 != ( expr = ( Expression )DICTdo( &de ) ) ) {
|
||||
count++;
|
||||
}
|
||||
names = ( char ** )malloc( count * sizeof( char * ) );
|
||||
names = ( char ** )scl_malloc( count * sizeof( char * ) );
|
||||
DICTdo_type_init( t->symbol_table, &de, OBJ_EXPRESSION );
|
||||
while( 0 != ( expr = ( Expression )DICTdo( &de ) ) ) {
|
||||
names[expr->u.integer - 1] = expr->symbol.name;
|
||||
@@ -1525,7 +1526,7 @@ TYPE_body_out( Type t, int level ) {
|
||||
raw( names[i] );
|
||||
}
|
||||
raw( ")" );
|
||||
free( ( char * )names );
|
||||
scl_free( ( char * )names );
|
||||
}
|
||||
#else
|
||||
wrap( " ENUMERATION OF\n" );
|
||||
@@ -2025,7 +2026,7 @@ prep_string() {
|
||||
}
|
||||
string_func_in_use = true;
|
||||
|
||||
exppp_buf = exppp_bufp = ( char * )malloc( BIGBUFSIZ );
|
||||
exppp_buf = exppp_bufp = ( char * )scl_malloc( BIGBUFSIZ );
|
||||
if( !exppp_buf ) {
|
||||
fprintf( stderr, "failed to allocate exppp buffer\n" );
|
||||
return false;
|
||||
@@ -2044,7 +2045,7 @@ prep_string() {
|
||||
|
||||
static char *
|
||||
finish_string() {
|
||||
char * b = ( char * )realloc( exppp_buf, 1 + exppp_maxbuflen - exppp_buflen );
|
||||
char * b = ( char * )scl_realloc( exppp_buf, 1 + exppp_maxbuflen - exppp_buflen );
|
||||
|
||||
if( b == 0 ) {
|
||||
fprintf( stderr, "failed to reallocate exppp buffer\n" );
|
||||
|
||||
Reference in New Issue
Block a user