diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2012-03-03 15:20:30 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2012-03-03 15:22:03 -0800 |
commit | 3ead99b0883c49d465a90a6746409003d7224190 (patch) | |
tree | fad0ab467226584b975328b305fded21b980239e /function.h | |
parent | 8c0803e3c5d9cb874f5dd69ee2727eb4be99bfac (diff) |
Put fish on a diet. Tracked down the biggest memory hogs and fixed them. Total allocations down by a factor of 3 or so, live allocations a few KB.
Diffstat (limited to 'function.h')
-rw-r--r-- | function.h | 52 |
1 files changed, 22 insertions, 30 deletions
@@ -60,37 +60,32 @@ struct function_data_t class function_info_t { public: + /** Constructs relevant information from the function_data */ + function_info_t(const function_data_t &data, const wchar_t *filename, int def_offset, bool autoload); + + /** Used by function_copy */ + function_info_t(const function_info_t &data, const wchar_t *filename, int def_offset, bool autoload); + /** Function definition */ - wcstring definition; + const wcstring definition; - /** Function description */ + /** Function description. Only the description may be changed after the function is created. */ wcstring description; - /** - File where this function was defined (intern'd string) - */ - const wchar_t *definition_file; + /** File where this function was defined (intern'd string) */ + const wchar_t * const definition_file; - /** - Line where definition started - */ - int definition_offset; + /** Line where definition started */ + const int definition_offset; - /** - List of all named arguments for this function - */ - wcstring_list_t named_arguments; + /** List of all named arguments for this function */ + const wcstring_list_t named_arguments; - /** - Flag for specifying that this function was automatically loaded - */ - bool is_autoload; + /** Flag for specifying that this function was automatically loaded */ + const bool is_autoload; - /** - Set to non-zero if invoking this function shadows the variables - of the underlying function. - */ - bool shadows; + /** Set to true if invoking this function shadows the variables of the underlying function. */ + const bool shadows; }; @@ -99,11 +94,8 @@ public: */ void function_init(); -/** - Add a function. The parameters values are copied and should be - freed by the caller. -*/ -void function_add( function_data_t *data, const parser_t &parser ); +/** Add a function. */ +void function_add( const function_data_t &data, const parser_t &parser ); /** Remove the function with the specified name. @@ -172,9 +164,9 @@ wcstring_list_t function_get_named_arguments( const wcstring &name ); /** Creates a new function using the same definition as the specified function. - Returns non-zero if copy is successful. + Returns true if copy is successful. */ -int function_copy( const wcstring &name, const wcstring &new_name ); +bool function_copy( const wcstring &name, const wcstring &new_name ); /** |