Commit 07e88ec5 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Merge branch 'release/0.3.2'

parents e1d94030 a7891a45
Pipeline #166 failed with stages
Copyright (c) 2010-2017 pwmt.org Copyright (c) 2010-2018 pwmt.org
This software is provided 'as-is', without any express or implied warranty. In This software is provided 'as-is', without any express or implied warranty. In
no event will the authors be held liable for any damages arising from the use of no event will the authors be held liable for any damages arising from the use of
......
...@@ -11,7 +11,7 @@ enhance the user interface that is used by zathura. ...@@ -11,7 +11,7 @@ enhance the user interface that is used by zathura.
Requirements Requirements
------------ ------------
meson (>= 0.43) meson (>= 0.47)
glib (>= 2.50) glib (>= 2.50)
gtk3 (>= 3.20) gtk3 (>= 3.20)
intltool intltool
...@@ -19,7 +19,7 @@ libnotify (optional, for notification support) ...@@ -19,7 +19,7 @@ libnotify (optional, for notification support)
json-c (optional, for configuration dumping support) json-c (optional, for configuration dumping support)
To disable the optional support for libnotify and json-c, configure the build To disable the optional support for libnotify and json-c, configure the build
system with -Denable-notify=false or -Denable-json=false. system with -Dnotify=disabled or -Djson=disabled.
Installation Installation
------------ ------------
...@@ -38,5 +38,4 @@ refer to the meson documentation for platform specific dependencies. ...@@ -38,5 +38,4 @@ refer to the meson documentation for platform specific dependencies.
Bugs Bugs
---- ----
Please report bugs at http://bugs.pwmt.org or contact us on our mailing list at Please report bugs at https://git.pwmt.org/pwmt/girara.
girara@lists.pwmt.org.
# See LICENSE file for license and copyright information # SPDX-License-Identifier: Zlib
# General information # General information
PROJECT_NAME = girara PROJECT_NAME = girara
......
doxygen = find_program('doxygen', required: false) doxygen = find_program('doxygen', required: get_option('docs'))
if get_option('enable-docs') and doxygen.found() if doxygen.found()
conf_data = configuration_data() conf_data = configuration_data()
conf_data.set('DOXYGEN_INPUT', meson.source_root()) conf_data.set('DOXYGEN_INPUT', meson.source_root())
conf_data.set('DOXYGEN_OUTPUT', meson.current_build_dir()) conf_data.set('DOXYGEN_OUTPUT', meson.current_build_dir())
......
/* See LICENSE file for license and copyright information */ /* SPDX-License-Identifier: Zlib */
#include "callbacks.h" #include "callbacks.h"
...@@ -162,7 +162,7 @@ girara_callback_view_key_press_event(GtkWidget* widget, ...@@ -162,7 +162,7 @@ girara_callback_view_key_press_event(GtkWidget* widget,
/* buffer could match a command */ /* buffer could match a command */
if (!strncmp(session_private->buffer.command->str, shortcut->buffered_command, session_private->buffer.command->len)) { if (!strncmp(session_private->buffer.command->str, shortcut->buffered_command, session_private->buffer.command->len)) {
/* command matches buffer exactly */ /* command matches buffer exactly */
if (!strcmp(session_private->buffer.command->str, shortcut->buffered_command) if (!g_strcmp0(session_private->buffer.command->str, shortcut->buffered_command)
&& (session->modes.current_mode == shortcut->mode || shortcut->mode == 0)) { && (session->modes.current_mode == shortcut->mode || shortcut->mode == 0)) {
g_string_free(session_private->buffer.command, TRUE); g_string_free(session_private->buffer.command, TRUE);
g_string_free(session->global.buffer, TRUE); g_string_free(session->global.buffer, TRUE);
......
/* See LICENSE file for license and copyright information */ /* SPDX-License-Identifier: Zlib */
#ifndef GIRARA_CALLBACKS_H #ifndef GIRARA_CALLBACKS_H
#define GIRARA_CALLBACKS_H #define GIRARA_CALLBACKS_H
#include "macros.h"
#include "types.h" #include "types.h"
#include <gtk/gtk.h> #include <gtk/gtk.h>
...@@ -37,7 +38,7 @@ typedef gboolean (*girara_callback_inputbar_activate_t)(GtkEntry* entry, ...@@ -37,7 +38,7 @@ typedef gboolean (*girara_callback_inputbar_activate_t)(GtkEntry* entry,
* @return FALSE An error occurred * @return FALSE An error occurred
*/ */
gboolean girara_callback_view_key_press_event(GtkWidget* widget, GdkEventKey* event, gboolean girara_callback_view_key_press_event(GtkWidget* widget, GdkEventKey* event,
girara_session_t* session); girara_session_t* session) GIRARA_VISIBLE;
/** /**
* Default callback when a button (typically a mouse button) has been pressed * Default callback when a button (typically a mouse button) has been pressed
...@@ -49,7 +50,7 @@ gboolean girara_callback_view_key_press_event(GtkWidget* widget, GdkEventKey* ev ...@@ -49,7 +50,7 @@ gboolean girara_callback_view_key_press_event(GtkWidget* widget, GdkEventKey* ev
* @return false to propagate the event further. * @return false to propagate the event further.
*/ */
gboolean girara_callback_view_button_press_event(GtkWidget* widget, gboolean girara_callback_view_button_press_event(GtkWidget* widget,
GdkEventButton* button, girara_session_t* session); GdkEventButton* button, girara_session_t* session) GIRARA_VISIBLE;
/** /**
* Default callback when a button (typically a mouse button) has been released * Default callback when a button (typically a mouse button) has been released
...@@ -61,7 +62,7 @@ gboolean girara_callback_view_button_press_event(GtkWidget* widget, ...@@ -61,7 +62,7 @@ gboolean girara_callback_view_button_press_event(GtkWidget* widget,
* @return false to propagate the event further. * @return false to propagate the event further.
*/ */
gboolean girara_callback_view_button_release_event(GtkWidget* widget, gboolean girara_callback_view_button_release_event(GtkWidget* widget,
GdkEventButton* button, girara_session_t* session); GdkEventButton* button, girara_session_t* session) GIRARA_VISIBLE;
/** /**
* Default callback when the pointer moves over the widget * Default callback when the pointer moves over the widget
...@@ -73,7 +74,7 @@ gboolean girara_callback_view_button_release_event(GtkWidget* widget, ...@@ -73,7 +74,7 @@ gboolean girara_callback_view_button_release_event(GtkWidget* widget,
* @return false to propagate the event further. * @return false to propagate the event further.
*/ */
gboolean girara_callback_view_button_motion_notify_event(GtkWidget* widget, gboolean girara_callback_view_button_motion_notify_event(GtkWidget* widget,
GdkEventMotion* button, girara_session_t* session); GdkEventMotion* button, girara_session_t* session) GIRARA_VISIBLE;
/** /**
* Default callback then a scroll event is triggered by the view * Default callback then a scroll event is triggered by the view
...@@ -85,7 +86,7 @@ gboolean girara_callback_view_button_motion_notify_event(GtkWidget* widget, ...@@ -85,7 +86,7 @@ gboolean girara_callback_view_button_motion_notify_event(GtkWidget* widget,
* @return false to propagate the event further. * @return false to propagate the event further.
*/ */
gboolean girara_callback_view_scroll_event(GtkWidget* widget, GdkEventScroll* event, gboolean girara_callback_view_scroll_event(GtkWidget* widget, GdkEventScroll* event,
girara_session_t* session); girara_session_t* session) GIRARA_VISIBLE;
/** /**
* Default callback if the inputbar gets activated * Default callback if the inputbar gets activated
...@@ -96,7 +97,7 @@ gboolean girara_callback_view_scroll_event(GtkWidget* widget, GdkEventScroll* ev ...@@ -96,7 +97,7 @@ gboolean girara_callback_view_scroll_event(GtkWidget* widget, GdkEventScroll* ev
* @return FALSE An error occurred * @return FALSE An error occurred
*/ */
gboolean girara_callback_inputbar_activate(GtkEntry* entry, gboolean girara_callback_inputbar_activate(GtkEntry* entry,
girara_session_t* session); girara_session_t* session) GIRARA_VISIBLE;
/** /**
* Default callback if an key in the input bar gets pressed * Default callback if an key in the input bar gets pressed
...@@ -108,7 +109,7 @@ gboolean girara_callback_inputbar_activate(GtkEntry* entry, ...@@ -108,7 +109,7 @@ gboolean girara_callback_inputbar_activate(GtkEntry* entry,
* @return FALSE An error occurred * @return FALSE An error occurred
*/ */
gboolean girara_callback_inputbar_key_press_event(GtkWidget* widget, gboolean girara_callback_inputbar_key_press_event(GtkWidget* widget,
GdkEventKey* event, girara_session_t* session); GdkEventKey* event, girara_session_t* session) GIRARA_VISIBLE;
/** /**
* Default callback if the text of the input bar has changed * Default callback if the text of the input bar has changed
...@@ -119,6 +120,6 @@ gboolean girara_callback_inputbar_key_press_event(GtkWidget* widget, ...@@ -119,6 +120,6 @@ gboolean girara_callback_inputbar_key_press_event(GtkWidget* widget,
* @return FALSE An error occurred * @return FALSE An error occurred
*/ */
gboolean girara_callback_inputbar_changed_event(GtkEditable* widget, gboolean girara_callback_inputbar_changed_event(GtkEditable* widget,
girara_session_t* session); girara_session_t* session) GIRARA_VISIBLE;
#endif #endif
/* See LICENSE file for license and copyright information */ /* SPDX-License-Identifier: Zlib */
#include "commands.h" #include "commands.h"
......
/* See LICENSE file for license and copyright information */ /* SPDX-License-Identifier: Zlib */
#ifndef GIRARA_COMMANDS_H #ifndef GIRARA_COMMANDS_H
#define GIRARA_COMMANDS_H #define GIRARA_COMMANDS_H
#include "macros.h"
#include "types.h" #include "types.h"
/** /**
...@@ -20,7 +21,7 @@ ...@@ -20,7 +21,7 @@
bool girara_inputbar_command_add(girara_session_t* session, bool girara_inputbar_command_add(girara_session_t* session,
const char* command, const char* abbreviation, const char* command, const char* abbreviation,
girara_command_function_t function, girara_completion_function_t completion, girara_command_function_t function, girara_completion_function_t completion,
const char* description); const char* description) GIRARA_VISIBLE;
/** /**
* Adds a special command * Adds a special command
...@@ -37,6 +38,6 @@ bool girara_inputbar_command_add(girara_session_t* session, ...@@ -37,6 +38,6 @@ bool girara_inputbar_command_add(girara_session_t* session,
*/ */
bool girara_special_command_add(girara_session_t* session, char identifier, bool girara_special_command_add(girara_session_t* session, char identifier,
girara_inputbar_special_function_t function, bool always, int argument_n, girara_inputbar_special_function_t function, bool always, int argument_n,
void* argument_data); void* argument_data) GIRARA_VISIBLE;
#endif #endif
/* See LICENSE file for license and copyright information */ /* SPDX-License-Identifier: Zlib */
#include <math.h> #include <math.h>
#include <string.h> #include <string.h>
...@@ -199,8 +199,8 @@ girara_isc_completion(girara_session_t* session, girara_argument_t* argument, gi ...@@ -199,8 +199,8 @@ girara_isc_completion(girara_session_t* session, girara_argument_t* argument, gi
* there is only one completion entry * there is only one completion entry
*/ */
if ( (argument->n == GIRARA_HIDE) || if ( (argument->n == GIRARA_HIDE) ||
(current_parameter && previous_parameter && strcmp(current_parameter, previous_parameter)) || (current_parameter && previous_parameter && g_strcmp0(current_parameter, previous_parameter)) ||
(current_command && previous_command && strcmp(current_command, previous_command)) || (current_command && previous_command && g_strcmp0(current_command, previous_command)) ||
(input_length != previous_length) || (input_length != previous_length) ||
is_single_entry is_single_entry
) )
...@@ -434,8 +434,8 @@ girara_isc_completion(girara_session_t* session, girara_argument_t* argument, gi ...@@ -434,8 +434,8 @@ girara_isc_completion(girara_session_t* session, girara_argument_t* argument, gi
/* hide other items */ /* hide other items */
unsigned int n_completion_items = 15; unsigned int n_completion_items = 15;
girara_setting_get(session, "n-completion-items", &n_completion_items); girara_setting_get(session, "n-completion-items", &n_completion_items);
unsigned int uh = ceil( n_completion_items / 2); unsigned int uh = ceil(n_completion_items / 2.0);
unsigned int lh = floor(n_completion_items / 2); unsigned int lh = floor(n_completion_items / 2.0);
unsigned int current_item = g_list_position(entries, entries_current); unsigned int current_item = g_list_position(entries, entries_current);
......
/* See LICENSE file for license and copyright information */ /* SPDX-License-Identifier: Zlib */
#ifndef GIRARA_COMPLETION_H #ifndef GIRARA_COMPLETION_H
#define GIRARA_COMPLETION_H #define GIRARA_COMPLETION_H
#include "macros.h"
#include "types.h" #include "types.h"
/** /**
...@@ -11,7 +12,7 @@ ...@@ -11,7 +12,7 @@
* @return Completion object * @return Completion object
* @return NULL An error occurred * @return NULL An error occurred
*/ */
girara_completion_t* girara_completion_init(void); girara_completion_t* girara_completion_init(void) GIRARA_VISIBLE;
/** /**
* Creates an girara completion group * Creates an girara completion group
...@@ -20,14 +21,14 @@ girara_completion_t* girara_completion_init(void); ...@@ -20,14 +21,14 @@ girara_completion_t* girara_completion_init(void);
* @return NULL An error occurred * @return NULL An error occurred
*/ */
girara_completion_group_t* girara_completion_group_create( girara_completion_group_t* girara_completion_group_create(
girara_session_t* session, const char* name); girara_session_t* session, const char* name) GIRARA_VISIBLE;
/** /**
* Frees a completion group * Frees a completion group
* *
* @param group The group * @param group The group
*/ */
void girara_completion_group_free(girara_completion_group_t* group); void girara_completion_group_free(girara_completion_group_t* group) GIRARA_VISIBLE;
/** /**
* Adds an group to a completion object * Adds an group to a completion object
...@@ -36,14 +37,14 @@ void girara_completion_group_free(girara_completion_group_t* group); ...@@ -36,14 +37,14 @@ void girara_completion_group_free(girara_completion_group_t* group);
* @param group The completion group * @param group The completion group
*/ */
void girara_completion_add_group(girara_completion_t* completion, void girara_completion_add_group(girara_completion_t* completion,
girara_completion_group_t* group); girara_completion_group_t* group) GIRARA_VISIBLE;
/** /**
* Frees an completion and all of its groups and elements * Frees an completion and all of its groups and elements
* *
* @param completion The completion * @param completion The completion
*/ */
void girara_completion_free(girara_completion_t* completion); void girara_completion_free(girara_completion_t* completion) GIRARA_VISIBLE;
/** /**
* Adds an element to a completion group * Adds an element to a completion group
...@@ -53,6 +54,6 @@ void girara_completion_free(girara_completion_t* completion); ...@@ -53,6 +54,6 @@ void girara_completion_free(girara_completion_t* completion);
* @param description Description of the entry * @param description Description of the entry
*/ */
void girara_completion_group_add_element(girara_completion_group_t* group, void girara_completion_group_add_element(girara_completion_group_t* group,
const char* value, const char* description); const char* value, const char* description) GIRARA_VISIBLE;
#endif #endif
/* See LICENSE file for license and copyright information */ /* SPDX-License-Identifier: Zlib */
#include "config.h" #include "config.h"
...@@ -126,11 +126,11 @@ cb_scrollbars(girara_session_t* session, const char* name, ...@@ -126,11 +126,11 @@ cb_scrollbars(girara_session_t* session, const char* name,
bool show_hscrollbar = strchr(guioptions, 'h') != NULL; bool show_hscrollbar = strchr(guioptions, 'h') != NULL;
bool show_vscrollbar = strchr(guioptions, 'v') != NULL; bool show_vscrollbar = strchr(guioptions, 'v') != NULL;
if (strcmp(name, "show-scrollbars") == 0) { if (g_strcmp0(name, "show-scrollbars") == 0) {
show_hscrollbar = show_vscrollbar = val; show_hscrollbar = show_vscrollbar = val;
} else if (strcmp(name, "show-h-scrollbar") == 0) { } else if (g_strcmp0(name, "show-h-scrollbar") == 0) {
show_hscrollbar = val; show_hscrollbar = val;
} else if (strcmp(name, "show-v-scrollbar") == 0) { } else if (g_strcmp0(name, "show-v-scrollbar") == 0) {
show_vscrollbar = val; show_vscrollbar = val;
} }
...@@ -209,8 +209,8 @@ girara_config_load_default(girara_session_t* session) ...@@ -209,8 +209,8 @@ girara_config_load_default(girara_session_t* session)
girara_setting_add(session, "word-separator", " /.-=&#?", STRING, TRUE, NULL, NULL, NULL); girara_setting_add(session, "word-separator", " /.-=&#?", STRING, TRUE, NULL, NULL, NULL);
girara_setting_add(session, "window-width", &window_width, INT, TRUE, _("Initial window width"), NULL, NULL); girara_setting_add(session, "window-width", &window_width, INT, TRUE, _("Initial window width"), NULL, NULL);
girara_setting_add(session, "window-height", &window_height, INT, TRUE, _("Initial window height"), NULL, NULL); girara_setting_add(session, "window-height", &window_height, INT, TRUE, _("Initial window height"), NULL, NULL);
girara_setting_add(session, "statusbar-h-padding", &statusbar_h_padding, INT, TRUE, _("Horizontal padding for the status input and notification bars"), NULL, NULL); girara_setting_add(session, "statusbar-h-padding", &statusbar_h_padding, INT, TRUE, _("Horizontal padding for the status, input, and notification bars"), NULL, NULL);
girara_setting_add(session, "statusbar-v-padding", &statusbar_v_padding, INT, TRUE, _("Vertical padding for the status input and notification bars"), NULL, NULL); girara_setting_add(session, "statusbar-v-padding", &statusbar_v_padding, INT, TRUE, _("Vertical padding for the status, input, and notification bars"), NULL, NULL);
girara_setting_add(session, "n-completion-items", &n_completion_items, INT, TRUE, _("Number of completion items"), NULL, NULL); girara_setting_add(session, "n-completion-items", &n_completion_items, INT, TRUE, _("Number of completion items"), NULL, NULL);
girara_setting_add(session, "show-scrollbars", &show_scrollbars, BOOLEAN, FALSE, _("Show both the horizontal and vertical scrollbars"), cb_scrollbars, NULL); girara_setting_add(session, "show-scrollbars", &show_scrollbars, BOOLEAN, FALSE, _("Show both the horizontal and vertical scrollbars"), cb_scrollbars, NULL);
girara_setting_add(session, "show-h-scrollbar", &show_scrollbars, BOOLEAN, FALSE, _("Show the horizontal scrollbar"), cb_scrollbars, NULL); girara_setting_add(session, "show-h-scrollbar", &show_scrollbars, BOOLEAN, FALSE, _("Show the horizontal scrollbar"), cb_scrollbars, NULL);
...@@ -289,7 +289,7 @@ girara_config_handle_add(girara_session_t* session, const char* identifier, gira ...@@ -289,7 +289,7 @@ girara_config_handle_add(girara_session_t* session, const char* identifier, gira
/* search for existing config handle */ /* search for existing config handle */
GIRARA_LIST_FOREACH_BODY(session_private->config.handles, girara_config_handle_t*, data, GIRARA_LIST_FOREACH_BODY(session_private->config.handles, girara_config_handle_t*, data,
if (strcmp(data->identifier, identifier) == 0) { if (g_strcmp0(data->identifier, identifier) == 0) {
data->handle = handle; data->handle = handle;
found = true; found = true;
break; break;
...@@ -364,7 +364,7 @@ config_parse(girara_session_t* session, const char* path) ...@@ -364,7 +364,7 @@ config_parse(girara_session_t* session, const char* path)
} }
/* include gets a special treatment */ /* include gets a special treatment */
if (strcmp(argv[0], "include") == 0) { if (g_strcmp0(argv[0], "include") == 0) {
if (argc != 2) { if (argc != 2) {
girara_warning("Could not process line %d in '%s': usage: include path.", line_number, path); girara_warning("Could not process line %d in '%s': usage: include path.", line_number, path);
} else { } else {
...@@ -379,7 +379,7 @@ config_parse(girara_session_t* session, const char* path) ...@@ -379,7 +379,7 @@ config_parse(girara_session_t* session, const char* path)
g_free(basename); g_free(basename);
} }
if (strcmp(newpath, path) == 0) { if (g_strcmp0(newpath, path) == 0) {
girara_warning("Could not process line %d in '%s': trying to include itself.", line_number, path); girara_warning("Could not process line %d in '%s': trying to include itself.", line_number, path);
} else { } else {
girara_debug("Loading config file '%s'.", newpath); girara_debug("Loading config file '%s'.", newpath);
...@@ -395,7 +395,7 @@ config_parse(girara_session_t* session, const char* path) ...@@ -395,7 +395,7 @@ config_parse(girara_session_t* session, const char* path)
girara_config_handle_t* handle = NULL; girara_config_handle_t* handle = NULL;
GIRARA_LIST_FOREACH_BODY(session_private->config.handles, girara_config_handle_t*, tmp, GIRARA_LIST_FOREACH_BODY(session_private->config.handles, girara_config_handle_t*, tmp,
handle = tmp; handle = tmp;
if (strcmp(handle->identifier, argv[0]) == 0) { if (g_strcmp0(handle->identifier, argv[0]) == 0) {
handle->handle(session, argument_list); handle->handle(session, argument_list);
break; break;
} else { } else {
......
/* See LICENSE file for license and copyright information */ /* SPDX-License-Identifier: Zlib */
#ifndef GIRARA_CONFIG_H #ifndef GIRARA_CONFIG_H
#define GIRARA_CONFIG_H #define GIRARA_CONFIG_H
#include "macros.h"
#include "types.h" #include "types.h"
/** /**
...@@ -11,7 +12,7 @@ ...@@ -11,7 +12,7 @@
* @param session The used girara session * @param session The used girara session
* @param path Path to the configuration file * @param path Path to the configuration file
*/ */
void girara_config_parse(girara_session_t* session, const char* path); void girara_config_parse(girara_session_t* session, const char* path) GIRARA_VISIBLE;
/** /**
* Adds an additional config handler * Adds an additional config handler
...@@ -22,6 +23,6 @@ void girara_config_parse(girara_session_t* session, const char* path); ...@@ -22,6 +23,6 @@ void girara_config_parse(girara_session_t* session, const char* path);
* @return true if no error occurred, otherwise false * @return true if no error occurred, otherwise false
*/ */
bool girara_config_handle_add(girara_session_t* session, const char* identifier, bool girara_config_handle_add(girara_session_t* session, const char* identifier,
girara_command_function_t handle); girara_command_function_t handle) GIRARA_VISIBLE;
#endif #endif
/* See LICENSE file for license and copyright information */ /* SPDX-License-Identifier: Zlib */
#include <stdlib.h> #include <stdlib.h>
#include <glib.h> #include <glib.h>
...@@ -40,7 +40,7 @@ girara_list_new(void) ...@@ -40,7 +40,7 @@ girara_list_new(void)
girara_list_t* girara_list_t*
girara_list_new2(girara_free_function_t gfree) girara_list_new2(girara_free_function_t gfree)
{ {
girara_list_t* list = g_try_malloc0(sizeof(girara_list_t)); girara_list_t* list = g_slice_new0(girara_list_t);
if (list == NULL) { if (list == NULL) {
return NULL; return NULL;
} }
...@@ -103,7 +103,7 @@ girara_list_free(girara_list_t* list) ...@@ -103,7 +103,7 @@ girara_list_free(girara_list_t* list)
} }
girara_list_clear(list); girara_list_clear(list);
g_free(list); g_slice_free(girara_list_t, list);
} }
void void
...@@ -203,7 +203,7 @@ girara_list_iterator(girara_list_t* list) ...@@ -203,7 +203,7 @@ girara_list_iterator(girara_list_t* list)
return NULL; return NULL;
} }
girara_list_iterator_t* iter = g_try_malloc0(sizeof(girara_list_iterator_t)); girara_list_iterator_t* iter = g_slice_new0(girara_list_iterator_t);
if (iter == NULL) { if (iter == NULL) {
return NULL; return NULL;
} }
...@@ -219,14 +219,7 @@ girara_list_iterator_copy(girara_list_iterator_t* iter) ...@@ -219,14 +219,7 @@ girara_list_iterator_copy(girara_list_iterator_t* iter)
{ {
g_return_val_if_fail(iter != NULL, NULL); g_return_val_if_fail(iter != NULL, NULL);
girara_list_iterator_t* iter2 = g_try_malloc0(sizeof(girara_list_iterator_t)); return g_slice_copy(sizeof(girara_list_iterator_t), iter);
if (iter2 == NULL) {
return NULL;
}
iter2->list = iter->list;
iter2->element = iter->element;
return iter2;
} }
girara_list_iterator_t* girara_list_iterator_t*
...@@ -328,7 +321,7 @@ girara_list_iterator_free(girara_list_iterator_t* iter) ...@@ -328,7 +321,7 @@ girara_list_iterator_free(girara_list_iterator_t* iter)
return; return;
} }
g_free(iter); g_slice_free(girara_list_iterator_t, iter);
} }
size_t size_t
......
This diff is collapsed.
/* See LICENSE file for license and copyright information */ /* SPDX-License-Identifier: Zlib */
#ifndef GIRARA_H #ifndef GIRARA_H
#define GIRARA_H #define GIRARA_H
......
/* See LICENSE file for license and copyright information */ /* SPDX-License-Identifier: Zlib */
#include "input-history.h" #include "input-history.h"
#include "macros.h" #include "macros.h"
......
/* See LICENSE file for license and copyright information */ /* SPDX-License-Identifier: Zlib */
#include "input-history.h" #include "input-history.h"
#include "datastructures.h" #include "datastructures.h"
#include "internal.h"
/** /**
* Private data of the input history * Private data of the input history
...@@ -161,7 +162,7 @@ ih_append(GiraraInputHistory* history, const char* input) ...@@ -161,7 +162,7 @@ ih_append(GiraraInputHistory* history, const char* input)
} }
void* data = NULL; void* data = NULL;
while ((data = girara_list_find(list, (girara_compare_function_t) g_strcmp0, data)) != NULL) { while ((data = girara_list_find(list, list_strcmp, data)) != NULL) {
girara_list_remove(list, data); girara_list_remove(list, data);
} }
......
/* See LICENSE file for license and copyright information */ /* SPDX-License-Identifier: Zlib */
#ifndef GIRARA_INPUT_HISTORY_H #ifndef GIRARA_INPUT_HISTORY_H
#define GIRARA_INPUT_HISTORY_H #define GIRARA_INPUT_HISTORY_H
#include <glib-object.h> #include <glib-object.h>
#include "macros.h"
#include "types.h" #include "types.h"
struct girara_input_history_io_interface_s { struct girara_input_history_io_interface_s {
...@@ -43,11 +44,11 @@ struct girara_input_history_io_interface_s { ...@@ -43,11 +44,11 @@ struct girara_input_history_io_interface_s {
#define GIRARA_INPUT_HISTORY_IO_GET_INTERFACE(obj) \ #define GIRARA_INPUT_HISTORY_IO_GET_INTERFACE(obj) \
(G_TYPE_INSTANCE_GET_INTERFACE((obj), GIRARA_TYPE_INPUT_HISTORY_IO, GiraraInputHistoryIOInterface)) (G_TYPE_INSTANCE_GET_INTERFACE((obj), GIRARA_TYPE_INPUT_HISTORY_IO, GiraraInputHistoryIOInterface))
GType girara_input_history_io_get_type(void) G_GNUC_CONST; GType girara_input_history_io_get_type(void) G_GNUC_CONST GIRARA_VISIBLE;
void girara_input_history_io_append(GiraraInputHistoryIO* io, const char* input); void girara_input_history_io_append(GiraraInputHistoryIO* io, const char* input) GIRARA_VISIBLE;
girara_list_t* girara_input_history_io_read(GiraraInputHistoryIO* io); girara_list_t* girara_input_history_io_read(GiraraInputHistoryIO* io) GIRARA_VISIBLE;
struct girara_input_history_s { struct girara_input_history_s {
...@@ -128,7 +129,7 @@ struct girara_input_history_class_s { ...@@ -128,7 +129,7 @@ struct girara_input_history_class_s {
* *
* @return the type * @return the type
*/ */
GType girara_input_history_get_type(void) G_GNUC_CONST; GType girara_input_history_get_type(void) G_GNUC_CONST GIRARA_VISIBLE;
/** /**
* Create new input history object. * Create new input history object.
...@@ -136,7 +137,7 @@ GType girara_input_history_get_type(void) G_GNUC_CONST; ...@@ -136,7 +137,7 @@ GType girara_input_history_get_type(void) G_GNUC_CONST;
* @param io a GiraraInputHistoryIO instance, may be NULL * @param io a GiraraInputHistoryIO instance, may be NULL
* @returns an input history object * @returns an input history object
*/ */
GiraraInputHistory* girara_input_history_new(GiraraInputHistoryIO* io); GiraraInputHistory* girara_input_history_new(GiraraInputHistoryIO* io) GIRARA_VISIBLE;
/** /**
* Append a new line of input. * Append a new line of input.
...@@ -144,7 +145,7 @@ GiraraInputHistory* girara_input_history_new(GiraraInputHistoryIO* io); ...@@ -144,7 +145,7 @@ GiraraInputHistory* girara_input_history_new(GiraraInputHistoryIO* io);
* @param history an input history instance * @param history an input history instance
* @param input the input * @param input the input
*/ */
void girara_input_history_append(GiraraInputHistory* history, const char* input); void girara_input_history_append(GiraraInputHistory* history, const char* input) GIRARA_VISIBLE;
/** /**
* Get the "next" input from the history * Get the "next" input from the history
...@@ -154,7 +155,7 @@ void girara_input_history_append(GiraraInputHistory* history, const char* input) ...@@ -154,7 +155,7 @@ void girara_input_history_append(GiraraInputHistory* history, const char* input)
* @returns "next" input * @returns "next" input
*/