2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-14 00:32:11 +00:00

Boost Jam code cleanup - minor stylistic changes.

[SVN r79483]
This commit is contained in:
Jurko Gospodnetić
2012-07-13 20:15:00 +00:00
parent 678fe54e15
commit b9fa41fecd
3 changed files with 48 additions and 47 deletions

View File

@@ -56,8 +56,8 @@
int file_collect_dir_content_( file_info_t * const d )
{
PATHNAME f;
string filespec[ 1 ];
string filename[ 1 ];
string pathspec[ 1 ];
string pathname[ 1 ];
struct _finddata_t finfo[ 1 ];
LIST * files = L0;
int d_length;
@@ -74,7 +74,7 @@ int file_collect_dir_content_( file_info_t * const d )
/* Prepare file search specification for the findfirst() API. */
if ( !d_length )
string_copy( filespec, ".\\*" );
string_copy( pathspec, ".\\*" );
else
{
/* We can not simply assume the given folder name will never include its
@@ -82,30 +82,30 @@ int file_collect_dir_content_( file_info_t * const d )
* root folder specified without its drive letter, i.e. '\'.
*/
char const trailingChar = object_str( d->name )[ d_length - 1 ] ;
string_copy( filespec, object_str( d->name ) );
string_copy( pathspec, object_str( d->name ) );
if ( ( trailingChar != '\\' ) && ( trailingChar != '/' ) )
string_append( filespec, "\\" );
string_append( filespec, "*" );
string_append( pathspec, "\\" );
string_append( pathspec, "*" );
}
#if defined(__BORLANDC__) && __BORLANDC__ < 0x550
if ( findfirst( filespec->value, finfo, FA_NORMAL | FA_DIREC ) )
#if defined(__BORLANDC__) && __BORLANDC__ < 0x550
if ( findfirst( pathspec->value, finfo, FA_NORMAL | FA_DIREC ) )
{
string_free( filespec );
string_free( pathspec );
return -1;
}
string_new( filename );
string_new( pathname );
do
{
f.f_base.ptr = finfo->ff_name;
f.f_base.len = strlen( finfo->ff_name );
string_truncate( filename, 0 );
path_build( &f, filename );
string_truncate( pathname, 0 );
path_build( &f, pathname );
files = list_push_back( files, object_new( filename->value ) );
files = list_push_back( files, object_new( pathname->value ) );
{
file_info_t * const ff = file_info( filename->value );
file_info_t * const ff = file_info( pathname->value );
ff->is_file = finfo->ff_attrib & FA_DIREC ? 0 : 1;
ff->is_dir = !ff->is_file;
ff->size = finfo->ff_fsize;
@@ -113,30 +113,30 @@ int file_collect_dir_content_( file_info_t * const d )
}
}
while ( !findnext( finfo ) );
#else
#else /* defined(__BORLANDC__) && __BORLANDC__ < 0x550 */
{
long const handle = _findfirst( filespec->value, finfo );
long const handle = _findfirst( pathspec->value, finfo );
if ( handle < 0L )
{
string_free( filespec );
string_free( pathspec );
return -1;
}
string_new( filename );
string_new( pathname );
do
{
OBJECT * filename_obj;
OBJECT * pathname_obj;
f.f_base.ptr = finfo->name;
f.f_base.len = strlen( finfo->name );
string_truncate( filename, 0 );
path_build( &f, filename, 0 );
string_truncate( pathname, 0 );
path_build( &f, pathname, 0 );
filename_obj = object_new( filename->value );
path_key__register_long_path( filename_obj );
files = list_push_back( files, filename_obj );
pathname_obj = object_new( pathname->value );
path_key__register_long_path( pathname_obj );
files = list_push_back( files, pathname_obj );
{
file_info_t * const ff = file_info( filename_obj );
file_info_t * const ff = file_info( pathname_obj );
ff->is_file = finfo->attrib & _A_SUBDIR ? 0 : 1;
ff->is_dir = !ff->is_file;
ff->size = finfo->size;
@@ -147,9 +147,10 @@ int file_collect_dir_content_( file_info_t * const d )
_findclose( handle );
}
#endif
string_free( filename );
string_free( filespec );
#endif /* defined(__BORLANDC__) && __BORLANDC__ < 0x550 */
string_free( pathname );
string_free( pathspec );
d->files = files;
return 0;

View File

@@ -13,7 +13,7 @@
* file_dirscan() - scan a directory for files
* file_done() - module cleanup called on shutdown
* file_info() - return cached information about a path
* file_is_file() - return whether a name identifies an existing file
* file_is_file() - return whether a path identifies an existing file
* file_query() - get cached information about a path, query the OS if
* needed
* file_remove_atexit() - schedule a path to be removed on program exit
@@ -123,9 +123,9 @@ void file_done()
* referenced.
*/
file_info_t * file_info( OBJECT * filename )
file_info_t * file_info( OBJECT * path )
{
OBJECT * const path_key = path_as_key( filename );
OBJECT * const path_key = path_as_key( path );
file_info_t * finfo;
int found;
@@ -150,12 +150,12 @@ file_info_t * file_info( OBJECT * filename )
/*
* file_is_file() - return whether a name identifies an existing file
* file_is_file() - return whether a path identifies an existing file
*/
int file_is_file( OBJECT * filename )
int file_is_file( OBJECT * path )
{
file_info_t const * const ff = file_query( filename );
file_info_t const * const ff = file_query( path );
return ff ? ff->is_file : -1;
}
@@ -164,9 +164,9 @@ int file_is_file( OBJECT * filename )
* file_time() - get a file timestamp
*/
int file_time( OBJECT * filename, time_t * time )
int file_time( OBJECT * path, time_t * time )
{
file_info_t const * const ff = file_query( filename );
file_info_t const * const ff = file_query( path );
if ( !ff ) return -1;
*time = ff->time;
return 0;
@@ -275,15 +275,15 @@ static void file_dirscan_impl( OBJECT * dir, scanback func, void * closure )
LISTITER const end = list_end( d->files );
for ( ; iter != end; iter = list_next( iter ) )
{
OBJECT * const filename = list_item( iter );
file_info_t const * const ffq = file_query( filename );
OBJECT * const path = list_item( iter );
file_info_t const * const ffq = file_query( path );
/* The only way a file_query() call can fail is if its internal OS
* file information gathering API (e.g. stat()) failed. If that
* happens we should treat the file as if it no longer exists. We
* then request the raw cached file_info_t structure for that file
* and use the file name from there.
*/
file_info_t const * const ff = ffq ? ffq : file_info( filename );
file_info_t const * const ff = ffq ? ffq : file_info( path );
/* Using a file name read from a file_info_t structure allows OS
* specific implementations to store some kind of a normalized file
* name there. Using such a normalized file name then allows us to

View File

@@ -105,7 +105,7 @@ int file_collect_dir_content_( file_info_t * const d )
PATHNAME f;
DIR * dd;
STRUCT_DIRENT * dirent;
string filename[ 1 ];
string path[ 1 ];
char const * dirstr;
assert( d );
@@ -123,7 +123,7 @@ int file_collect_dir_content_( file_info_t * const d )
if ( !( dd = opendir( dirstr ) ) )
return -1;
string_new( filename );
string_new( path );
while ( ( dirent = readdir( dd ) ) )
{
f.f_base.ptr = dirent->d_name
@@ -133,11 +133,11 @@ int file_collect_dir_content_( file_info_t * const d )
;
f.f_base.len = strlen( f.f_base.ptr );
string_truncate( filename, 0 );
path_build( &f, filename, 0 );
files = list_push_back( files, object_new( filename->value ) );
string_truncate( path, 0 );
path_build( &f, path, 0 );
files = list_push_back( files, object_new( path->value ) );
}
string_free( filename );
string_free( path );
closedir( dd );
@@ -165,9 +165,9 @@ void file_dirscan_( file_info_t * const d, scanback func, void * closure )
* file_mkdir() - create a directory
*/
int file_mkdir( char const * const pathname )
int file_mkdir( char const * const path )
{
return mkdir( pathname, 0766 );
return mkdir( path, 0766 );
}