Commit 5864afcd authored by norvell's avatar norvell
Browse files

Minor fix using dbgwrite instead of fprintf and a file pointer

parent 56bd6d87
Loading
Loading
Loading
Loading
+9 −10
Original line number Diff line number Diff line
@@ -49,6 +49,10 @@ typedef INT64 int64_t;
#define FALSE 0
#endif

#ifdef RAM_ANALYSIS
#include "debug.h"
#endif

/* How to use the tool notes
   =========================

@@ -178,10 +182,6 @@ static allocation_list Missing_Allocations;
static unsigned int Num_Records_Missing_Alloc_Warnings = 0;
#endif

#ifdef RAM_ANALYSIS
static FILE *mem_analysis_file = NULL;
#endif

/*-------------------------------------------------------------------*
 * LOCAL CONST DATA
 *-------------------------------------------------------------------*/
@@ -911,16 +911,15 @@ size_t mem_count_summary( Counting_Size cnt_size )
void mem_analyze()
{
    unsigned int i;
    char buffer[1024];

    if ( mem_analysis_file == NULL )
    {
        mem_analysis_file = fopen( "mem_analysis.csv", "w" );
    }
    for ( i = 0; i < Num_Records_Cur_RAM; i++ )
    {
        fprintf( mem_analysis_file, "%s:%d,%d;", Current_Allocations[i].name, Current_Allocations[i].lineno, Current_Allocations[i].block_size );
        sprintf( buffer, "%s:%d,%d;", Current_Allocations[i].name, Current_Allocations[i].lineno, Current_Allocations[i].block_size );
        dbgwrite( buffer, sizeof( char ), strlen( buffer ), 1, "mem_analysis.csv" );
    }
    fprintf( mem_analysis_file, "\n" );
    sprintf( buffer, "\n" );
    dbgwrite( buffer, sizeof( char ), strlen( buffer ), 1, "mem_analysis.csv" );

    return;
}