Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r77511 - trunk/tools/build/v2/engine
From: steven_at_[hidden]
Date: 2012-03-23 18:55:51


Author: steven_watanabe
Date: 2012-03-23 18:55:50 EDT (Fri, 23 Mar 2012)
New Revision: 77511
URL: http://svn.boost.org/trac/boost/changeset/77511

Log:
Change make to take a LIST *. There's no good reason to create a separate array.
Text files modified:
   trunk/tools/build/v2/engine/builtins.c | 15 ++-------------
   trunk/tools/build/v2/engine/jam.c | 10 +---------
   trunk/tools/build/v2/engine/make.c | 20 ++++++++++++--------
   trunk/tools/build/v2/engine/make.h | 2 +-
   4 files changed, 16 insertions(+), 31 deletions(-)

Modified: trunk/tools/build/v2/engine/builtins.c
==============================================================================
--- trunk/tools/build/v2/engine/builtins.c (original)
+++ trunk/tools/build/v2/engine/builtins.c 2012-03-23 18:55:50 EDT (Fri, 23 Mar 2012)
@@ -1360,16 +1360,11 @@
     LIST * log = lol_get( frame->args, 1 );
     LIST * force = lol_get( frame->args, 2 );
     LIST * continue_ = lol_get( frame->args, 3 );
- int status = 0;
+ int status;
     int original_stdout = 0;
     int original_stderr = 0;
- int n;
- int targets_count;
- OBJECT * * targets2;
- int i;
     int original_noexec = 0;
     int original_quitquick = 0;
- LISTITER iter, end;
         
 
     if ( !list_empty( log ) )
@@ -1396,13 +1391,7 @@
         globs.quitquick = 0;
     }
 
- targets_count = list_length( targets );
- targets2 = (OBJECT * *)BJAM_MALLOC( targets_count * sizeof( OBJECT * ) );
- iter = list_begin( targets ), end = list_end( targets );
- for (i = 0 ; iter != end; iter = list_next( iter ) )
- targets2[ i++ ] = list_item( iter );
- status |= make( targets_count, targets2, anyhow);
- BJAM_FREE( (void *)targets2 );
+ status = make( targets, anyhow );
 
     if ( !list_empty( force ) )
     {

Modified: trunk/tools/build/v2/engine/jam.c
==============================================================================
--- trunk/tools/build/v2/engine/jam.c (original)
+++ trunk/tools/build/v2/engine/jam.c 2012-03-23 18:55:50 EDT (Fri, 23 Mar 2012)
@@ -604,15 +604,7 @@
             LIST * targets = targets_to_update();
             if ( !list_empty( targets ) )
             {
- int targets_count = list_length( targets );
- LISTITER iter = list_begin( targets ), end = list_end( targets );
- OBJECT * * targets2 = (OBJECT * *)
- BJAM_MALLOC( targets_count * sizeof( OBJECT * ) );
- int n = 0;
- for ( ; iter != end; iter = list_next( iter ) )
- targets2[ n++ ] = list_item( iter );
- status |= make( targets_count, targets2, anyhow );
- BJAM_FREE( (void *)targets2 );
+ status |= make( targets, anyhow );
             }
             else
             {

Modified: trunk/tools/build/v2/engine/make.c
==============================================================================
--- trunk/tools/build/v2/engine/make.c (original)
+++ trunk/tools/build/v2/engine/make.c 2012-03-23 18:55:50 EDT (Fri, 23 Mar 2012)
@@ -106,9 +106,8 @@
  * make() - make a target, given its name.
  */
 
-int make( int n_targets, OBJECT * * targets, int anyhow )
+int make( LIST * targets, int anyhow )
 {
- int i;
     COUNTS counts[ 1 ];
     int status = 0; /* 1 if anything fails */
 
@@ -124,10 +123,11 @@
     bind_explicitly_located_targets();
 
     {
+ LISTITER iter, end;
         PROFILE_ENTER( MAKE_MAKE0 );
- for ( i = 0; i < n_targets; ++i )
+ for ( iter = list_begin( targets ), end = list_end( targets ); iter != end; iter = list_next( iter ) )
         {
- TARGET * t = bindtarget( targets[ i ] );
+ TARGET * t = bindtarget( list_item( iter ) );
             if ( t->fate == T_FATE_INIT )
                 make0( t, 0, 0, counts, anyhow );
         }
@@ -136,8 +136,11 @@
 
 #ifdef OPT_GRAPH_DEBUG_EXT
     if ( DEBUG_GRAPH )
- for ( i = 0; i < n_targets; ++i )
- dependGraphOutput( bindtarget( targets[ i ] ), 0 );
+ {
+ LISTITER iter, end;
+ for ( iter = list_begin( targets ), end = list_end( targets ); iter != end; iter = list_next( iter ) )
+ dependGraphOutput( bindtarget( list_item( iter ) ), 0 );
+ }
 #endif
 
     if ( DEBUG_MAKE )
@@ -162,9 +165,10 @@
     status = counts->cantfind || counts->cantmake;
 
     {
+ LISTITER iter, end;
         PROFILE_ENTER( MAKE_MAKE1 );
- for ( i = 0; i < n_targets; ++i )
- status |= make1( bindtarget( targets[ i ] ) );
+ for ( iter = list_begin( targets ), end = list_end( targets ); iter != end; iter = list_next( iter ) )
+ status |= make1( bindtarget( list_item( iter ) ) );
         PROFILE_EXIT( MAKE_MAKE1 );
     }
 

Modified: trunk/tools/build/v2/engine/make.h
==============================================================================
--- trunk/tools/build/v2/engine/make.h (original)
+++ trunk/tools/build/v2/engine/make.h 2012-03-23 18:55:50 EDT (Fri, 23 Mar 2012)
@@ -14,7 +14,7 @@
 #include "lists.h"
 #include "object.h"
 
-int make( int n_targets, OBJECT * * targets, int anyhow );
+int make( LIST * targets, int anyhow );
 int make1( TARGET * t );
 
 typedef struct {


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk