Reduce compiled code size a bit

This commit is contained in:
ridiculousfish 2013-04-13 01:32:07 -07:00
parent 46579f3799
commit c37c7cee05
3 changed files with 25 additions and 51 deletions

View file

@ -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<event_t> events;
std::auto_ptr<wcstring_list_t> 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;
}
/**

View file

@ -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);

11
event.h
View file

@ -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);