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

Applied path from Yakov Markovitch: [ 1538176 ] VARNAMES bjam rule doesn't work for global module.

[SVN r34987]
This commit is contained in:
Rene Rivera
2006-08-28 19:31:34 +00:00
parent bc17d322f8
commit 38e6e08970

View File

@@ -937,6 +937,17 @@ static void add_hash_key( void* np, void* result_ )
*result = list_new( *result, copystr( *(char**)np ) );
}
static struct hash *get_running_module_vars()
{
struct hash *dummy, *vars = NULL;
/* Get the global variables pointer (that of the currently running module) */
var_hash_swap(&vars);
dummy = vars;
/* Put the global variables pointer in its right place */
var_hash_swap(&dummy);
return vars;
}
LIST *
builtin_varnames(
PARSE *parse,
@@ -946,8 +957,14 @@ builtin_varnames(
LIST *result = L0;
module_t* source_module = bindmodule( arg0 ? arg0->string : 0 );
if ( source_module->variables )
hashenumerate( source_module->variables, add_hash_key, &result );
/* The running module _always_ has its 'variables' member set to NULL
* due to the way enter_module and var_hash_swap work */
struct hash *vars =
source_module == frame->module ?
get_running_module_vars() : source_module->variables;
if ( vars )
hashenumerate( vars, add_hash_key, &result );
return result;
}