fish-shell/fish-shell — pull request #467 by JanKanis (2012-12-20 15:19:43+00:00)
Title: fix for #499 and some more

Doing a merge request of my master and then continuing editing my master doesn't work too well on github. So here's a new pull request instead of #465, with a different name and some rebasing/merging done. Currently it merges cleanly with fish-shell/master.

The branch contains a number of things (which not necessarily need all be merged). When I was working on event.cpp I decided to do some refactoring as well.

- The first two commits fix the bug and add a test. I also ended up writing an event-to-string function (event_type_str) which ended up quite similar to event_get_desc, but it is more concise and shows a bit more information which was helpful for debugging, so I left it in with two debug statements using it. The actual fix is just two lines.
- The third commit changes the emit builtin to properly handle arguments. The old emit accepts multiple arguments and fires an event for each argument. I think there's no reason to do that, so I changed it to allow firing events with arguments, which I think is much more useful. Judging by the signature of event_fire_generic I would think this was the originally envisioned behavior as well. In order to get it to work I also changed the signature of event_fire_generic.
- Commit 4 changes event_t.arguments from an auto_ptr to a wcstring_list_t, saving an allocation and indirection and some pointer handling code, at the cost of a slightly larger event_t struct.
- In commit 5 I changed all functions in event.cpp where it made sense to take references instead of pointers. This is under the assumption that some of the C-isms are better off being C++ified. Correct me if I'm wrong.