Skip to content

Commit

Permalink
Fix #213. You can now remove autoloaded functions.
Browse files Browse the repository at this point in the history
Oddly enough, the code is here, but is internal function.
  • Loading branch information
Konrad Borowski committed Oct 12, 2013
1 parent 97e731e commit 1349d12
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion builtin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1339,7 +1339,7 @@ static int builtin_functions(parser_t &parser, wchar_t **argv)
{
int i;
for (i=woptind; i<argc; i++)
function_remove(argv[i]);
function_remove_ignore_autoload(argv[i]);
return STATUS_BUILTIN_OK;
}
else if (desc)
Expand Down
5 changes: 1 addition & 4 deletions function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ function_autoload_t::function_autoload_t() : autoload_t(L"fish_function_path", N
{
}

/** Removes a function from our internal table, returning true if it was found and false if not */
static bool function_remove_ignore_autoload(const wcstring &name);

/** Callback when an autoloaded function is removed */
void function_autoload_t::command_removed(const wcstring &cmd)
{
Expand Down Expand Up @@ -220,7 +217,7 @@ int function_exists_no_autoload(const wcstring &cmd, const env_vars_snapshot_t &
return loaded_functions.find(cmd) != loaded_functions.end() || function_autoloader.can_load(cmd, vars);
}

static bool function_remove_ignore_autoload(const wcstring &name)
bool function_remove_ignore_autoload(const wcstring &name)
{
scoped_lock lock(functions_lock);
bool erased = (loaded_functions.erase(name) > 0);
Expand Down
3 changes: 3 additions & 0 deletions function.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ void function_init();
/** Add a function. */
void function_add(const function_data_t &data, const parser_t &parser);

/** Removes a function from our internal table, returning true if it was found and false if not */
bool function_remove_ignore_autoload(const wcstring &name);

/**
Remove the function with the specified name.
*/
Expand Down

0 comments on commit 1349d12

Please sign in to comment.