Small tweaks to clarify some code

Adds a comment about a recursive lock, and changes an ==1 to >0
for improved clarity
This commit is contained in:
ridiculousfish 2015-04-06 08:38:18 -07:00
parent 73f344f41b
commit 84899fb2f8

View file

@ -92,7 +92,7 @@ static int load(const wcstring &name)
bool was_autoload = is_autoload; bool was_autoload = is_autoload;
int res; int res;
bool no_more_autoload = function_tombstones.count(name) == 1; bool no_more_autoload = function_tombstones.count(name) > 0;
if (no_more_autoload) if (no_more_autoload)
return 0; return 0;
@ -239,6 +239,7 @@ int function_exists_no_autoload(const wcstring &cmd, const env_vars_snapshot_t &
static bool function_remove_ignore_autoload(const wcstring &name) static bool function_remove_ignore_autoload(const wcstring &name)
{ {
// Note: the lock may be held at this point, but is recursive
scoped_lock lock(functions_lock); scoped_lock lock(functions_lock);
function_map_t::iterator iter = loaded_functions.find(name); function_map_t::iterator iter = loaded_functions.find(name);