From c37c7cee0544a801f1031d725bdd1b743f341a57 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sat, 13 Apr 2013 01:32:07 -0700 Subject: [PATCH] Reduce compiled code size a bit --- builtin.cpp | 57 +++++++++++------------------------------------------ event.cpp | 8 ++++++++ event.h | 11 +++++------ 3 files changed, 25 insertions(+), 51 deletions(-) diff --git a/builtin.cpp b/builtin.cpp index c70880457..6b0fb3217 100644 --- a/builtin.cpp +++ b/builtin.cpp @@ -1743,7 +1743,6 @@ static int builtin_function(parser_t &parser, wchar_t **argv) int res=STATUS_BUILTIN_OK; wchar_t *desc=0; std::vector events; - std::auto_ptr named_arguments(NULL); wchar_t *name = 0; @@ -1754,50 +1753,19 @@ static int builtin_function(parser_t &parser, wchar_t **argv) function_def_block_t * const fdb = new function_def_block_t(); parser.push_block(fdb); - static const struct woption - long_options[] = + const struct woption long_options[] = { - { - L"description", required_argument, 0, 'd' - } - , - { - L"on-signal", required_argument, 0, 's' - } - , - { - L"on-job-exit", required_argument, 0, 'j' - } - , - { - L"on-process-exit", required_argument, 0, 'p' - } - , - { - L"on-variable", required_argument, 0, 'v' - } - , - { - L"on-event", required_argument, 0, 'e' - } - , - { - L"help", no_argument, 0, 'h' - } - , - { - L"argument-names", no_argument, 0, 'a' - } - , - { - L"no-scope-shadowing", no_argument, 0, 'S' - } - , - { - 0, 0, 0, 0 - } - } - ; + { L"description", required_argument, 0, 'd' }, + { L"on-signal", required_argument, 0, 's' }, + { L"on-job-exit", required_argument, 0, 'j' }, + { L"on-process-exit", required_argument, 0, 'p' }, + { L"on-variable", required_argument, 0, 'v' }, + { L"on-event", required_argument, 0, 'e' }, + { L"help", no_argument, 0, 'h' }, + { L"argument-names", no_argument, 0, 'a' }, + { L"no-scope-shadowing", no_argument, 0, 'S' }, + { 0, 0, 0, 0 } + }; while (1 && (!res)) { @@ -2081,7 +2049,6 @@ static int builtin_function(parser_t &parser, wchar_t **argv) parser.current_block->skip = 1; return STATUS_BUILTIN_OK; - } /** diff --git a/event.cpp b/event.cpp index 2be69493b..f6313fb0c 100644 --- a/event.cpp +++ b/event.cpp @@ -719,6 +719,14 @@ void event_fire_generic(const wchar_t *name, wcstring_list_t *args) event_fire(&ev); } +event_t::event_t(int t) : type(t), param1(), str_param1(), function_name(), arguments() +{ +} + +event_t::~event_t() +{ +} + event_t event_t::signal_event(int sig) { event_t event(EVENT_SIGNAL); diff --git a/event.h b/event.h index 73db7351d..5bcf28a5f 100644 --- a/event.h +++ b/event.h @@ -49,9 +49,9 @@ enum */ struct event_t { - /** - Type of event - */ + public: + + /** Type of event */ int type; /** The type-specific parameter. The int types are one of the following: @@ -86,9 +86,8 @@ struct event_t */ wcstring_list_t arguments; - event_t(int t) : type(t), param1(), str_param1(), function_name(), arguments() { } - - /** default copy constructor */ + event_t(int t); + ~event_t(); static event_t signal_event(int sig); static event_t variable_event(const wcstring &str);