From 84899fb2f8c7a2a869ee16b028af45308145820c Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Mon, 6 Apr 2015 08:38:18 -0700 Subject: [PATCH] Small tweaks to clarify some code Adds a comment about a recursive lock, and changes an ==1 to >0 for improved clarity --- function.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/function.cpp b/function.cpp index adb164792..5d113c24a 100644 --- a/function.cpp +++ b/function.cpp @@ -92,7 +92,7 @@ static int load(const wcstring &name) bool was_autoload = is_autoload; int res; - bool no_more_autoload = function_tombstones.count(name) == 1; + bool no_more_autoload = function_tombstones.count(name) > 0; if (no_more_autoload) 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) { + // Note: the lock may be held at this point, but is recursive scoped_lock lock(functions_lock); function_map_t::iterator iter = loaded_functions.find(name);