Commit be4ee5d7 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Use new macros

Signed-off-by: Sebastian Ramacher's avatarSebastian Ramacher <sebastian+dev@ramacher.at>
parent 9bf796c9
......@@ -90,7 +90,7 @@ girara_callback_view_key_press_event(GtkWidget* UNUSED(widget),
girara_session_private_t* session_private = session->private_data;
/* prepare event */
GIRARA_LIST_FOREACH(session->bindings.shortcuts, girara_shortcut_t*, iter, shortcut)
GIRARA_LIST_FOREACH_BODY_WITH_ITER(session->bindings.shortcuts, girara_shortcut_t*, iter, shortcut,
if (session_private->buffer.command != NULL) {
break;
}
......@@ -123,7 +123,7 @@ girara_callback_view_key_press_event(GtkWidget* UNUSED(widget),
girara_list_iterator_free(iter);
return TRUE;
}
GIRARA_LIST_FOREACH_END(session->bindings.shortcuts, girara_shortcut_t*, iter, shortcut);
);
/* update buffer */
if (keyval >= 0x21 && keyval <= 0x7E) {
......@@ -155,7 +155,7 @@ girara_callback_view_key_press_event(GtkWidget* UNUSED(widget),
if (session_private->buffer.command != NULL) {
bool matching_command = FALSE;
GIRARA_LIST_FOREACH(session->bindings.shortcuts, girara_shortcut_t*, iter, shortcut)
GIRARA_LIST_FOREACH_BODY_WITH_ITER(session->bindings.shortcuts, girara_shortcut_t*, iter, shortcut,
if (shortcut->buffered_command != NULL) {
/* buffer could match a command */
if (!strncmp(session_private->buffer.command->str, shortcut->buffered_command, session_private->buffer.command->len)) {
......@@ -186,7 +186,7 @@ girara_callback_view_key_press_event(GtkWidget* UNUSED(widget),
matching_command = TRUE;
}
}
GIRARA_LIST_FOREACH_END(session->bindings.shortcuts, girara_shortcut_t*, iter, shortcut);
);
/* free buffer if buffer will never match a command */
if (matching_command == false) {
......@@ -237,7 +237,7 @@ girara_callback_view_button_press_event(GtkWidget* UNUSED(widget),
girara_session_private_t* session_private = session->private_data;
/* search registered mouse events */
GIRARA_LIST_FOREACH(session->bindings.mouse_events, girara_mouse_event_t*, iter, mouse_event)
GIRARA_LIST_FOREACH_BODY_WITH_ITER(session->bindings.mouse_events, girara_mouse_event_t*, iter, mouse_event,
if (mouse_event->function != NULL
&& button->button == mouse_event->button
&& state == mouse_event->mask
......@@ -248,7 +248,7 @@ girara_callback_view_button_press_event(GtkWidget* UNUSED(widget),
girara_list_iterator_free(iter);
return true;
}
GIRARA_LIST_FOREACH_END(session->bindings.mouse_events, girara_mouse_event_t*, iter, mouse_event);
);
return false;
}
......@@ -270,7 +270,7 @@ girara_callback_view_button_release_event(GtkWidget* UNUSED(widget), GdkEventBut
girara_session_private_t* session_private = session->private_data;
/* search registered mouse events */
GIRARA_LIST_FOREACH(session->bindings.mouse_events, girara_mouse_event_t*, iter, mouse_event)
GIRARA_LIST_FOREACH_BODY_WITH_ITER(session->bindings.mouse_events, girara_mouse_event_t*, iter, mouse_event,
if (mouse_event->function != NULL
&& button->button == mouse_event->button
&& state == mouse_event->mask
......@@ -281,7 +281,7 @@ girara_callback_view_button_release_event(GtkWidget* UNUSED(widget), GdkEventBut
girara_list_iterator_free(iter);
return true;
}
GIRARA_LIST_FOREACH_END(session->bindings.mouse_events, girara_mouse_event_t*, iter, mouse_event);
);
return false;
}
......@@ -303,7 +303,7 @@ girara_callback_view_button_motion_notify_event(GtkWidget* UNUSED(widget), GdkEv
girara_session_private_t* session_private = session->private_data;
/* search registered mouse events */
GIRARA_LIST_FOREACH(session->bindings.mouse_events, girara_mouse_event_t*, iter, mouse_event)
GIRARA_LIST_FOREACH_BODY_WITH_ITER(session->bindings.mouse_events, girara_mouse_event_t*, iter, mouse_event,
if (mouse_event->function != NULL
&& state == mouse_event->mask
&& mouse_event->event_type == event.type
......@@ -313,7 +313,7 @@ girara_callback_view_button_motion_notify_event(GtkWidget* UNUSED(widget), GdkEv
girara_list_iterator_free(iter);
return true;
}
GIRARA_LIST_FOREACH_END(session->bindings.mouse_events, girara_mouse_event_t*, iter, mouse_event);
);
return false;
}
......@@ -357,7 +357,7 @@ girara_callback_view_scroll_event(GtkWidget* UNUSED(widget), GdkEventScroll* scr
/* search registered mouse events */
/* TODO: Filter correct event */
GIRARA_LIST_FOREACH(session->bindings.mouse_events, girara_mouse_event_t*, iter, mouse_event)
GIRARA_LIST_FOREACH_BODY_WITH_ITER(session->bindings.mouse_events, girara_mouse_event_t*, iter, mouse_event,
if (mouse_event->function != NULL
&& state == mouse_event->mask
&& mouse_event->event_type == event.type
......@@ -367,7 +367,7 @@ girara_callback_view_scroll_event(GtkWidget* UNUSED(widget), GdkEventScroll* scr
girara_list_iterator_free(iter);
return true;
}
GIRARA_LIST_FOREACH_END(session->bindings.mouse_events, girara_mouse_event_t*, iter, mouse_event);
);
return false;
}
......@@ -426,7 +426,7 @@ girara_callback_inputbar_activate(GtkEntry* entry, girara_session_t* session)
g_free(identifier_s);
girara_debug("Processing special command with identifier '%c'.", identifier);
GIRARA_LIST_FOREACH(session->bindings.special_commands, girara_special_command_t*, iter, special_command)
GIRARA_LIST_FOREACH_BODY_WITH_ITER(session->bindings.special_commands, girara_special_command_t*, iter, special_command,
if (special_command->identifier == identifier) {
girara_debug("Found special command.");
if (special_command->always != true) {
......@@ -438,7 +438,7 @@ girara_callback_inputbar_activate(GtkEntry* entry, girara_session_t* session)
girara_list_iterator_free(iter);
return true;
}
GIRARA_LIST_FOREACH_END(session->bindings.special_commands, girara_special_command_t*, iter, special_command);
);
/* parse input */
gchar** argv = NULL;
......@@ -453,10 +453,9 @@ girara_callback_inputbar_activate(GtkEntry* entry, girara_session_t* session)
gchar *cmd = argv[0];
/* search commands */
GIRARA_LIST_FOREACH(session->bindings.commands, girara_command_t*, iter, command)
GIRARA_LIST_FOREACH_BODY_WITH_ITER(session->bindings.commands, girara_command_t*, iter, command,
if ((g_strcmp0(cmd, command->command) == 0) ||
(g_strcmp0(cmd, command->abbr) == 0))
{
(g_strcmp0(cmd, command->abbr) == 0)) {
girara_list_t* argument_list = girara_list_new();
if (argument_list == NULL) {
g_free(input);
......@@ -487,7 +486,7 @@ girara_callback_inputbar_activate(GtkEntry* entry, girara_session_t* session)
girara_list_iterator_free(iter);
return true;
}
GIRARA_LIST_FOREACH_END(session->bindings.commands, girara_command_t*, iter, command);
);
/* check for unknown command event handler */
if (session->events.unknown_command != NULL) {
......@@ -542,10 +541,9 @@ girara_callback_inputbar_key_press_event(GtkWidget* entry, GdkEventKey* event, g
girara_debug("Proccessing key %u with mask %x.", keyval, clean);
if (custom_ret == false) {
GIRARA_LIST_FOREACH(session->bindings.inputbar_shortcuts, girara_inputbar_shortcut_t*, iter, inputbar_shortcut)
GIRARA_LIST_FOREACH_BODY_WITH_ITER(session->bindings.inputbar_shortcuts, girara_inputbar_shortcut_t*, iter, inputbar_shortcut,
if (inputbar_shortcut->key == keyval
&& inputbar_shortcut->mask == clean)
{
&& inputbar_shortcut->mask == clean) {
girara_debug("found shortcut for key %u and mask %x", keyval, clean);
if (inputbar_shortcut->function != NULL) {
inputbar_shortcut->function(session, &(inputbar_shortcut->argument), NULL, 0);
......@@ -554,7 +552,7 @@ girara_callback_inputbar_key_press_event(GtkWidget* entry, GdkEventKey* event, g
girara_list_iterator_free(iter);
return true;
}
GIRARA_LIST_FOREACH_END(session->bindings.inputbar_shortcuts, girara_inputbar_shortcut_t*, iter, inputbar_shortcut);
);
}
if ((session->gtk.results != NULL) &&
......@@ -581,17 +579,16 @@ girara_callback_inputbar_changed_event(GtkEditable* entry, girara_session_t* ses
char identifier = identifier_s[0];
g_free(identifier_s);
GIRARA_LIST_FOREACH(session->bindings.special_commands, girara_special_command_t*, iter, special_command)
GIRARA_LIST_FOREACH_BODY_WITH_ITER(session->bindings.special_commands, girara_special_command_t*, iter, special_command,
if ((special_command->identifier == identifier) &&
(special_command->always == true))
{
(special_command->always == true)) {
gchar *input = gtk_editable_get_chars(GTK_EDITABLE(entry), 1, -1);
special_command->function(session, input, &(special_command->argument));
g_free(input);
girara_list_iterator_free(iter);
return true;
}
GIRARA_LIST_FOREACH_END(session->bindings.special_commands, girara_special_command_t*, iter, special_command);
);
return false;
}
......@@ -132,13 +132,13 @@ girara_cmd_map_unmap(girara_session_t* session, girara_list_t* argument_list,
if (tmp_length >= 3 && tmp[0] == '[' && tmp[tmp_length - 1] == ']') {
char* tmp_inner = g_strndup(tmp + 1, tmp_length - 2);
GIRARA_LIST_FOREACH(session->modes.identifiers, girara_mode_string_t*, iter, mode)
GIRARA_LIST_FOREACH_BODY(session->modes.identifiers, girara_mode_string_t*, mode,
if (!g_strcmp0(tmp_inner, mode->name)) {
shortcut_mode = mode->index;
is_mode = true;
break;
}
GIRARA_LIST_FOREACH_END(session->modes.identifiers, girara_mode_string_t*, iter, mode);
);
if (is_mode == false) {
girara_warning("Unregistered mode specified: %s", tmp_inner);
......@@ -322,13 +322,13 @@ girara_cmd_map_unmap(girara_session_t* session, girara_list_t* argument_list,
/* Check for passed shortcut command */
if (unmap == false) {
bool found_mapping = false;
GIRARA_LIST_FOREACH(session_private->config.shortcut_mappings, girara_shortcut_mapping_t*, iter, mapping)
GIRARA_LIST_FOREACH_BODY(session_private->config.shortcut_mappings, girara_shortcut_mapping_t*, mapping,
if (!g_strcmp0(tmp, mapping->identifier)) {
shortcut_function = mapping->function;
found_mapping = true;
break;
}
GIRARA_LIST_FOREACH_END(session_private->config.shortcut_mappings, girara_shortcut_mapping_t*, iter, mapping);
);
if (found_mapping == false) {
girara_warning("Not a valid shortcut function: %s", tmp);
......@@ -345,12 +345,12 @@ girara_cmd_map_unmap(girara_session_t* session, girara_list_t* argument_list,
if (++current_command < number_of_arguments) {
tmp = (char*) girara_list_nth(argument_list, current_command);
GIRARA_LIST_FOREACH(session_private->config.argument_mappings, girara_argument_mapping_t*, iter, mapping)
GIRARA_LIST_FOREACH_BODY(session_private->config.argument_mappings, girara_argument_mapping_t*, mapping,
if (!g_strcmp0(tmp, mapping->identifier)) {
shortcut_argument_n = mapping->value;
break;
}
GIRARA_LIST_FOREACH_END(session_private->config.argument_mappings, girara_argument_mapping_t*, iter, mapping);
);
/* If no known argument is passed we save it in the data field */
if (shortcut_argument_n == 0) {
......@@ -535,7 +535,7 @@ girara_inputbar_command_add(girara_session_t* session, const char* command,
g_return_val_if_fail(function != NULL, false);
/* search for existing binding */
GIRARA_LIST_FOREACH(session->bindings.commands, girara_command_t*, iter, commands_it)
GIRARA_LIST_FOREACH_BODY_WITH_ITER(session->bindings.commands, girara_command_t*, iter, commands_it,
if (g_strcmp0(commands_it->command, command) == 0) {
g_free(commands_it->abbr);
g_free(commands_it->description);
......@@ -548,7 +548,7 @@ girara_inputbar_command_add(girara_session_t* session, const char* command,
girara_list_iterator_free(iter);
return true;
}
GIRARA_LIST_FOREACH_END(session->bindings.commands, girara_command_t*, iter, commands_it);
);
/* add new inputbar command */
girara_command_t* new_command = g_slice_new(girara_command_t);
......@@ -572,7 +572,7 @@ girara_special_command_add(girara_session_t* session, char identifier, girara_in
girara_argument_t argument = {argument_n, argument_data};
/* search for existing special command */
GIRARA_LIST_FOREACH(session->bindings.special_commands, girara_special_command_t*, iter, scommand_it)
GIRARA_LIST_FOREACH_BODY_WITH_ITER(session->bindings.special_commands, girara_special_command_t*, iter, scommand_it,
if (scommand_it->identifier == identifier) {
scommand_it->function = function;
scommand_it->always = always;
......@@ -580,7 +580,7 @@ girara_special_command_add(girara_session_t* session, char identifier, girara_in
girara_list_iterator_free(iter);
return true;
}
GIRARA_LIST_FOREACH_END(session->bindings.special_commands, girara_special_command_t*, iter, scommand_it);
);
/* create new special command */
girara_special_command_t* special_command = g_slice_new(girara_special_command_t);
......
......@@ -263,7 +263,7 @@ girara_isc_completion(girara_session_t* session, girara_argument_t* argument, gi
command_mode = true;
/* create command rows */
GIRARA_LIST_FOREACH(session->bindings.commands, girara_command_t*, iter, command)
GIRARA_LIST_FOREACH_BODY(session->bindings.commands, girara_command_t*, command,
if (current_command == NULL ||
(command->command != NULL && !strncmp(current_command, command->command, current_command_length)) ||
(command->abbr != NULL && !strncmp(current_command, command->abbr, current_command_length))
......@@ -280,7 +280,7 @@ girara_isc_completion(girara_session_t* session, girara_argument_t* argument, gi
/* show entry row */
gtk_box_pack_start(session->gtk.results, GTK_WIDGET(entry->widget), FALSE, FALSE, 0);
}
GIRARA_LIST_FOREACH_END(session->bindings.commands, girara_command_t*, iter, command);
);
}
/* based on parameters */
......@@ -303,7 +303,7 @@ girara_isc_completion(girara_session_t* session, girara_argument_t* argument, gi
/* search matching command */
girara_command_t* command = NULL;
GIRARA_LIST_FOREACH(session->bindings.commands, girara_command_t*, iter, command_it)
GIRARA_LIST_FOREACH_BODY(session->bindings.commands, girara_command_t*, command_it,
if ( (current_command != NULL && command_it->command != NULL && !strncmp(current_command, command_it->command, current_command_length)) ||
(current_command != NULL && command_it->abbr != NULL && !strncmp(current_command, command_it->abbr, current_command_length))
)
......@@ -313,7 +313,7 @@ girara_isc_completion(girara_session_t* session, girara_argument_t* argument, gi
command = command_it;
break;
}
GIRARA_LIST_FOREACH_END(session->bindings.commands, girara_command_t*, iter, command_it);
);
if (command == NULL) {
g_free(current_command);
......@@ -348,7 +348,7 @@ girara_isc_completion(girara_session_t* session, girara_argument_t* argument, gi
return false;
}
GIRARA_LIST_FOREACH(result->groups, girara_completion_group_t*, iter, group)
GIRARA_LIST_FOREACH_BODY_WITH_ITER(result->groups, girara_completion_group_t*, iter, group,
if (group->elements == NULL || girara_list_size(group->elements) == 0) {
girara_list_iterator_next(iter);
continue;
......@@ -366,7 +366,7 @@ girara_isc_completion(girara_session_t* session, girara_argument_t* argument, gi
gtk_box_pack_start(session->gtk.results, GTK_WIDGET(entry->widget), FALSE, FALSE, 0);
}
GIRARA_LIST_FOREACH(group->elements, girara_completion_element_t*, iter2, element)
GIRARA_LIST_FOREACH_BODY_WITH_ITER(group->elements, girara_completion_element_t*, iter2, element,
girara_internal_completion_entry_t* entry = g_slice_new(girara_internal_completion_entry_t);
entry->group = FALSE;
entry->value = g_strdup(element->value);
......@@ -375,9 +375,8 @@ girara_isc_completion(girara_session_t* session, girara_argument_t* argument, gi
entries = g_list_append(entries, entry);
gtk_box_pack_start(session->gtk.results, GTK_WIDGET(entry->widget), FALSE, FALSE, 0);
GIRARA_LIST_FOREACH_END(group->elements, girara_completion_element_t*, iter2, element);
GIRARA_LIST_FOREACH_END(result->groups, girara_completion_group_t*, iter, group);
);
);
girara_completion_free(result);
command_mode = false;
......
......@@ -285,13 +285,13 @@ girara_config_handle_add(girara_session_t* session, const char* identifier, gira
girara_session_private_t* session_private = session->private_data;
/* search for existing config handle */
GIRARA_LIST_FOREACH(session_private->config.handles, girara_config_handle_t*, iter, data)
GIRARA_LIST_FOREACH_BODY_WITH_ITER(session_private->config.handles, girara_config_handle_t*, iter, data,
if (strcmp(data->identifier, identifier) == 0) {
data->handle = handle;
girara_list_iterator_free(iter);
return true;
}
GIRARA_LIST_FOREACH_END(session_private->config.handles, girara_config_handle_t*, iter, data);
);
/* add new config handle */
girara_config_handle_t* config_handle = g_slice_new(girara_config_handle_t);
......@@ -388,7 +388,7 @@ config_parse(girara_session_t* session, const char* path)
/* search for config handle */
girara_session_private_t* session_private = session->private_data;
girara_config_handle_t* handle = NULL;
GIRARA_LIST_FOREACH(session_private->config.handles, girara_config_handle_t*, iter, tmp)
GIRARA_LIST_FOREACH_BODY(session_private->config.handles, girara_config_handle_t*, tmp,
handle = tmp;
if (strcmp(handle->identifier, argv[0]) == 0) {
handle->handle(session, argument_list);
......@@ -396,7 +396,7 @@ config_parse(girara_session_t* session, const char* path)
} else {
handle = NULL;
}
GIRARA_LIST_FOREACH_END(session_private->config.handles, girara_config_handle_t*, iter, tmp);
);
if (handle == NULL) {
girara_warning("Could not process line %d in '%s': Unknown handle '%s'", line_number, path, argv[0]);
......
......@@ -353,13 +353,13 @@ girara_list_position(girara_list_t* list, void* data)
}
size_t pos = 0;
GIRARA_LIST_FOREACH(list, void*, iter, tmp)
GIRARA_LIST_FOREACH_BODY_WITH_ITER(list, void*, iter, tmp,
if (tmp == data) {
girara_list_iterator_free(iter);
return pos;
}
++pos;
GIRARA_LIST_FOREACH_END(list, void*, iter, tmp);
);
return -1;
}
......@@ -398,9 +398,9 @@ girara_list_merge(girara_list_t* list, girara_list_t* other)
}
other->free = NULL;
GIRARA_LIST_FOREACH(other, void*, iter, data)
GIRARA_LIST_FOREACH_BODY(other, void*, data,
girara_list_append(list, data);
GIRARA_LIST_FOREACH_END(other, void*, iter, data);
);
return list;
}
......
......@@ -285,9 +285,9 @@ ih_reset(GiraraInputHistory* history)
girara_list_t* newlist = girara_input_history_io_read(priv->io);
if (newlist != NULL) {
GIRARA_LIST_FOREACH(newlist, const char*, iter, data)
GIRARA_LIST_FOREACH_BODY(newlist, const char*, data,
girara_list_append(list, g_strdup(data));
GIRARA_LIST_FOREACH_END(newlist, const char*, iter, data);
);
girara_list_free(newlist);
}
}
......
......@@ -839,11 +839,11 @@ girara_mode_add(girara_session_t* session, const char* name)
g_return_val_if_fail(name != NULL && name[0] != '\0', FALSE);
girara_mode_t last_index = 0;
GIRARA_LIST_FOREACH(session->modes.identifiers, girara_mode_string_t*, iter, mode)
GIRARA_LIST_FOREACH_BODY(session->modes.identifiers, girara_mode_string_t*, mode,
if (mode->index > last_index) {
last_index = mode->index;
}
GIRARA_LIST_FOREACH_END(session->modes.identifiers, girara_mode_string_t*, iter, mode);
);
/* create new mode identifier */
girara_mode_string_t* mode = g_slice_new(girara_mode_string_t);
......
......@@ -176,12 +176,12 @@ girara_setting_find(girara_session_t* session, const char* name)
g_return_val_if_fail(name != NULL, NULL);
girara_setting_t* result = NULL;
GIRARA_LIST_FOREACH(session->private_data->settings, girara_setting_t*, iter, setting)
GIRARA_LIST_FOREACH_BODY(session->private_data->settings, girara_setting_t*, setting,
if (g_strcmp0(setting->name, name) == 0) {
result = setting;
break;
}
GIRARA_LIST_FOREACH_END(session->private_data->settings, girara_setting_t*, iter, setting);
);
return result;
}
......@@ -218,12 +218,12 @@ girara_cc_set(girara_session_t* session, const char* input)
unsigned int input_length = strlen(input);
GIRARA_LIST_FOREACH(session->private_data->settings, girara_setting_t*, iter, setting)
GIRARA_LIST_FOREACH_BODY(session->private_data->settings, girara_setting_t*, setting,
if ((setting->init_only == false) && (input_length <= strlen(setting->name)) &&
!strncmp(input, setting->name, input_length)) {
girara_completion_group_add_element(group, setting->name, setting->description);
}
GIRARA_LIST_FOREACH_END(session->private_data->settings, girara_setting_t*, iter, setting);
);
return completion;
}
......@@ -250,7 +250,7 @@ girara_cmd_dump_config(girara_session_t* session, girara_list_t* argument_list)
json_object* json_config = json_object_new_object();
GIRARA_LIST_FOREACH(session->private_data->settings, girara_setting_t*, iter, setting)
GIRARA_LIST_FOREACH_BODY(session->private_data->settings, girara_setting_t*, setting,
json_object* json_setting = json_object_new_object();
json_object* json_value = NULL;
......@@ -288,7 +288,7 @@ girara_cmd_dump_config(girara_session_t* session, girara_list_t* argument_list)
json_object_new_boolean(setting->init_only));
json_object_object_add(json_config, setting->name, json_setting);
GIRARA_LIST_FOREACH_END(session->private_data->settings, girara_setting_t*, iter, setting);
);
json_object_to_file_ext(girara_list_nth(argument_list, 0), json_config,
JSON_C_TO_STRING_PRETTY);
......
......@@ -26,7 +26,7 @@ girara_shortcut_add(girara_session_t* session, guint modifier, guint key, const
/* search for existing binding */
bool found_existing_shortcut = false;
GIRARA_LIST_FOREACH(session->bindings.shortcuts, girara_shortcut_t*, iter, shortcuts_it)
GIRARA_LIST_FOREACH_BODY_WITH_ITER(session->bindings.shortcuts, girara_shortcut_t*, iter, shortcuts_it,
if (((shortcuts_it->mask == modifier && shortcuts_it->key == key && (modifier != 0 || key != 0)) ||
(buffer && shortcuts_it->buffered_command && !strcmp(shortcuts_it->buffered_command, buffer)))
&& ((shortcuts_it->mode == mode) || (mode == 0)))
......@@ -44,7 +44,7 @@ girara_shortcut_add(girara_session_t* session, guint modifier, guint key, const
return true;
}
}
GIRARA_LIST_FOREACH_END(session->bindings.shortcuts, girara_shortcut_t*, iter, shortcuts_it);
);
if (found_existing_shortcut == true) {
return true;
......@@ -71,7 +71,7 @@ girara_shortcut_remove(girara_session_t* session, guint modifier, guint key, con
g_return_val_if_fail(buffer || key || modifier, false);
/* search for existing binding */
GIRARA_LIST_FOREACH(session->bindings.shortcuts, girara_shortcut_t*, iter, shortcuts_it)
GIRARA_LIST_FOREACH_BODY_WITH_ITER(session->bindings.shortcuts, girara_shortcut_t*, iter, shortcuts_it,
if (((shortcuts_it->mask == modifier && shortcuts_it->key == key && (modifier != 0 || key != 0)) ||
(buffer && shortcuts_it->buffered_command && !strcmp(shortcuts_it->buffered_command, buffer)))
&& shortcuts_it->mode == mode)
......@@ -80,7 +80,7 @@ girara_shortcut_remove(girara_session_t* session, guint modifier, guint key, con
girara_list_iterator_free(iter);
return true;
}
GIRARA_LIST_FOREACH_END(session->bindings.shortcuts, girara_shortcut_t*, iter, shortcuts_it);
);
return false;
}
......@@ -103,7 +103,7 @@ girara_inputbar_shortcut_add(girara_session_t* session, guint modifier, guint ke
girara_argument_t argument = {argument_n, argument_data};
/* search for existing special command */
GIRARA_LIST_FOREACH(session->bindings.inputbar_shortcuts, girara_inputbar_shortcut_t*, iter, inp_sh_it)
GIRARA_LIST_FOREACH_BODY_WITH_ITER(session->bindings.inputbar_shortcuts, girara_inputbar_shortcut_t*, iter, inp_sh_it,
if (inp_sh_it->mask == modifier && inp_sh_it->key == key) {
inp_sh_it->function = function;
inp_sh_it->argument = argument;
......@@ -111,7 +111,7 @@ girara_inputbar_shortcut_add(girara_session_t* session, guint modifier, guint ke
girara_list_iterator_free(iter);
return true;
}
GIRARA_LIST_FOREACH_END(session->bindings.inputbar_shortcuts, girara_inputbar_shortcut_t*, iter, inp_sh_it);
);
/* create new inputbar shortcut */
girara_inputbar_shortcut_t* inputbar_shortcut = g_slice_new(girara_inputbar_shortcut_t);
......@@ -131,13 +131,13 @@ girara_inputbar_shortcut_remove(girara_session_t* session, guint modifier, guint
g_return_val_if_fail(session != NULL, false);
/* search for existing special command */
GIRARA_LIST_FOREACH(session->bindings.inputbar_shortcuts, girara_inputbar_shortcut_t*, iter, inp_sh_it)
GIRARA_LIST_FOREACH_BODY_WITH_ITER(session->bindings.inputbar_shortcuts, girara_inputbar_shortcut_t*, iter, inp_sh_it,
if (inp_sh_it->mask == modifier && inp_sh_it->key == key) {
girara_list_remove(session->bindings.inputbar_shortcuts, inp_sh_it);
girara_list_iterator_free(iter);
return true;
}
GIRARA_LIST_FOREACH_END(session->bindings.inputbar_shortcuts, girara_inputbar_shortcut_t*, iter, inp_sh_it);
);
return true;
}
......@@ -588,13 +588,13 @@ girara_shortcut_mapping_add(girara_session_t* session, const char* identifier, g
}
girara_session_private_t* session_private = session->private_data;
GIRARA_LIST_FOREACH(session_private->config.shortcut_mappings, girara_shortcut_mapping_t*, iter, data)
GIRARA_LIST_FOREACH_BODY_WITH_ITER(session_private->config.shortcut_mappings, girara_shortcut_mapping_t*, iter, data,
if (strcmp(data->identifier, identifier) == 0) {
data->function = function;
girara_list_iterator_free(iter);
return true;
}
GIRARA_LIST_FOREACH_END(session_private->config.shortcut_mappings, girara_shortcut_mapping_t*, iter, data);
);
/* add new config handle */
girara_shortcut_mapping_t* mapping = g_slice_new(girara_shortcut_mapping_t);
......@@ -627,13 +627,13 @@ girara_argument_mapping_add(girara_session_t* session, const char* identifier, i
}
girara_session_private_t* session_private = session->private_data;
GIRARA_LIST_FOREACH(session_private->config.argument_mappings, girara_argument_mapping_t*, iter, mapping);
GIRARA_LIST_FOREACH_BODY_WITH_ITER(session_private->config.argument_mappings, girara_argument_mapping_t*, iter, mapping,
if (g_strcmp0(mapping->identifier, identifier) == 0) {
mapping->value = value;
girara_list_iterator_free(iter);
return true;
}
GIRARA_LIST_FOREACH_END(session_private->config.argument_mappings, girara_argument_mapping_t*, iter, mapping);
);
/* add new config handle */
girara_argument_mapping_t* mapping = g_slice_new(girara_argument_mapping_t);
......@@ -667,7 +667,7 @@ girara_mouse_event_add(girara_session_t* session, guint mask, guint button,
girara_argument_t argument = {argument_n, argument_data};
/* search for existing binding */
GIRARA_LIST_FOREACH(session->bindings.mouse_events, girara_mouse_event_t*, iter, me_it)
GIRARA_LIST_FOREACH_BODY_WITH_ITER(session->bindings.mouse_events, girara_mouse_event_t*, iter, me_it,
if (me_it->mask == mask && me_it->button == button &&
me_it->mode == mode && me_it->event_type == event_type)
{
......@@ -676,7 +676,7 @@ girara_mouse_event_add(girara_session_t* session, guint mask, guint button,
girara_list_iterator_free(iter);
return true;
}
GIRARA_LIST_FOREACH_END(session->bindings.mouse_events, girara_mouse_event_t*, iter, me_it);
);
/* add new mouse event */
girara_mouse_event_t* mouse_event = g_slice_new(girara_mouse_event_t);
......@@ -698,7 +698,7 @@ girara_mouse_event_remove(girara_session_t* session, guint mask, guint button, g
g_return_val_if_fail(session != NULL, false);
/* search for existing binding */
GIRARA_LIST_FOREACH(session->bindings.mouse_events, girara_mouse_event_t*, iter, me_it)
GIRARA_LIST_FOREACH_BODY_WITH_ITER(session->bindings.mouse_events, girara_mouse_event_t*, iter, me_it,
if (me_it->mask == mask && me_it->button == button &&
me_it->mode == mode)
{
......@@ -706,7 +706,7 @@ girara_mouse_event_remove(girara_session_t* session, guint mask, guint button, g
girara_list_iterator_free(iter);
return true;
}
GIRARA_LIST_FOREACH_END(session->bindings.mouse_events, girara_mouse_event_t*, iter, me_it);
);
return false;
}
......
......@@ -339,13 +339,13 @@ variable_changed(GiraraTemplate* object, const char* GIRARA_UNUSED(name))
private_t* priv = GET_PRIVATE(object);
priv->valid = true;
GIRARA_LIST_FOREACH(priv->variables_in_base, char*, iter, variable)
GIRARA_LIST_FOREACH_BODY(priv->variables_in_base, char*, variable,
if (priv->valid == true &&
girara_list_find(priv->variables, compare_variable_name,
variable) == NULL) {
priv->valid = false;
}
GIRARA_LIST_FOREACH_END(priv->variables_in_base, char*, iter, variable);
);
}
static void
......
......@@ -460,7 +460,7 @@ girara_exec_with_argument_list(girara_session_t* session, girara_list_t* argumen
GString* command = g_string_new(cmd ? cmd : "");
g_free(cmd);
GIRARA_LIST_FOREACH(argument_list, char*, iter, value)
GIRARA_LIST_FOREACH_BODY(argument_list, char*, value, {
if (dont_append_first_space == false) {
g_string_append_c(command, ' ');
}
......@@ -468,7 +468,7 @@ girara_exec_with_argument_list(girara_session_t* session, girara_list_t* argumen
char* tmp = g_shell_quote(value);
g_string_append(command, tmp);
g_free(tmp);
GIRARA_LIST_FOREACH_END(argument_list, char*, iter, value);
});
GError* error = NULL;
girara_info("executing: %s", command->str);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment