1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-02 20:25:43 +02:00

fset: replace hashtable by a simple structure for max length of fields

This commit is contained in:
Sébastien Helleu
2017-06-28 19:59:45 +02:00
parent f851246ff6
commit 987ef9e454
4 changed files with 193 additions and 141 deletions
File diff suppressed because it is too large Load Diff
+8 -7
View File
@@ -459,7 +459,8 @@ fset_command_run_set_cb (const void *pointer, void *data,
const char *ptr_condition;
int rc, argc, old_count_marked, old_buffer_selected_line, condition_ok;
struct t_arraylist *old_options;
struct t_hashtable *old_max_length_field, *eval_extra_vars, *eval_options;
struct t_fset_option_max_length *old_max_length;
struct t_hashtable *eval_extra_vars, *eval_options;
/* make C compiler happy */
(void) pointer;
@@ -495,8 +496,8 @@ fset_command_run_set_cb (const void *pointer, void *data,
old_options = fset_options;
fset_options = fset_option_get_arraylist_options ();
old_count_marked = fset_option_count_marked;
old_max_length_field = fset_option_max_length_field;
fset_option_max_length_field = fset_option_get_hashtable_max_length_field ();
old_max_length = fset_option_max_length;
fset_option_max_length = fset_option_get_max_length ();
old_filter = (fset_option_filter) ? strdup (fset_option_filter) : NULL;
fset_option_set_filter ((argc > 1) ? argv[1] : NULL);
old_buffer_selected_line = fset_buffer_selected_line;
@@ -543,8 +544,8 @@ fset_command_run_set_cb (const void *pointer, void *data,
{
if (old_options)
weechat_arraylist_free (old_options);
if (old_max_length_field)
weechat_hashtable_free (old_max_length_field);
if (old_max_length)
free (old_max_length);
if (old_filter)
free (old_filter);
@@ -562,8 +563,8 @@ fset_command_run_set_cb (const void *pointer, void *data,
weechat_arraylist_free (fset_options);
fset_options = old_options;
fset_option_count_marked = old_count_marked;
weechat_hashtable_free (fset_option_max_length_field);
fset_option_max_length_field = old_max_length_field;
free (fset_option_max_length);
fset_option_max_length = old_max_length;
fset_option_set_filter (old_filter);
if (old_filter)
free (old_filter);
File diff suppressed because it is too large Load Diff
+27 -2
View File
@@ -53,9 +53,34 @@ struct t_fset_option
struct t_fset_option *next_option; /* link to next option */
};
struct t_fset_option_max_length
{
int file;
int section;
int option;
int name;
int parent_name;
int type;
int type_en;
int type_short;
int type_tiny;
int default_value;
int value;
int parent_value;
int value2;
int min;
int max;
int description;
int description2;
int description_en;
int description_en2;
int string_values;
int marked;
};
extern struct t_arraylist *fset_options;
extern int fset_option_count_marked;
extern struct t_hashtable *fset_option_max_length_field;
extern struct t_fset_option_max_length *fset_option_max_length;
extern char *fset_option_filter;
extern char *fset_option_type_string[];
extern char *fset_option_type_string_short[];
@@ -68,7 +93,7 @@ extern int fset_option_value_is_changed (struct t_fset_option *option);
extern void fset_option_set_max_length_fields_all ();
extern void fset_option_free (struct t_fset_option *fset_option);
extern struct t_arraylist *fset_option_get_arraylist_options ();
extern struct t_hashtable *fset_option_get_hashtable_max_length_field ();
extern struct t_fset_option_max_length *fset_option_get_max_length ();
extern void fset_option_get_options ();
extern void fset_option_set_filter (const char *filter);
extern void fset_option_filter_options (const char *filter);