From 605bc82e86c840f5e55af0746977eb72467e7314 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jurko=20Gospodneti=C4=87?= Date: Mon, 25 Jun 2012 00:41:37 +0000 Subject: [PATCH] Boost Jam code cleanup - updated path_tmpdir() to return a string object instead of a raw C char pointer. [SVN r79068] --- src/engine/execnt.c | 6 +++--- src/engine/pathsys.h | 2 +- src/engine/pathunix.c | 6 +++--- src/engine/variable.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/engine/execnt.c b/src/engine/execnt.c index 9db4b2c1a..5adbfe24f 100644 --- a/src/engine/execnt.c +++ b/src/engine/execnt.c @@ -1182,11 +1182,11 @@ static FILE * open_command_file( int const slot ) if ( !command_file->value ) { DWORD const procID = GetCurrentProcessId(); - char const * const tmpdir = path_tmpdir(); + string const * const tmpdir = path_tmpdir(); string_new( command_file ); - string_reserve( command_file, strlen( tmpdir ) + 64 ); + string_reserve( command_file, tmpdir->size + 64 ); command_file->size = sprintf( command_file->value, "%s\\jam%d-%02d.bat", - tmpdir, procID, slot ); + tmpdir->value, procID, slot ); } /* Write command to bat file. For some reason this open can fail diff --git a/src/engine/pathsys.h b/src/engine/pathsys.h index 0b90602c7..a2655c0dc 100644 --- a/src/engine/pathsys.h +++ b/src/engine/pathsys.h @@ -72,7 +72,7 @@ void path_add_key( OBJECT * path ); /** Returns a static pointer to the system dependent path to the temporary directory. NOTE: *without* a trailing path separator. */ -char const * path_tmpdir( void ); +string const * path_tmpdir( void ); /** Returns a new temporary name. */ diff --git a/src/engine/pathunix.c b/src/engine/pathunix.c index aa72c8360..4ed4b8d2a 100644 --- a/src/engine/pathunix.c +++ b/src/engine/pathunix.c @@ -522,7 +522,7 @@ void path_done( void ) #endif -char const * path_tmpdir() +string const * path_tmpdir() { static string buffer[ 1 ]; static int have_result; @@ -546,7 +546,7 @@ char const * path_tmpdir() #endif have_result = 1; } - return buffer->value; + return buffer; } OBJECT * path_tmpnam( void ) @@ -571,7 +571,7 @@ OBJECT * path_tmpfile( void ) OBJECT * tmpnam; string file_path[ 1 ]; - string_copy( file_path, path_tmpdir() ); + string_copy( file_path, path_tmpdir()->value ); string_push_back( file_path, PATH_DELIM ); tmpnam = path_tmpnam(); string_append( file_path, object_str( tmpnam ) ); diff --git a/src/engine/variable.c b/src/engine/variable.c index 21eedf395..4635ebc77 100644 --- a/src/engine/variable.c +++ b/src/engine/variable.c @@ -176,7 +176,7 @@ LIST * var_get( struct module_t * module, OBJECT * symbol ) if ( object_equal( symbol, constant_TMPDIR ) ) { list_free( saved_var ); - result = saved_var = list_new( object_new( path_tmpdir() ) ); + result = saved_var = list_new( object_new( path_tmpdir()->value ) ); } else if ( object_equal( symbol, constant_TMPNAME ) ) {