Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC)
- Fix for possible unset uid/gid in toproto
- Fix for default mtree style
- Update libelf
- Importing libexecinfo
- Resynchronize GCC, mpc, gmp, mpfr
- build.sh: Replace params with show-params.
This has been done as the make target has been renamed in the same
way, while a new target named params has been added. This new
target generates a file containing all the parameters, instead of
printing it on the console.
- Update test48 with new etc/services (Fix by Ben Gras <ben@minix3.org)
get getservbyport() out of the inner loop
Change-Id: Ie6ad5226fa2621ff9f0dee8782ea48f9443d2091
This commit is contained in:
@@ -42,7 +42,7 @@ namespace {
|
||||
|
||||
/// Gets the tree singleton stored in the Lua state.
|
||||
///
|
||||
/// \param state The Lua state. The metadata of _G must contain a key named
|
||||
/// \param state The Lua state. The registry must contain a key named
|
||||
/// "tree" with a pointer to the singleton.
|
||||
///
|
||||
/// \return A reference to the tree associated with the Lua state.
|
||||
@@ -53,10 +53,15 @@ get_global_tree(lutok::state& state)
|
||||
{
|
||||
lutok::stack_cleaner cleaner(state);
|
||||
|
||||
if (!state.get_metafield(lutok::globals_index, "tree"))
|
||||
state.push_value(lutok::registry_index);
|
||||
state.push_string("tree");
|
||||
state.get_table(-2);
|
||||
if (state.is_nil())
|
||||
throw config::syntax_error("Cannot find tree singleton; global state "
|
||||
"corrupted?");
|
||||
return **state.to_userdata< config::tree* >();
|
||||
config::tree& tree = **state.to_userdata< config::tree* >();
|
||||
state.pop(1);
|
||||
return tree;
|
||||
}
|
||||
|
||||
|
||||
@@ -254,7 +259,7 @@ config::redirect(lutok::state& state, tree& out_tree)
|
||||
{
|
||||
lutok::stack_cleaner cleaner(state);
|
||||
|
||||
state.new_table();
|
||||
state.get_global_table();
|
||||
{
|
||||
state.push_string("__index");
|
||||
state.push_cxx_function(redirect_index);
|
||||
@@ -263,11 +268,13 @@ config::redirect(lutok::state& state, tree& out_tree)
|
||||
state.push_string("__newindex");
|
||||
state.push_cxx_function(redirect_newindex);
|
||||
state.set_table(-3);
|
||||
|
||||
state.push_string("tree");
|
||||
config::tree** tree = state.new_userdata< config::tree* >();
|
||||
*tree = &out_tree;
|
||||
state.set_table(-3);
|
||||
}
|
||||
state.set_metatable(lutok::globals_index);
|
||||
state.set_metatable(-1);
|
||||
|
||||
state.push_value(lutok::registry_index);
|
||||
state.push_string("tree");
|
||||
config::tree** tree = state.new_userdata< config::tree* >();
|
||||
*tree = &out_tree;
|
||||
state.set_table(-3);
|
||||
state.pop(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user