From 452d6dbebada4a2dac886f77cc107ed0c9dfb3d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jurko=20Gospodneti=C4=87?= Date: Tue, 14 Aug 2012 04:44:24 +0000 Subject: [PATCH] Boost Jam cleanup - minor stylistic changes. [SVN r80019] --- src/engine/pathunix.c | 11 +++--- src/engine/pwd.c | 86 ++++++++++++++++++++++--------------------- 2 files changed, 50 insertions(+), 47 deletions(-) diff --git a/src/engine/pathunix.c b/src/engine/pathunix.c index b6457b498..f7411a1e2 100644 --- a/src/engine/pathunix.c +++ b/src/engine/pathunix.c @@ -4,11 +4,12 @@ * This file is part of Jam - see jam.c for Copyright information. */ -/* This file is ALSO: - * Copyright 2001-2004 David Abrahams. - * Copyright 2005 Rene Rivera. - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) +/* This file is ALSO: + * Copyright 2001-2004 David Abrahams. + * Copyright 2005 Rene Rivera. + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) */ /* diff --git a/src/engine/pwd.c b/src/engine/pwd.c index 93d812603..e24347434 100644 --- a/src/engine/pwd.c +++ b/src/engine/pwd.c @@ -1,75 +1,77 @@ -/* Copyright Vladimir Prus 2002, Rene Rivera 2005. Distributed under the Boost */ -/* Software License, Version 1.0. (See accompanying */ -/* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ +/* Copyright Vladimir Prus 2002, Rene Rivera 2005. + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + */ #include "jam.h" #include "lists.h" +#include "mem.h" #include "object.h" #include "pathsys.h" -#include "mem.h" -#include #include +#include /* MinGW on windows declares PATH_MAX in limits.h */ #if defined(NT) && ! defined(__GNUC__) -#include -#define PATH_MAX _MAX_PATH +# include +# define PATH_MAX _MAX_PATH #else -#include -#if defined(__COMO__) - #include -#endif +# include +# if defined(__COMO__) +# include +# endif #endif #ifndef PATH_MAX - #define PATH_MAX 1024 +# define PATH_MAX 1024 #endif -/* The current directory can't change in bjam, so optimize this to cache -** the result. +/* The current directory can not change in Boost Jam, so optimize pwd() by + * caching the result. */ -static OBJECT * pwd_result = NULL; +static OBJECT * pwd_result; -LIST* -pwd(void) +LIST * pwd( void ) { - if (!pwd_result) + if ( !pwd_result ) { - int buffer_size = PATH_MAX; - char * result_buffer = 0; - do - { - char * buffer = BJAM_MALLOC_RAW(buffer_size); - result_buffer = getcwd(buffer,buffer_size); - if (result_buffer) - { - #ifdef NT - OBJECT * result = object_new(result_buffer); - pwd_result = short_path_to_long_path(result); + int buffer_size = PATH_MAX; + char * result_buffer = 0; + do + { + char * const buffer = BJAM_MALLOC_RAW( buffer_size ); + result_buffer = getcwd( buffer, buffer_size ); + if ( result_buffer ) + { + #ifdef NT + OBJECT * const result = object_new( result_buffer ); + pwd_result = short_path_to_long_path( result ); object_free( result ); - #else - pwd_result = object_new(result_buffer); - #endif - } - buffer_size *= 2; - BJAM_FREE_RAW(buffer); - } - while (!pwd_result && errno == ERANGE); - - if (!pwd_result) - { - perror("can not get current directory"); + #else + pwd_result = object_new( result_buffer ); + #endif + } + buffer_size *= 2; + BJAM_FREE_RAW( buffer ); + } + while ( !pwd_result && errno == ERANGE ); + + if ( !pwd_result ) + { + perror( "can not get current directory" ); return L0; } } return list_new( object_copy( pwd_result ) ); } + void pwd_done( void ) { - if( pwd_result ) + if ( pwd_result ) { object_free( pwd_result ); }