From 11e56456a042a6aec2e7e0b533acb195597af272 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Fri, 6 Jul 2012 15:30:27 -0700 Subject: [PATCH] Fix for wrong sense for determining when an autoloaded function has changed Addresses some of the complaints in https://github.com/fish-shell/fish-shell/pull/201 --- autoload.cpp | 8 ++++---- event.cpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/autoload.cpp b/autoload.cpp index 5e56f5e49..0bb621baf 100644 --- a/autoload.cpp +++ b/autoload.cpp @@ -197,12 +197,12 @@ bool autoload_t::locate_file_and_maybe_load_it( const wcstring &cmd, bool really if (! func) { /* Can't use a function that doesn't exist */ use_cached = false; - } else if ( ! allow_stale_functions && is_stale(func)) { - /* Can't use a stale function */ - use_cached = false; } else if (really_load && ! func->is_placeholder && ! func->is_loaded) { /* Can't use an unloaded function */ use_cached = false; + } else if ( ! allow_stale_functions && is_stale(func)) { + /* Can't use a stale function */ + use_cached = false; } else { /* I guess we can use it */ use_cached = true; @@ -266,7 +266,7 @@ bool autoload_t::locate_file_and_maybe_load_it( const wcstring &cmd, bool really autoload_function_t *func = this->get_node(cmd); /* Generate the source if we need to load it */ - bool need_to_load_function = really_load && (func == NULL || func->access.mod_time == access.mod_time || ! func->is_loaded); + bool need_to_load_function = really_load && (func == NULL || func->access.mod_time != access.mod_time || ! func->is_loaded); if (need_to_load_function) { /* Generate the script source */ diff --git a/event.cpp b/event.cpp index 368f2d6c0..4f58a390c 100644 --- a/event.cpp +++ b/event.cpp @@ -443,7 +443,7 @@ static void event_fire_internal( const event_t *event ) } } -// debug( 1, L"Event handler fires command '%ls'", (wchar_t *)b->buff ); +// debug( 1, L"Event handler fires command '%ls'", buffer.c_str() ); /* Event handlers are not part of the main flow of code, so @@ -454,7 +454,7 @@ static void event_fire_internal( const event_t *event ) parser_t &parser = parser_t::principal_parser(); parser.push_block( EVENT ); parser.current_block->state1() = event; - parser.eval( buffer.c_str(), 0, TOP ); + parser.eval( buffer, 0, TOP ); parser.pop_block(); proc_pop_interactive(); proc_set_last_status( prev_status );