aboutsummaryrefslogtreecommitdiffhomepage
path: root/env.cpp
diff options
context:
space:
mode:
authorGravatar Jan Kanis <jan.code@jankanis.nl>2012-12-20 10:52:44 +0100
committerGravatar Jan Kanis <jan.code@jankanis.nl>2012-12-20 16:13:14 +0100
commit71233ee89476aa92782ac8288eba6c1485a8477e (patch)
tree2d9bc3087226cc23d4b4b3f0d7ff35a4a0e0a573 /env.cpp
parentaf3059ab2ad4ccbfec3c0789b198388cc90fbcbb (diff)
Make event_t.arguments into a vector instead of an auto_ptr<vector>.
Yay for less indirection and less code! The resulting event_t structure is two pointers larger, but cuts out an indirection and allocation.
Diffstat (limited to 'env.cpp')
-rw-r--r--env.cpp24
1 files changed, 9 insertions, 15 deletions
diff --git a/env.cpp b/env.cpp
index 035fee4e..183144c7 100644
--- a/env.cpp
+++ b/env.cpp
@@ -415,12 +415,10 @@ static void universal_callback(fish_message_type_t type,
mark_changed_exported();
event_t ev = event_t::variable_event(name);
- ev.arguments.reset(new wcstring_list_t());
- ev.arguments->push_back(L"VARIABLE");
- ev.arguments->push_back(str);
- ev.arguments->push_back(name);
+ ev.arguments.push_back(L"VARIABLE");
+ ev.arguments.push_back(str);
+ ev.arguments.push_back(name);
event_fire(&ev);
- ev.arguments.reset(NULL);
}
if (name)
@@ -979,15 +977,13 @@ int env_set(const wcstring &key, const wchar_t *val, int var_mode)
if (!is_universal)
{
event_t ev = event_t::variable_event(key);
- ev.arguments.reset(new wcstring_list_t);
- ev.arguments->push_back(L"VARIABLE");
- ev.arguments->push_back(L"SET");
- ev.arguments->push_back(key);
+ ev.arguments.push_back(L"VARIABLE");
+ ev.arguments.push_back(L"SET");
+ ev.arguments.push_back(key);
// debug( 1, L"env_set: fire events on variable %ls", key );
event_fire(&ev);
// debug( 1, L"env_set: return from event firing" );
- ev.arguments.reset(NULL);
}
react_to_variable_change(key);
@@ -1066,14 +1062,12 @@ int env_remove(const wcstring &key, int var_mode)
if (try_remove(first_node, key.c_str(), var_mode))
{
event_t ev = event_t::variable_event(key);
- ev.arguments.reset(new wcstring_list_t);
- ev.arguments->push_back(L"VARIABLE");
- ev.arguments->push_back(L"ERASE");
- ev.arguments->push_back(key);
+ ev.arguments.push_back(L"VARIABLE");
+ ev.arguments.push_back(L"ERASE");
+ ev.arguments.push_back(key);
event_fire(&ev);
- ev.arguments.reset(NULL);
erased = 1;
}
}