1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2025-02-17 15:45:56 -05:00

Cleanups based on cppcheck.

This commit is contained in:
Dave Davenport 2021-12-01 13:14:36 +01:00
parent 6cefde70d7
commit dac09b8728
9 changed files with 23 additions and 90 deletions

View file

@ -228,15 +228,6 @@ char *rofi_force_utf8(const gchar *data, ssize_t length);
*/ */
char *rofi_latin_to_utf8_strdup(const char *input, gssize length); char *rofi_latin_to_utf8_strdup(const char *input, gssize length);
/**
* @param text the string to escape
*
* Escape XML markup from the string. text is freed.
*
* @return the escaped string
*/
gchar *rofi_escape_markup(gchar *text);
/** /**
* @param pattern The user input to match against. * @param pattern The user input to match against.
* @param plen Pattern length. * @param plen Pattern length.

View file

@ -404,11 +404,6 @@ Property *rofi_theme_find_property(ThemeWidget *widget, PropertyType type,
*/ */
GList *rofi_theme_get_list(const widget *widget, const char *property, GList *rofi_theme_get_list(const widget *widget, const char *property,
const char *defaults); const char *defaults);
/**
* Checks if a theme is set, or is empty.
* @returns TRUE when empty.
*/
gboolean rofi_theme_is_empty(void);
/** /**
* Reset the current theme. * Reset the current theme.

View file

@ -214,15 +214,6 @@ void listview_set_multi_select(listview *lv, gboolean enable);
*/ */
void listview_set_num_lines(listview *lv, unsigned int num_lines); void listview_set_num_lines(listview *lv, unsigned int num_lines);
/**
* @param lv Handler to the listview object.
*
* Get the maximum number of lines to display.
*
* @returns get the number of lines to display.
*/
unsigned int listview_get_num_lines(listview *lv);
/** /**
* @param lv Handler to the listview object. * @param lv Handler to the listview object.
* *

View file

@ -138,14 +138,6 @@ int widget_intersect(const widget *widget, int x, int y);
*/ */
void widget_move(widget *widget, short x, short y); void widget_move(widget *widget, short x, short y);
/**
* @param widget Handle to widget
*
* Get the type of the widget.
* @returns The type of the widget.
*/
WidgetType widget_type(widget *widget);
/** /**
* @param widget Handle to widget * @param widget Handle to widget
* @param type The widget type. * @param type The widget type.
@ -292,8 +284,8 @@ widget *widget_find_mouse_target(widget *wid, WidgetType type, gint x, gint y);
* *
* @returns Whether the action would be handled or not * @returns Whether the action would be handled or not
*/ */
WidgetTriggerActionResult widget_check_action(widget *wid, guint action, WidgetTriggerActionResult widget_check_action(widget *wid, guint action, gint x,
gint x, gint y); gint y);
/** /**
* @param wid The widget handle * @param wid The widget handle

View file

@ -867,16 +867,14 @@ gboolean rofi_theme_parse_file ( const char *file )
yyin = NULL; yyin = NULL;
while ( (po = g_queue_pop_head ( file_queue ) )) { while ( (po = g_queue_pop_head ( file_queue ) )) {
if ( po ) { if ( po->type == PT_FILE ) {
if ( po->type == PT_FILE ) { fclose ( po->filein );
fclose ( po->filein ); }
} if ( po->type == PT_STRING_ALLOC ) {
if ( po->type == PT_STRING_ALLOC ) { g_free( po->malloc_str);
g_free( po->malloc_str); }
} g_free ( po->filename );
g_free ( po->filename ); g_free ( po );
g_free ( po );
}
} }
// Free up. // Free up.
g_queue_free ( file_queue ); g_queue_free ( file_queue );
@ -904,16 +902,14 @@ gboolean rofi_theme_parse_string ( const char *string )
yylex_destroy (); yylex_destroy ();
while ( (po = g_queue_pop_head ( file_queue ) )) { while ( (po = g_queue_pop_head ( file_queue ) )) {
if ( po ) { if ( po->type == PT_FILE ) {
if ( po->type == PT_FILE ) { fclose ( po->filein );
fclose ( po->filein ); }
} if ( po->type == PT_STRING_ALLOC ) {
if ( po->type == PT_STRING_ALLOC ) { g_free( po->malloc_str);
g_free( po->malloc_str); }
} g_free ( po->filename );
g_free ( po->filename ); g_free ( po );
g_free ( po );
}
} }
// Free up. // Free up.
g_queue_free ( file_queue ); g_queue_free ( file_queue );

View file

@ -785,15 +785,6 @@ char *rofi_latin_to_utf8_strdup(const char *input, gssize length) {
NULL, &slength, NULL); NULL, &slength, NULL);
} }
gchar *rofi_escape_markup(gchar *text) {
if (text == NULL) {
return NULL;
}
gchar *ret = g_markup_escape_text(text, -1);
g_free(text);
return ret;
}
char *rofi_force_utf8(const gchar *data, ssize_t length) { char *rofi_force_utf8(const gchar *data, ssize_t length) {
if (data == NULL) { if (data == NULL) {
return NULL; return NULL;

View file

@ -1247,9 +1247,9 @@ rofi_theme_get_highlight_inside(Property *p, widget *widget,
} else { } else {
ThemeWidget *wid = ThemeWidget *wid =
rofi_theme_find_widget(widget->name, widget->state, FALSE); rofi_theme_find_widget(widget->name, widget->state, FALSE);
Property *p = rofi_theme_find_property(wid, P_COLOR, property, FALSE); Property *p2 = rofi_theme_find_property(wid, P_COLOR, property, FALSE);
if (p != NULL) { if (p2 != NULL) {
return rofi_theme_get_highlight_inside(p, widget, property, th); return rofi_theme_get_highlight_inside(p2, widget, property, th);
} }
return th; return th;
} }
@ -1350,16 +1350,6 @@ void distance_get_linestyle(RofiDistance d, cairo_t *draw) {
} }
} }
gboolean rofi_theme_is_empty(void) {
if (rofi_theme == NULL) {
return TRUE;
}
if (rofi_theme->properties == NULL && rofi_theme->num_widgets == 0) {
return TRUE;
}
return FALSE;
}
char *rofi_theme_parse_prepare_file(const char *file, const char *parent_file) { char *rofi_theme_parse_prepare_file(const char *file, const char *parent_file) {
char *filename = rofi_expand_path(file); char *filename = rofi_expand_path(file);
// If no absolute path specified, expand it. // If no absolute path specified, expand it.

View file

@ -946,12 +946,6 @@ void listview_set_num_lines(listview *lv, unsigned int num_lines) {
} }
} }
unsigned int listview_get_num_lines(listview *lv) {
if (lv) {
return lv->menu_lines;
}
return 0;
}
void listview_set_max_lines(listview *lv, unsigned int max_lines) { void listview_set_max_lines(listview *lv, unsigned int max_lines) {
if (lv) { if (lv) {
lv->max_displayed_lines = max_lines; lv->max_displayed_lines = max_lines;

View file

@ -128,13 +128,6 @@ void widget_set_type(widget *widget, WidgetType type) {
widget->type = type; widget->type = type;
} }
WidgetType widget_type(widget *widget) {
if (widget == NULL) {
return WIDGET_TYPE_UNKNOWN;
}
return widget->type;
}
gboolean widget_enabled(widget *widget) { gboolean widget_enabled(widget *widget) {
if (widget == NULL) { if (widget == NULL) {
return FALSE; return FALSE;
@ -548,8 +541,8 @@ widget *widget_find_mouse_target(widget *wid, WidgetType type, gint x, gint y) {
return NULL; return NULL;
} }
WidgetTriggerActionResult widget_check_action(widget *wid, guint action, WidgetTriggerActionResult widget_check_action(widget *wid, guint action, gint x,
gint x, gint y) { gint y) {
if (wid == NULL) { if (wid == NULL) {
return FALSE; return FALSE;
} }