SF.net SVN: geany:[3708] trunk
eht16 at users.sourceforge.net
eht16 at xxxxx
Wed Apr 15 22:47:33 UTC 2009
Revision: 3708
http://geany.svn.sourceforge.net/geany/?rev=3708&view=rev
Author: eht16
Date: 2009-04-15 22:47:33 +0000 (Wed, 15 Apr 2009)
Log Message:
-----------
Remove all G_LIKELY macros inside g_return_if_fail() statements as this is redundant.
Remove many other G_LIKELY/G_UNLIKELY macros which doesn't make much sense to keep the code more readable.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/build.c
trunk/src/callbacks.c
trunk/src/dialogs.c
trunk/src/document.c
trunk/src/editor.c
trunk/src/encodings.c
trunk/src/filetypes.c
trunk/src/geanymenubuttonaction.c
trunk/src/geanyobject.c
trunk/src/geanywraplabel.c
trunk/src/highlighting.c
trunk/src/keybindings.c
trunk/src/keyfile.c
trunk/src/main.c
trunk/src/msgwindow.c
trunk/src/navqueue.c
trunk/src/notebook.c
trunk/src/plugins.c
trunk/src/prefs.c
trunk/src/queue.c
trunk/src/sciwrappers.c
trunk/src/socket.c
trunk/src/symbols.c
trunk/src/templates.c
trunk/src/toolbar.c
trunk/src/tools.c
trunk/src/treeviews.c
trunk/src/ui_utils.c
trunk/src/utils.c
trunk/src/vte.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-04-15 22:46:13 UTC (rev 3707)
+++ trunk/ChangeLog 2009-04-15 22:47:33 UTC (rev 3708)
@@ -3,6 +3,18 @@
* src/keyfile.c, src/keyfile.h, src/project.c:
Fix duplicating the recent files and projects lists when closing
a project.
+ * src/build.c, src/callbacks.c, src/dialogs.c, src/document.c,
+ src/editor.c, src/encodings.c, src/filetypes.c,
+ src/geanymenubuttonaction.c, src/geanyobject.c, src/geanywraplabel.c,
+ src/highlighting.c, src/keybindings.c, src/keyfile.c, src/main.c,
+ src/msgwindow.c, src/navqueue.c, src/notebook.c, src/plugins.c,
+ src/prefs.c, src/queue.c, src/sciwrappers.c, src/socket.c,
+ src/symbols.c, src/templates.c, src/toolbar.c, src/tools.c,
+ src/treeviews.c, src/ui_utils.c, src/utils.c, src/vte.c:
+ Remove all G_LIKELY macros inside g_return_if_fail() statements as
+ this is redundant.
+ Remove many other G_LIKELY/G_UNLIKELY macros which doesn't make much
+ sense to keep the code more readable.
2009-04-09 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/src/build.c
===================================================================
--- trunk/src/build.c 2009-04-15 22:46:13 UTC (rev 3707)
+++ trunk/src/build.c 2009-04-15 22:47:33 UTC (rev 3708)
@@ -1570,12 +1570,11 @@
BuildMenuItems *menu_items;
static GtkWidget *menubar_build_menu = NULL;
- if (G_UNLIKELY(menubar_build_menu == NULL)) /* cache the build menu pointer */
+ if (menubar_build_menu == NULL) /* cache the build menu pointer */
menubar_build_menu = ui_lookup_widget(main_widgets.window, "menu_build1");
if (doc == NULL)
doc = document_get_current();
- if (G_UNLIKELY(doc == NULL) ||
- (FILETYPE_ID(doc->file_type) == GEANY_FILETYPES_NONE && doc->file_name == NULL))
+ if (doc == NULL || (FILETYPE_ID(doc->file_type) == GEANY_FILETYPES_NONE && doc->file_name == NULL))
{
gtk_widget_set_sensitive(menubar_build_menu, FALSE);
gtk_menu_item_remove_submenu(GTK_MENU_ITEM(menubar_build_menu));
@@ -1588,7 +1587,7 @@
gtk_widget_set_sensitive(menubar_build_menu, TRUE);
ft = doc->file_type;
- g_return_if_fail(G_LIKELY(ft != NULL));
+ g_return_if_fail(ft != NULL);
menu_items = build_get_menu_items(ft->id);
/* Note: don't remove the submenu first because it can now cause an X hang if
@@ -1596,7 +1595,7 @@
gtk_menu_item_set_submenu(GTK_MENU_ITEM(menubar_build_menu),
menu_items->menu);
- have_path = G_LIKELY(doc->file_name != NULL);
+ have_path = doc->file_name != NULL;
can_make = have_path && build_info.pid <= (GPid) 1;
@@ -1853,7 +1852,7 @@
{
static GtkWidget *dialog = NULL; /* keep dialog for combo history */
- if (G_UNLIKELY(! dialog))
+ if (! dialog)
dialog = dialogs_show_input(_("Make Custom Target"),
_("Enter custom options here, all entered text is passed to the make command."),
build_info.custom_target, TRUE, &on_make_custom_input_response);
@@ -2055,7 +2054,7 @@
widgets.build_action = toolbar_get_action_by_name("Build");
toolmenu = geany_menu_button_action_get_menu(GEANY_MENU_BUTTON_ACTION(widgets.build_action));
- if (G_UNLIKELY(toolmenu != NULL))
+ if (toolmenu != NULL)
{
/* build the code */
item = ui_image_menu_item_new(GEANY_STOCK_BUILD, _("_Build"));
Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c 2009-04-15 22:46:13 UTC (rev 3707)
+++ trunk/src/callbacks.c 2009-04-15 22:47:33 UTC (rev 3708)
@@ -95,7 +95,7 @@
for (i = 0; i < documents_array->len; i++)
{
- if (documents[i]->is_valid && G_UNLIKELY(documents[i]->changed))
+ if (documents[i]->is_valid && documents[i]->changed)
{
return FALSE;
}
@@ -179,9 +179,9 @@
gint cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(main_widgets.notebook));
GeanyDocument *doc = document_get_current();
- if (G_LIKELY(doc != NULL) && G_LIKELY(cur_page >= 0))
+ if (doc != NULL && cur_page >= 0)
{
- if (G_UNLIKELY(doc->file_name == NULL))
+ if (doc->file_name == NULL)
dialogs_show_save_as();
else
document_save_file(doc, FALSE);
@@ -207,8 +207,9 @@
for (i = 0; i < max; i++)
{
doc = document_get_from_page(i);
- if (! doc->changed) continue;
- if (G_UNLIKELY(doc->file_name == NULL))
+ if (! doc->changed)
+ continue;
+ if (doc->file_name == NULL)
{
/* display unnamed document */
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook),
@@ -237,8 +238,9 @@
{
GeanyDocument *doc = document_get_current();
- if (G_LIKELY(doc))
- document_close(doc);
+ g_return_if_fail(doc != NULL);
+
+ document_close(doc);
}
@@ -282,7 +284,9 @@
{
GeanyDocument *doc = document_get_current();
- if (G_LIKELY(doc != NULL) && document_can_undo(doc))
+ g_return_if_fail(doc != NULL);
+
+ if (document_can_undo(doc))
{
sci_cancel(doc->editor->sci);
document_undo(doc);
@@ -296,7 +300,9 @@
{
GeanyDocument *doc = document_get_current();
- if (G_LIKELY(doc != NULL) && document_can_redo(doc))
+ g_return_if_fail(doc != NULL);
+
+ if (document_can_redo(doc))
{
sci_cancel(doc->editor->sci);
document_redo(doc);
@@ -314,7 +320,7 @@
if (GTK_IS_EDITABLE(focusw))
gtk_editable_cut_clipboard(GTK_EDITABLE(focusw));
else
- if (IS_SCINTILLA(focusw) && G_LIKELY(doc != NULL))
+ if (IS_SCINTILLA(focusw) && doc != NULL)
sci_cut(doc->editor->sci);
else
if (GTK_IS_TEXT_VIEW(focusw))
@@ -336,7 +342,7 @@
if (GTK_IS_EDITABLE(focusw))
gtk_editable_copy_clipboard(GTK_EDITABLE(focusw));
else
- if (IS_SCINTILLA(focusw) && G_LIKELY(doc != NULL))
+ if (IS_SCINTILLA(focusw) && doc != NULL)
sci_copy(doc->editor->sci);
else
if (GTK_IS_TEXT_VIEW(focusw))
@@ -358,7 +364,7 @@
if (GTK_IS_EDITABLE(focusw))
gtk_editable_paste_clipboard(GTK_EDITABLE(focusw));
else
- if (IS_SCINTILLA(focusw) && G_LIKELY(doc != NULL))
+ if (IS_SCINTILLA(focusw) && doc != NULL)
{
sci_paste(doc->editor->sci);
}
@@ -383,7 +389,7 @@
if (GTK_IS_EDITABLE(focusw))
gtk_editable_delete_selection(GTK_EDITABLE(focusw));
else
- if (IS_SCINTILLA(focusw) && G_LIKELY(doc != NULL) && sci_has_selection(doc->editor->sci))
+ if (IS_SCINTILLA(focusw) && doc != NULL && sci_has_selection(doc->editor->sci))
sci_clear(doc->editor->sci);
else
if (GTK_IS_TEXT_VIEW(focusw))
@@ -449,11 +455,12 @@
gint i = GPOINTER_TO_INT(user_data);
gchar *charset = NULL;
- if (G_UNLIKELY(doc == NULL) || G_UNLIKELY(doc->file_name == NULL))
- return;
+ g_return_if_fail(doc != NULL);
+ g_return_if_fail(doc->file_name != NULL);
+
if (i >= 0)
{
- if (G_UNLIKELY(i >= GEANY_ENCODINGS_MAX) || G_UNLIKELY(encodings[i].charset == NULL))
+ if (i >= GEANY_ENCODINGS_MAX || encodings[i].charset == NULL)
return;
charset = encodings[i].charset;
}
@@ -634,13 +641,12 @@
GeanyDocument *doc = document_get_current();
static gint done = 1;
- if (G_LIKELY(doc != NULL))
- {
- if (done++ % 3 == 0)
- sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin,
+ g_return_if_fail(doc != NULL);
+
+ if (done++ % 3 == 0)
+ sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin,
(sci_get_zoom(doc->editor->sci) / 2));
- sci_zoom_in(doc->editor->sci);
- }
+ sci_zoom_in(doc->editor->sci);
}
/* zoom out from menu bar and popup menu */
@@ -649,12 +655,12 @@
gpointer user_data)
{
GeanyDocument *doc = document_get_current();
- if (doc != NULL)
- {
- if (sci_get_zoom(doc->editor->sci) == 0)
+
+ g_return_if_fail(doc != NULL);
+
+ if (sci_get_zoom(doc->editor->sci) == 0)
sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin, 0);
- sci_zoom_out(doc->editor->sci);
- }
+ sci_zoom_out(doc->editor->sci);
}
@@ -663,11 +669,11 @@
gpointer user_data)
{
GeanyDocument *doc = document_get_current();
- if (G_LIKELY(doc != NULL))
- {
- sci_zoom_off(doc->editor->sci);
- sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin, 0);
- }
+
+ g_return_if_fail(doc != NULL);
+
+ sci_zoom_off(doc->editor->sci);
+ sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin, 0);
}
@@ -721,7 +727,7 @@
else
doc = document_get_from_page(page_num);
- if (G_LIKELY(doc != NULL))
+ if (doc != NULL)
{
treeviews_select_openfiles_item(doc);
document_set_text_changed(doc, doc->changed); /* also sets window title and status bar */
@@ -769,9 +775,12 @@
on_crlf_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
- GeanyDocument *doc = document_get_current();
- if (ignore_callback || G_UNLIKELY(doc == NULL))
+ GeanyDocument *doc;
+ if (ignore_callback)
return;
+ doc = document_get_current();
+ g_return_if_fail(doc != NULL);
+
sci_convert_eols(doc->editor->sci, SC_EOL_CRLF);
sci_set_eol_mode(doc->editor->sci, SC_EOL_CRLF);
}
@@ -781,9 +790,12 @@
on_lf_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
- GeanyDocument *doc = document_get_current();
- if (ignore_callback || G_UNLIKELY(doc == NULL))
+ GeanyDocument *doc;
+ if (ignore_callback)
return;
+ doc = document_get_current();
+ g_return_if_fail(doc != NULL);
+
sci_convert_eols(doc->editor->sci, SC_EOL_LF);
sci_set_eol_mode(doc->editor->sci, SC_EOL_LF);
}
@@ -793,9 +805,12 @@
on_cr_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
- GeanyDocument *doc = document_get_current();
- if (ignore_callback || G_UNLIKELY(doc == NULL))
+ GeanyDocument *doc;
+ if (ignore_callback)
return;
+ doc = document_get_current();
+ g_return_if_fail(doc != NULL);
+
sci_convert_eols(doc->editor->sci, SC_EOL_CR);
sci_set_eol_mode(doc->editor->sci, SC_EOL_CR);
}
@@ -807,8 +822,9 @@
{
GeanyDocument *doc = document_get_current();
- if (G_LIKELY(doc != NULL))
- editor_replace_tabs(doc->editor);
+ g_return_if_fail(doc != NULL);
+
+ editor_replace_tabs(doc->editor);
}
@@ -858,8 +874,7 @@
gchar *text;
gboolean keep_sel = TRUE;
- if (G_UNLIKELY(doc == NULL))
- return;
+ g_return_if_fail(doc != NULL);
sci = doc->editor->sci;
if (! sci_has_selection(sci))
@@ -1008,8 +1023,9 @@
if (! ignore_callback)
{
GeanyDocument *doc = document_get_current();
- if (G_LIKELY(doc != NULL))
- editor_set_line_wrapping(doc->editor, ! doc->editor->line_wrapping);
+ g_return_if_fail(doc != NULL);
+
+ editor_set_line_wrapping(doc->editor, ! doc->editor->line_wrapping);
}
}
@@ -1021,8 +1037,8 @@
if (! ignore_callback)
{
GeanyDocument *doc = document_get_current();
- if (G_UNLIKELY(doc == NULL))
- return;
+ g_return_if_fail(doc != NULL);
+
doc->readonly = ! doc->readonly;
sci_set_readonly(doc->editor->sci, doc->readonly);
ui_update_tab_status(doc);
@@ -1038,8 +1054,9 @@
if (! ignore_callback)
{
GeanyDocument *doc = document_get_current();
- if (G_LIKELY(doc != NULL))
- doc->editor->auto_indent = ! doc->editor->auto_indent;
+ g_return_if_fail(doc != NULL);
+
+ doc->editor->auto_indent = ! doc->editor->auto_indent;
}
}
@@ -1050,8 +1067,7 @@
gchar *search_text;
GeanyDocument *doc = document_get_current();
- if (G_UNLIKELY(doc == NULL))
- return;
+ g_return_if_fail(doc != NULL);
if (sci_has_selection(doc->editor->sci))
{ /* take selected text if there is a selection */
@@ -1094,7 +1110,7 @@
GTK_MENU_ITEM(ui_lookup_widget(main_widgets.editor_menu, "goto_tag_definition1")));
GeanyDocument *doc = document_get_current();
- g_return_if_fail(G_LIKELY(doc != NULL));
+ g_return_if_fail(doc != NULL);
sci_set_current_position(doc->editor->sci, editor_info.click_pos, FALSE);
symbols_goto_tag(editor_info.current_word, definition);
@@ -1117,8 +1133,7 @@
GeanyDocument *doc = document_get_current();
gint pos;
- if (G_UNLIKELY(doc == NULL))
- return;
+ g_return_if_fail(doc != NULL);
pos = sci_get_current_position(doc->editor->sci);
editor_find_current_word(doc->editor, pos, colour, sizeof colour, GEANY_WORDCHARS"#");
@@ -1146,7 +1161,7 @@
{
GeanyDocument *doc = document_get_current();
- g_return_if_fail(G_LIKELY(doc != NULL));
+ g_return_if_fail(doc != NULL);
if (search_data.text)
{
@@ -1227,11 +1242,10 @@
{
GeanyDocument *doc = document_get_current();
- if (G_LIKELY(doc != NULL))
- {
- if (! editor_goto_line(doc->editor, (gint) val - 1))
- utils_beep();
- }
+ g_return_if_fail(doc != NULL);
+
+ if (! editor_goto_line(doc->editor, (gint) val - 1))
+ utils_beep();
}
}
@@ -1241,12 +1255,10 @@
{
GeanyDocument *doc = document_get_current();
- if (G_LIKELY(doc != NULL))
- {
- gint line = atoi(text);
- if (! editor_goto_line(doc->editor, line - 1))
- utils_beep();
- }
+ g_return_if_fail(doc != NULL);
+
+ if (! editor_goto_line(doc->editor, atoi(text) - 1))
+ utils_beep();
}
@@ -1317,7 +1329,7 @@
const gchar *cur_tag = NULL;
gint line = -1, pos = 0;
- if (G_UNLIKELY(doc == NULL) || G_UNLIKELY(doc->file_type == NULL))
+ if (doc == NULL || doc->file_type == NULL)
{
ui_set_statusbar(FALSE,
_("Please set the filetype for the current file before using this function."));
@@ -1342,7 +1354,7 @@
{
GeanyDocument *doc = document_get_current();
- if (G_UNLIKELY(doc == NULL) || G_UNLIKELY(doc->file_type == NULL))
+ if (doc == NULL || doc->file_type == NULL)
{
ui_set_statusbar(FALSE,
_("Please set the filetype for the current file before using this function."));
@@ -1362,8 +1374,7 @@
GeanyDocument *doc = document_get_current();
gchar *text;
- if (G_UNLIKELY(doc == NULL))
- return;
+ g_return_if_fail(doc != NULL);
text = templates_get_template_licence(FILETYPE_ID(doc->file_type), GEANY_TEMPLATE_GPL);
@@ -1382,8 +1393,7 @@
GeanyDocument *doc = document_get_current();
gchar *text;
- if (G_UNLIKELY(doc == NULL))
- return;
+ g_return_if_fail(doc != NULL);
text = templates_get_template_licence(FILETYPE_ID(doc->file_type), GEANY_TEMPLATE_BSD);
@@ -1402,8 +1412,7 @@
GeanyDocument *doc = document_get_current();
gchar *text;
- if (G_UNLIKELY(doc == NULL))
- return;
+ g_return_if_fail(doc != NULL);
text = templates_get_template_changelog();
sci_insert_text(doc->editor->sci, 0, text);
@@ -1424,7 +1433,7 @@
gchar *fname;
GeanyFiletype *ft;
- g_return_if_fail(G_LIKELY(doc != NULL));
+ g_return_if_fail(doc != NULL);
ft = doc->file_type;
fname = doc->file_name;
@@ -1451,8 +1460,7 @@
gchar *format;
gchar *time_str;
- if (G_UNLIKELY(doc == NULL))
- return;
+ g_return_if_fail(doc != NULL);
if (utils_str_equal(_("dd.mm.yyyy"), (gchar*) user_data))
format = "%d.%m.%Y";
@@ -1484,7 +1492,7 @@
}
time_str = utils_get_date_time(format, NULL);
- if (G_UNLIKELY(time_str != NULL))
+ if (time_str != NULL)
{
verify_click_pos(doc); /* make sure that the click_pos is valid */
@@ -1509,8 +1517,8 @@
gint pos = -1;
gchar *text;
- if (G_UNLIKELY(doc == NULL) || G_UNLIKELY(user_data == NULL))
- return;
+ g_return_if_fail(doc != NULL);
+ g_return_if_fail(user_data != NULL);
verify_click_pos(doc); /* make sure that the click_pos is valid */
@@ -1526,7 +1534,7 @@
sci_insert_text(doc->editor->sci, editor_info.click_pos, text);
g_free(text);
- if (G_LIKELY(pos >= 0))
+ if (pos >= 0)
sci_goto_pos(doc->editor->sci, pos, FALSE);
}
@@ -1536,6 +1544,8 @@
gpointer user_data)
{
GeanyDocument *doc = document_get_current();
+ g_return_if_fail(doc != NULL);
+
dialogs_show_file_properties(doc);
}
@@ -1545,8 +1555,9 @@
gpointer user_data)
{
GeanyDocument *doc = document_get_current();
- if (G_LIKELY(doc != NULL))
- editor_fold_all(doc->editor);
+ g_return_if_fail(doc != NULL);
+
+ editor_fold_all(doc->editor);
}
@@ -1555,8 +1566,9 @@
gpointer user_data)
{
GeanyDocument *doc = document_get_current();
- if (G_LIKELY(doc != NULL))
- editor_unfold_all(doc->editor);
+ g_return_if_fail(doc != NULL);
+
+ editor_unfold_all(doc->editor);
}
@@ -1573,9 +1585,9 @@
gpointer user_data)
{
GeanyDocument *doc = document_get_current();
+ g_return_if_fail(doc != NULL);
- if (G_LIKELY(doc != NULL))
- editor_indicator_clear(doc->editor, GEANY_INDICATOR_ERROR);
+ editor_indicator_clear(doc->editor, GEANY_INDICATOR_ERROR);
}
@@ -1586,11 +1598,11 @@
GeanyDocument *doc = document_get_current();
guint i = GPOINTER_TO_INT(user_data);
- if (ignore_callback || G_UNLIKELY(doc == NULL) || G_UNLIKELY(encodings[i].charset == NULL) ||
+ if (ignore_callback || doc == NULL || encodings[i].charset == NULL ||
utils_str_equal(encodings[i].charset, doc->encoding))
return;
- if (G_UNLIKELY(doc->readonly))
+ if (doc->readonly)
{
utils_beep();
return;
@@ -1606,8 +1618,9 @@
gpointer user_data)
{
GeanyDocument *doc = document_get_current();
- if (G_LIKELY(doc != NULL))
- printing_print_doc(doc);
+ g_return_if_fail(doc != NULL);
+
+ printing_print_doc(doc);
}
@@ -1616,9 +1629,9 @@
gpointer user_data)
{
GeanyDocument *doc = document_get_current();
+ g_return_if_fail(doc != NULL);
- if (G_LIKELY(doc != NULL))
- sci_select_all(doc->editor->sci);
+ sci_select_all(doc->editor->sci);
}
@@ -1658,9 +1671,8 @@
{
GeanyDocument *doc = document_get_current();
- if (G_UNLIKELY(doc == NULL))
- return;
- if (G_UNLIKELY(doc->readonly))
+ g_return_if_fail(doc != NULL);
+ if (doc->readonly)
{
utils_beep();
return;
@@ -1680,8 +1692,9 @@
gpointer user_data)
{
GeanyDocument *doc = document_get_current();
- if (G_LIKELY(doc != NULL))
- editor_do_comment(doc->editor, -1, FALSE, FALSE);
+ g_return_if_fail(doc != NULL);
+
+ editor_do_comment(doc->editor, -1, FALSE, FALSE);
}
@@ -1690,8 +1703,9 @@
gpointer user_data)
{
GeanyDocument *doc = document_get_current();
- if (G_LIKELY(doc != NULL))
- editor_do_uncomment(doc->editor, -1, FALSE);
+ g_return_if_fail(doc != NULL);
+
+ editor_do_uncomment(doc->editor, -1, FALSE);
}
@@ -1701,8 +1715,9 @@
gpointer user_data)
{
GeanyDocument *doc = document_get_current();
- if (G_LIKELY(doc != NULL))
- editor_do_comment_toggle(doc->editor);
+ g_return_if_fail(doc != NULL);
+
+ editor_do_comment_toggle(doc->editor);
}
@@ -1731,8 +1746,7 @@
gpointer user_data)
{
GeanyDocument *doc = document_get_current();
- if (G_UNLIKELY(doc == NULL))
- return;
+ g_return_if_fail(doc != NULL);
if (sci_get_lines_selected(doc->editor->sci) > 1)
{
@@ -1750,8 +1764,7 @@
gpointer user_data)
{
GeanyDocument *doc = document_get_current();
- if (G_UNLIKELY(doc == NULL))
- return;
+ g_return_if_fail(doc != NULL);
if (sci_get_lines_selected(doc->editor->sci) > 1)
{
@@ -1868,7 +1881,7 @@
static GtkWidget *item_close = NULL;
static GtkWidget *item_properties = NULL;
- if (G_UNLIKELY(item_close == NULL))
+ if (item_close == NULL)
{
item_close = ui_lookup_widget(main_widgets.window, "project_close1");
item_properties = ui_lookup_widget(main_widgets.window, "project_properties1");
@@ -1886,8 +1899,7 @@
GeanyDocument *doc = document_get_current();
gchar *sel = NULL;
- if (G_UNLIKELY(doc == NULL))
- return;
+ g_return_if_fail(doc != NULL);
sel = editor_get_default_selection(doc->editor, TRUE, GEANY_WORDCHARS"./-");
@@ -1929,10 +1941,8 @@
gpointer user_data)
{
GeanyDocument *doc = document_get_current();
+ g_return_if_fail(doc != NULL);
- if (G_UNLIKELY(doc == NULL))
- return;
-
sci_marker_delete_all(doc->editor->sci, 0); /* delete the yellow tag marker */
sci_marker_delete_all(doc->editor->sci, 1); /* delete user markers */
editor_indicator_clear(doc->editor, GEANY_INDICATOR_SEARCH);
@@ -1955,8 +1965,7 @@
GError *error = NULL;
GeanyDocument *doc = document_get_current();
- if (G_UNLIKELY(doc == NULL))
- return;
+ g_return_if_fail(doc != NULL);
if (sci_has_selection(doc->editor->sci))
{ /* take selected text if there is a selection */
@@ -2078,11 +2087,14 @@
static void set_indent_type(GeanyIndentType type)
{
- GeanyDocument *doc = document_get_current();
+ GeanyDocument *doc;
- if (G_UNLIKELY(doc == NULL) || ignore_callback)
+ if (ignore_callback)
return;
+ doc = document_get_current();
+ g_return_if_fail(doc != NULL);
+
editor_set_indent_type(doc->editor, type);
ui_update_statusbar(doc, -1);
}
@@ -2122,7 +2134,7 @@
return;
doc = document_get_current();
- g_return_if_fail(G_LIKELY(doc != NULL));
+ g_return_if_fail(doc != NULL);
editor_strip_trailing_spaces(doc->editor);
}
@@ -2165,7 +2177,7 @@
return;
doc = document_get_current();
- g_return_if_fail(G_LIKELY(doc != NULL));
+ g_return_if_fail(doc != NULL);
doc->editor->line_breaking = !doc->editor->line_breaking;
}
@@ -2176,8 +2188,9 @@
{
GeanyDocument *doc = document_get_current();
- if (G_LIKELY(doc != NULL))
- editor_replace_spaces(doc->editor);
+ g_return_if_fail(doc != NULL);
+
+ editor_replace_spaces(doc->editor);
}
@@ -2210,7 +2223,7 @@
{
doc = documents[i];
- if (G_UNLIKELY(doc == cur_doc) || ! doc->is_valid)
+ if (doc == cur_doc || ! doc->is_valid)
continue;
if (! document_close(doc))
Modified: trunk/src/dialogs.c
===================================================================
--- trunk/src/dialogs.c 2009-04-15 22:46:13 UTC (rev 3707)
+++ trunk/src/dialogs.c 2009-04-15 22:47:33 UTC (rev 3708)
@@ -141,7 +141,7 @@
gchar *filename = gtk_file_chooser_get_filename(filechooser);
gboolean is_on = gtk_file_chooser_get_show_hidden(filechooser);
- if (G_LIKELY(filename))
+ if (filename)
{
/* try to get the UTF-8 equivalent for the filename, fallback to filename if error */
gchar *utf8_filename = utils_get_utf8_from_locale(filename);
@@ -268,7 +268,7 @@
/* We use the same file selection widget each time, so first of all we create it
* if it hasn't already been created. */
- if (G_UNLIKELY(ui_widgets.open_filesel == NULL))
+ if (ui_widgets.open_filesel == NULL)
create_open_file_dialog();
if (initdir != NULL)
@@ -704,7 +704,7 @@
document_get_notebook_page(doc));
main_status.quitting = old_quitting_state;
- if (G_LIKELY(doc->file_name != NULL))
+ if (doc->file_name != NULL)
{
short_fn = g_path_get_basename(doc->file_name);
}
@@ -959,9 +959,9 @@
GtkWidget *dialog, *label, *spin, *vbox;
gboolean res = FALSE;
- g_return_val_if_fail(G_LIKELY(title != NULL), FALSE);
- g_return_val_if_fail(G_LIKELY(label_text != NULL), FALSE);
- g_return_val_if_fail(G_LIKELY(value != NULL), FALSE);
+ g_return_val_if_fail(title != NULL, FALSE);
+ g_return_val_if_fail(label_text != NULL, FALSE);
+ g_return_val_if_fail(value != NULL, FALSE);
dialog = gtk_dialog_new_with_buttons(title, GTK_WINDOW(main_widgets.window),
GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -1023,7 +1023,7 @@
# define S_IXOTH 0
#endif
- if (G_UNLIKELY(doc == NULL) || G_UNLIKELY(doc->file_name == NULL))
+ if (doc == NULL || doc->file_name == NULL)
{
dialogs_show_msgbox(GTK_MESSAGE_ERROR,
_("An error occurred or file information could not be retrieved (e.g. from a new file)."));
Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c 2009-04-15 22:46:13 UTC (rev 3707)
+++ trunk/src/document.c 2009-04-15 22:47:33 UTC (rev 3708)
@@ -131,7 +131,7 @@
{
guint i;
- if (G_UNLIKELY(! realname))
+ if (! realname)
return NULL; /* file doesn't exist on disk */
for (i = 0; i < documents_array->len; i++)
@@ -178,8 +178,7 @@
GeanyDocument *doc;
gchar *realname;
- if (G_UNLIKELY(! utf8_filename))
- return NULL;
+ g_return_val_if_fail(utf8_filename != NULL, NULL);
/* First search GeanyDocument::file_name, so we can find documents with a
* filename set but not saved on disk, like vcdiff produces */
@@ -208,8 +207,7 @@
{
guint i;
- if (G_UNLIKELY(sci == NULL))
- return NULL;
+ g_return_val_if_fail(sci != NULL, NULL);
for (i = 0; i < documents_array->len; i++)
{
@@ -223,8 +221,7 @@
/* returns the index of the notebook page for the document. */
gint document_get_notebook_page(GeanyDocument *doc)
{
- if (G_UNLIKELY(doc == NULL))
- return -1;
+ g_return_val_if_fail(doc != NULL, -1);
return gtk_notebook_page_num(GTK_NOTEBOOK(main_widgets.notebook),
GTK_WIDGET(doc->editor->sci));
@@ -242,7 +239,7 @@
{
ScintillaObject *sci;
- if (G_UNLIKELY(page_num >= documents_array->len))
+ if (page_num >= documents_array->len)
return NULL;
sci = (ScintillaObject*)gtk_notebook_get_nth_page(
@@ -261,7 +258,7 @@
{
gint cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(main_widgets.notebook));
- if (G_UNLIKELY(cur_page == -1))
+ if (cur_page == -1)
return NULL;
else
{
@@ -290,7 +287,7 @@
gchar *base_name;
GtkWidget *parent;
- g_return_if_fail(G_LIKELY(doc != NULL));
+ g_return_if_fail(doc != NULL);
base_name = g_path_get_basename(DOC_FILENAME(doc));
/* we need to use the event box for the tooltip, labels don't get the necessary events */
@@ -315,12 +312,11 @@
**/
void document_set_text_changed(GeanyDocument *doc, gboolean changed)
{
- if (G_UNLIKELY(doc == NULL))
- return;
+ g_return_if_fail(doc != NULL);
doc->changed = changed;
- if (G_LIKELY(! main_status.quitting))
+ if (! main_status.quitting)
{
ui_update_tab_status(doc);
ui_save_buttons_toggle(changed);
@@ -397,7 +393,7 @@
/* Set the file status to 'changed' after a single 'created' event. */
static gboolean monitor_finish_pending_create(gpointer doc)
{
- g_return_val_if_fail(G_LIKELY(doc != NULL), FALSE);
+ g_return_val_if_fail(doc != NULL, FALSE);
((GeanyDocument *)doc)->priv->file_disk_status = FILE_CHANGED;
ui_update_tab_status(doc);
@@ -409,7 +405,7 @@
/* Resets the 'ignore' file status after a reload action. */
static gboolean monitor_reset_ignore(gpointer doc)
{
- g_return_val_if_fail(G_LIKELY(doc != NULL), FALSE);
+ g_return_val_if_fail(doc != NULL, FALSE);
((GeanyDocument *)doc)->priv->file_disk_status = FILE_OK;
ui_update_tab_status(doc);
@@ -421,7 +417,7 @@
static void monitor_file_changed_cb(G_GNUC_UNUSED GFileMonitor *monitor, G_GNUC_UNUSED GFile *file,
G_GNUC_UNUSED GFile *other_file, GFileMonitorEvent event, GeanyDocument *doc)
{
- g_return_if_fail(G_LIKELY(doc != NULL));
+ g_return_if_fail(doc != NULL);
if (file_prefs.disk_check_timeout == 0)
return;
@@ -494,7 +490,7 @@
void document_stop_file_monitoring(GeanyDocument *doc)
{
- g_return_if_fail(G_LIKELY(doc != NULL));
+ g_return_if_fail(doc != NULL);
if (doc->priv->monitor != NULL)
{
@@ -506,7 +502,7 @@
static void monitor_file_setup(GeanyDocument *doc)
{
- g_return_if_fail(G_LIKELY(doc != NULL));
+ g_return_if_fail(doc != NULL);
/* Disable file monitoring completely for remote files (i.e. remote GIO files) as GFileMonitor
* doesn't work at all for remote files and legacy polling is too slow. */
if (! doc->priv->is_remote)
@@ -604,7 +600,7 @@
**/
gboolean document_close(GeanyDocument *doc)
{
- g_return_val_if_fail(G_LIKELY(doc), FALSE);
+ g_return_val_if_fail(doc, FALSE);
return document_remove_page(document_get_notebook_page(doc));
}
@@ -712,7 +708,7 @@
{
GeanyDocument *doc = document_create(utf8_filename);
- g_assert(G_LIKELY(doc != NULL));
+ g_assert(doc != NULL);
sci_set_undo_collection(doc->editor->sci, FALSE); /* avoid creation of an undo action */
if (text)
@@ -814,7 +810,7 @@
{
gchar *converted_text = encodings_convert_to_utf8_from_charset(
filedata->data, filedata->size, forced_enc, FALSE);
- if (G_LIKELY(converted_text == NULL))
+ if (converted_text == NULL)
{
return FALSE;
}
@@ -836,8 +832,8 @@
static gboolean
handle_encoding(FileData *filedata, GeanyEncodingIndex enc_idx)
{
- g_return_val_if_fail(G_LIKELY(filedata->enc == NULL), FALSE);
- g_return_val_if_fail(G_LIKELY(filedata->bom == FALSE), FALSE);
+ g_return_val_if_fail(filedata->enc == NULL, FALSE);
+ g_return_val_if_fail(filedata->bom == FALSE, FALSE);
if (filedata->size == 0)
{
@@ -857,7 +853,7 @@
{
gchar *converted_text = encodings_convert_to_utf8_from_charset(
filedata->data, filedata->size, filedata->enc, FALSE);
- if (G_LIKELY(converted_text != NULL))
+ if (converted_text != NULL)
{
g_free(filedata->data);
filedata->data = converted_text;
@@ -887,7 +883,7 @@
gchar *converted_text = encodings_convert_to_utf8(filedata->data,
filedata->size, &filedata->enc);
- if (G_UNLIKELY(converted_text == NULL))
+ if (converted_text == NULL)
{
return FALSE;
}
@@ -1160,7 +1156,7 @@
{
GeanyDocument *doc = data;
- if (G_UNLIKELY(! doc) || G_UNLIKELY(! doc->is_valid) || G_UNLIKELY(doc->tm_file == NULL))
+ if (! doc || ! doc->is_valid || doc->tm_file == NULL)
return FALSE;
if (gtk_window_get_focus(GTK_WINDOW(main_widgets.window)) != GTK_WIDGET(doc->editor->sci))
@@ -1197,7 +1193,7 @@
else
{
/* filename must not be NULL when opening a file */
- if (G_UNLIKELY(filename == NULL))
+ if (filename == NULL)
{
ui_set_statusbar(FALSE, _("Invalid filename"));
return NULL;
@@ -1242,7 +1238,7 @@
if (! reload)
{
doc = document_create(utf8_filename);
- g_return_val_if_fail(G_LIKELY(doc != NULL), NULL); /* really should not happen */
+ g_return_val_if_fail(doc != NULL, NULL); /* really should not happen */
/* file exists on disk, set real_path */
setptr(doc->real_path, tm_get_real_path(locale_filename));
@@ -1342,8 +1338,7 @@
gchar *filename;
gchar **list;
- if (G_UNLIKELY(data == NULL))
- return;
+ g_return_if_fail(data != NULL);
if (length < 0)
length = strlen(data);
@@ -1405,8 +1400,7 @@
gint pos = 0;
GeanyDocument *new_doc;
- if (G_UNLIKELY(doc == NULL))
- return FALSE;
+ g_return_val_if_fail(doc != NULL, FALSE);
/* try to set the cursor to the position before reloading */
pos = sci_get_current_position(doc->editor->sci);
@@ -1430,7 +1424,7 @@
#if ! defined(HAVE_GIO) || ! defined(USE_GIO_FILEMON)
struct stat st;
- g_return_val_if_fail(G_LIKELY(doc != NULL), FALSE);
+ g_return_val_if_fail(doc != NULL, FALSE);
/* stat the file to get the timestamp, otherwise on Windows the actual
* timestamp can be ahead of time(NULL) */
@@ -1479,8 +1473,8 @@
gchar *filename;
struct TextToFind ttf;
- if (G_UNLIKELY(doc == NULL) || G_UNLIKELY(doc->file_type == NULL))
- return;
+ g_return_if_fail(doc != NULL);
+ g_return_if_fail(doc->file_type != NULL);
filebase = g_strconcat(GEANY_STRING_UNTITLED, ".", (doc->file_type)->extension, NULL);
filename = g_path_get_basename(doc->file_name);
@@ -1524,7 +1518,7 @@
document_stop_file_monitoring(doc);
result = g_rename(old_locale_filename, new_locale_filename);
- if (G_UNLIKELY(result != 0))
+ if (result != 0)
{
dialogs_show_msgbox_with_secondary(GTK_MESSAGE_ERROR,
_("Error renaming file."), g_strerror(errno));
@@ -1549,7 +1543,7 @@
{
gboolean ret;
- g_return_val_if_fail(G_LIKELY(doc != NULL), FALSE);
+ g_return_val_if_fail(doc != NULL, FALSE);
if (utf8_fname != NULL)
setptr(doc->file_name, g_strdup(utf8_fname));
@@ -1579,7 +1573,7 @@
monitor_file_setup(doc);
doc->priv->file_disk_status = FILE_IGNORE;
- if (G_LIKELY(ret))
+ if (ret)
ui_add_recent_file(doc->file_name);
return ret;
}
@@ -1592,14 +1586,14 @@
gsize bytes_read;
gsize conv_len;
- g_return_val_if_fail(G_LIKELY(data != NULL) || G_LIKELY(*data == NULL), FALSE);
- g_return_val_if_fail(G_LIKELY(len != NULL), FALSE);
+ g_return_val_if_fail(data != NULL || *data == NULL, FALSE);
+ g_return_val_if_fail(len != NULL, FALSE);
/* try to convert it from UTF-8 to original encoding */
conv_file_contents = g_convert(*data, *len - 1, doc->encoding, "UTF-8",
&bytes_read, &conv_len, &conv_error);
- if (G_UNLIKELY(conv_error != NULL))
+ if (conv_error != NULL)
{
gchar *text = g_strdup_printf(
_("An error occurred while converting the file from UTF-8 in \"%s\". The file remains unsaved."),
@@ -1656,7 +1650,7 @@
gint bytes_written;
gint err = 0;
- g_return_val_if_fail(G_LIKELY(data != NULL), EINVAL);
+ g_return_val_if_fail(data != NULL, EINVAL);
fp = g_fopen(locale_filename, "wb");
if (G_UNLIKELY(fp == NULL))
@@ -1700,8 +1694,7 @@
gint err;
gchar *locale_filename;
- if (G_UNLIKELY(doc == NULL))
- return FALSE;
+ g_return_val_if_fail(doc != NULL, FALSE);
/* the "changed" flag should exclude the "readonly" flag, but check it anyway for safety */
if (! force && ! ui_prefs.allow_always_save && (! doc->changed || doc->readonly))
@@ -1781,7 +1774,7 @@
store_saved_encoding(doc);
/* ignore the following things if we are quitting */
- if (G_LIKELY(! main_status.quitting))
+ if (! main_status.quitting)
{
sci_set_savepoint(doc->editor->sci);
@@ -1815,10 +1808,9 @@
gint start_pos, search_pos;
struct TextToFind ttf;
- g_return_val_if_fail(G_LIKELY(text != NULL), FALSE);
- if (G_UNLIKELY(doc == NULL))
- return FALSE;
- if (G_UNLIKELY(! *text))
+ g_return_val_if_fail(text != NULL, FALSE);
+ g_return_val_if_fail(doc != NULL, FALSE);
+ if (! *text)
return TRUE;
start_pos = (inc) ? sci_get_selection_start(doc->editor->sci) :
@@ -1877,8 +1869,8 @@
{
gint selection_end, selection_start, search_pos;
- g_return_val_if_fail(G_LIKELY(doc != NULL) && G_LIKELY(text != NULL), -1);
- if (G_UNLIKELY(! *text))
+ g_return_val_if_fail(doc != NULL && text != NULL, -1);
+ if (! *text)
return -1;
/* Sci doesn't support searching backwards with a regex */
@@ -1949,10 +1941,9 @@
{
gint selection_end, selection_start, search_pos;
- g_return_val_if_fail(G_LIKELY(doc != NULL) && G_LIKELY(find_text != NULL) &&
- G_LIKELY(replace_text != NULL), -1);
+ g_return_val_if_fail(doc != NULL && find_text != NULL && replace_text != NULL, -1);
- if (G_UNLIKELY(! *find_text))
+ if (! *find_text)
return -1;
/* Sci doesn't support searching backwards with a regex */
@@ -2050,10 +2041,9 @@
if (new_range_end != NULL)
*new_range_end = -1;
- g_return_val_if_fail(G_LIKELY(doc != NULL) && G_LIKELY(find_text != NULL) &&
- G_LIKELY(replace_text != NULL), 0);
+ g_return_val_if_fail(doc != NULL && find_text != NULL && replace_text != NULL, 0);
- if (G_UNLIKELY(! *find_text) || doc->readonly)
+ if (! *find_text || doc->readonly)
return 0;
sci = doc->editor->sci;
@@ -2127,10 +2117,9 @@
gint max_column = 0, count = 0;
gboolean replaced = FALSE;
- g_return_if_fail(G_LIKELY(doc != NULL) && G_LIKELY(find_text != NULL) &&
- G_LIKELY(replace_text != NULL));
+ g_return_if_fail(doc != NULL && find_text != NULL && replace_text != NULL);
- if (G_UNLIKELY(! *find_text))
+ if (! *find_text)
return;
selection_start = sci_get_selection_start(doc->editor->sci);
@@ -2228,10 +2217,9 @@
gint flags, gboolean escaped_chars)
{
gint len, count;
- g_return_val_if_fail(G_LIKELY(doc != NULL) && G_LIKELY(find_text != NULL) &&
- G_LIKELY(replace_text != NULL), FALSE);
+ g_return_val_if_fail(doc != NULL && find_text != NULL && replace_text != NULL, FALSE);
- if (G_UNLIKELY(! *find_text))
+ if (! *find_text)
return FALSE;
len = sci_get_length(doc->editor->sci);
@@ -2271,16 +2259,15 @@
gboolean success = FALSE;
/* if the filetype doesn't have a tag parser or it is a new file */
- if (G_UNLIKELY(doc == NULL) || G_UNLIKELY(doc->file_type == NULL) ||
- G_UNLIKELY(app->tm_workspace == NULL) ||
- ! filetype_has_tags(doc->file_type) || G_UNLIKELY(! doc->file_name))
+ if (doc == NULL || doc->file_type == NULL || app->tm_workspace == NULL ||
+ ! filetype_has_tags(doc->file_type) || ! doc->file_name)
{
/* set the default (empty) tag list */
treeviews_update_tag_list(doc, FALSE);
return;
}
- if (G_UNLIKELY(doc->tm_file == NULL))
+ if (doc->tm_file == NULL)
{
gchar *locale_filename = utils_get_locale_from_utf8(doc->file_name);
@@ -2320,7 +2307,7 @@
static GString *last_typenames = NULL;
GString *s = NULL;
- if (G_LIKELY(app->tm_workspace))
+ if (app->tm_workspace)
{
GPtrArray *tags_array = app->tm_workspace->work_object.tags_array;
@@ -2360,7 +2347,7 @@
const GString *s;
ScintillaObject *sci;
- g_return_val_if_fail(G_LIKELY(doc != NULL), FALSE);
+ g_return_val_if_fail(doc != NULL, FALSE);
sci = doc->editor->sci;
switch (FILETYPE_ID(doc->file_type))
@@ -2377,7 +2364,7 @@
}
sci = doc->editor->sci;
- if (G_UNLIKELY(sci != NULL) && editor_lexer_get_type_keyword_idx(sci_get_lexer(sci)) == -1)
+ if (sci != NULL && editor_lexer_get_type_keyword_idx(sci_get_lexer(sci)) == -1)
return FALSE;
if (! get_project_typenames(&s, lang))
@@ -2391,7 +2378,7 @@
}
return FALSE;
}
- g_return_val_if_fail(G_LIKELY(s != NULL), FALSE);
+ g_return_val_if_fail(s != NULL, FALSE);
for (n = 0; n < documents_array->len; n++)
{
@@ -2419,7 +2406,7 @@
{
gboolean ft_changed;
- if (G_UNLIKELY(type == NULL) || G_UNLIKELY(doc == NULL))
+ if (type == NULL || doc == NULL)
return;
geany_debug("%s : %s (%s)",
@@ -2461,7 +2448,7 @@
**/
void document_set_encoding(GeanyDocument *doc, const gchar *new_encoding)
{
- if (G_UNLIKELY(doc == NULL) || G_UNLIKELY(new_encoding == NULL) ||
+ if (doc == NULL || new_encoding == NULL ||
utils_str_equal(new_encoding, doc->encoding))
return;
@@ -2522,8 +2509,7 @@
{
undo_action *action;
- if (G_UNLIKELY(doc == NULL))
- return;
+ g_return_if_fail(doc != NULL);
action = g_new0(undo_action, 1);
action->type = type;
@@ -2538,8 +2524,7 @@
gboolean document_can_undo(GeanyDocument *doc)
{
- if (G_UNLIKELY(doc == NULL))
- return FALSE;
+ g_return_val_if_fail(doc != NULL, FALSE);
if (g_trash_stack_height(&doc->priv->undo_actions) > 0 || sci_can_undo(doc->editor->sci))
return TRUE;
@@ -2562,8 +2547,7 @@
{
undo_action *action;
- if (G_UNLIKELY(doc == NULL))
- return;
+ g_return_if_fail(doc != NULL);
action = g_trash_stack_pop(&doc->priv->undo_actions);
@@ -2619,8 +2603,7 @@
gboolean document_can_redo(GeanyDocument *doc)
{
- if (G_UNLIKELY(doc == NULL))
- return FALSE;
+ g_return_val_if_fail(doc != NULL, FALSE);
if (g_trash_stack_height(&doc->priv->redo_actions) > 0 || sci_can_redo(doc->editor->sci))
return TRUE;
@@ -2633,8 +2616,7 @@
{
undo_action *action;
- if (G_UNLIKELY(doc == NULL))
- return;
+ g_return_if_fail(doc != NULL);
action = g_trash_stack_pop(&doc->priv->redo_actions);
@@ -2691,8 +2673,7 @@
{
undo_action *action;
- if G_UNLIKELY((doc == NULL))
- return;
+ g_return_if_fail(doc != NULL);
action = g_new0(undo_action, 1);
action->type = type;
@@ -2724,8 +2705,7 @@
/*static GdkColor orange = {0, 0xFFFF, 0x7FFF, 0};*/
GdkColor *color = NULL;
- if (G_UNLIKELY(doc == NULL))
- return NULL;
+ g_return_val_if_fail(doc != NULL, NULL);
if (doc->changed)
color = &red;
@@ -2752,8 +2732,7 @@
*/
GeanyDocument *document_index(gint idx)
{
- return (G_LIKELY(idx >= 0) && G_LIKELY(idx < (gint) documents_array->len)) ?
- documents[idx] : NULL;
+ return (idx >= 0 && idx < (gint) documents_array->len) ? documents[idx] : NULL;
}
@@ -2764,7 +2743,7 @@
gchar *text;
GeanyDocument *doc;
- g_return_val_if_fail(G_LIKELY(old_doc != NULL), NULL);
+ g_return_val_if_fail(old_doc != NULL, NULL);
len = sci_get_length(old_doc->editor->sci) + 1;
text = (gchar*) g_malloc(len);
Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c 2009-04-15 22:46:13 UTC (rev 3707)
+++ trunk/src/editor.c 2009-04-15 22:47:33 UTC (rev 3708)
@@ -598,7 +598,7 @@
{
SCNotification *nt = data;
- g_return_val_if_fail(G_LIKELY(calltip.sci != NULL), FALSE);
+ g_return_val_if_fail(calltip.sci != NULL, FALSE);
SSM(calltip.sci, SCI_CALLTIPCANCEL, 0, 0);
/* we use the position where the calltip was previously started as SCI_GETCURRENTPOS
@@ -644,7 +644,7 @@
GeanyEditor *editor = data;
gboolean retval;
- g_return_if_fail(G_LIKELY(editor != NULL));
+ g_return_if_fail(editor != NULL);
g_signal_emit_by_name(geany_object, "editor-notify", editor, scnt, &retval);
}
@@ -797,7 +797,7 @@
static gchar *
get_whitespace(const GeanyIndentPrefs *iprefs, gint width)
{
- g_return_val_if_fail(G_LIKELY(width >= 0), NULL);
+ g_return_val_if_fail(width >= 0, NULL);
if (width == 0)
return g_strdup("");
@@ -847,7 +847,7 @@
iprefs = *get_default_indent_prefs();
- if (G_UNLIKELY(editor == NULL))
+ if (editor == NULL)
return &iprefs;
iprefs.type = editor->indent_type;
@@ -998,7 +998,7 @@
gint size;
const GeanyIndentPrefs *iprefs = editor_get_indent_prefs(editor);
- g_return_val_if_fail(G_LIKELY(line >= 0), 0);
+ g_return_val_if_fail(line >= 0, 0);
size = sci_get_line_indentation(sci, line);
@@ -1020,7 +1020,7 @@
gint size = get_indent_size_after_line(editor, line);
const GeanyIndentPrefs *iprefs = editor_get_indent_prefs(editor);
- if (G_LIKELY(size > 0))
+ if (size > 0)
{
gchar *text;
@@ -1123,7 +1123,7 @@
if (iprefs->auto_indent_mode < GEANY_AUTOINDENT_CURRENTCHARS)
return;
- g_return_if_fail(G_LIKELY(editor != NULL) && G_LIKELY(editor->document->file_type != NULL));
+ g_return_if_fail(editor != NULL && editor->document->file_type != NULL);
sci = editor->sci;
doc = editor->document;
@@ -1196,8 +1196,7 @@
gchar *chunk;
ScintillaObject *sci;
- if (G_UNLIKELY(editor == NULL))
- return;
+ g_return_if_fail(editor != NULL);
sci = editor->sci;
if (pos == -1)
@@ -1270,7 +1269,7 @@
{
static gchar cword[GEANY_MAX_WORD_LENGTH];
- g_return_val_if_fail(G_LIKELY(editor != NULL), FALSE);
+ g_return_val_if_fail(editor != NULL, FALSE);
read_current_word(editor, pos, cword, sizeof(cword), wordchars, FALSE);
@@ -1367,7 +1366,7 @@
GString *str = NULL;
guint i;
- g_return_val_if_fail(G_LIKELY(ft) && G_LIKELY(word) && G_LIKELY(*word), NULL);
+ g_return_val_if_fail(ft && word && *word, NULL);
tags = tm_workspace_find(word, arg_types | tm_tag_class_t, attrs, FALSE, ft->lang);
if (tags->len == 0)
@@ -1452,8 +1451,9 @@
gchar *str;
ScintillaObject *sci;
- if (G_UNLIKELY(editor == NULL) || G_UNLIKELY(editor->document->file_type == NULL))
- return FALSE;
+ g_return_val_if_fail(editor != NULL, FALSE);
+ g_return_val_if_fail(editor->document->file_type != NULL, FALSE);
+
sci = editor->sci;
lexer = SSM(sci, SCI_GETLEXER, 0, 0);
@@ -1466,7 +1466,7 @@
orig_pos = pos;
pos = (lexer == SCLEX_LATEX) ? find_previous_brace(sci, pos) :
find_start_bracket(sci, pos);
- if (G_UNLIKELY(pos == -1))
+ if (pos == -1)
return FALSE;
}
@@ -1500,7 +1500,7 @@
{
GString *str;
- g_return_val_if_fail(G_LIKELY(editor != NULL), NULL);
+ g_return_val_if_fail(editor != NULL, NULL);
str = g_string_new(NULL);
if (append_calltip(str, tag, FILETYPE_ID(editor->document->file_type)))
@@ -1531,9 +1531,9 @@
words = g_string_sized_new(500);
for (i = 0; ; i++)
{
- if (G_UNLIKELY(entities[i] == NULL))
+ if (entities[i] == NULL)
break;
- else if (G_UNLIKELY(entities[i][0] == '#'))
+ else if (entities[i][0] == '#')
continue;
if (! strncmp(entities[i], root, rootlen))
@@ -1559,8 +1559,7 @@
ScintillaObject *sci;
GeanyDocument *doc;
- g_return_val_if_fail(G_LIKELY(editor != NULL) &&
- G_LIKELY(editor->document->file_type != NULL), FALSE);
+ g_return_val_if_fail(editor != NULL && editor->document->file_type != NULL, FALSE);
sci = editor->sci;
doc = editor->document;
@@ -1573,7 +1572,7 @@
for (j = 0; j < tags->len; ++j)
{
- if (G_LIKELY(j > 0))
+ if (j > 0)
g_string_append_c(words, '\n');
if (j == editor_prefs.autocompletion_max_entries)
@@ -1623,9 +1622,9 @@
if (! editor_prefs.auto_complete_symbols && ! force)
return FALSE;
- g_return_val_if_fail(G_LIKELY(editor != NULL), FALSE);
+ g_return_val_if_fail(editor != NULL, FALSE);
- if (G_UNLIKELY(editor->document->file_type == NULL))
+ if (editor->document->file_type == NULL)
return FALSE;
/* If we are at the beginning of the document, we skip autocompletion as we can't determine the
@@ -1684,7 +1683,7 @@
{
ScintillaObject *sci;
- g_return_if_fail(G_LIKELY(editor != NULL) && G_LIKELY(editor->document->file_type != NULL));
+ g_return_if_fail(editor != NULL && editor->document->file_type != NULL);
sci = editor->sci;
@@ -1797,8 +1796,8 @@
{
gchar *needle;
- if (G_UNLIKELY(key == NULL) || G_UNLIKELY(value == NULL))
- return;
+ g_return_if_fail(key != NULL);
+ g_return_if_fail(value != NULL);
needle = g_strconcat("%", (gchar*) key, "%", NULL);
@@ -1868,7 +1867,7 @@
GString *buf;
const gchar cur_marker[] = "__GEANY_CURSOR_MARKER__";
- g_return_if_fail(G_LIKELY(text));
+ g_return_if_fail(text);
buf = g_string_new(text);
@@ -1922,7 +1921,7 @@
* Can, and should, be optimized to give better results */
void snippet_goto_next_cursor(ScintillaObject *sci, gint current_pos)
{
- if (G_LIKELY(snippet_queue))
+ if (snippet_queue)
{
gpointer offset;
@@ -2089,8 +2088,7 @@
const gchar *word;
ScintillaObject *sci;
- if (G_UNLIKELY(editor == NULL))
- return FALSE;
+ g_return_val_if_fail(editor != NULL, FALSE);
sci = editor->sci;
/* return if we are editing an existing line (chars on right of cursor) */
@@ -2125,11 +2123,11 @@
{
GString *words;
- if (G_UNLIKELY(editor == NULL) || G_UNLIKELY(editor->document->file_type == NULL))
+ if (editor == NULL || editor->document->file_type == NULL)
return;
words = symbols_get_macro_list(editor->document->file_type->lang);
- if (G_UNLIKELY(words == NULL))
+ if (words == NULL)
return;
SSM(editor->sci, SCI_USERLISTSHOW, 1, (sptr_t) words->str);
@@ -2310,7 +2308,7 @@
gchar *str_begin, *str_end, *co, *cc;
gint line_len;
- g_return_if_fail(G_LIKELY(editor != NULL) && G_LIKELY(editor->document->file_type != NULL));
+ g_return_if_fail(editor != NULL && editor->document->file_type != NULL);
eol = editor_get_eol_char(editor);
co = editor->document->file_type->comment_open;
@@ -2335,7 +2333,7 @@
gchar *linebuf;
GeanyDocument *doc;
- g_return_if_fail(G_LIKELY(editor != NULL) && G_LIKELY(editor->document->file_type != NULL));
+ g_return_if_fail(editor != NULL && editor->document->file_type != NULL);
doc = editor->document;
/* remove comment open chars */
@@ -2380,8 +2378,7 @@
gboolean break_loop = FALSE, single_line = FALSE;
GeanyFiletype *ft;
- g_return_val_if_fail(G_LIKELY(editor != NULL) &&
- G_LIKELY(editor->document->file_type != NULL), 0);
+ g_return_val_if_fail(editor != NULL && editor->document->file_type != NULL, 0);
if (line < 0)
{ /* use selection or current line */
@@ -2412,11 +2409,11 @@
co = ft->comment_open;
cc = ft->comment_close;
- if (G_UNLIKELY(co == NULL))
+ if (co == NULL)
return 0;
co_len = strlen(co);
- if (G_UNLIKELY(co_len == 0))
+ if (co_len == 0)
return 0;
SSM(editor->sci, SCI_BEGINUNDOACTION, 0, 0);
@@ -2535,7 +2532,7 @@
gsize tm_len = strlen(editor_prefs.comment_toggle_mark);
GeanyFiletype *ft;
- g_return_if_fail(G_LIKELY(editor != NULL) && G_LIKELY(editor->document->file_type != NULL));
+ g_return_if_fail(editor != NULL && editor->document->file_type != NULL);
sel_start = sci_get_selection_start(editor->sci);
sel_end = sci_get_selection_end(editor->sci);
@@ -2559,11 +2556,11 @@
co = ft->comment_open;
cc = ft->comment_close;
- if (G_UNLIKELY(co == NULL))
+ if (co == NULL)
return;
co_len = strlen(co);
- if (G_UNLIKELY(co_len == 0))
+ if (co_len == 0)
return;
SSM(editor->sci, SCI_BEGINUNDOACTION, 0, 0);
@@ -2703,7 +2700,7 @@
gboolean break_loop = FALSE, single_line = FALSE;
GeanyFiletype *ft;
- g_return_if_fail(G_LIKELY(editor != NULL) && G_LIKELY(editor->document->file_type != NULL));
+ g_return_if_fail(editor != NULL && editor->document->file_type != NULL);
if (line < 0)
{ /* use selection or current line */
@@ -2734,11 +2731,11 @@
co = ft->comment_open;
cc = ft->comment_close;
- if (G_UNLIKELY(co == NULL))
+ if (co == NULL)
return;
co_len = strlen(co);
- if (G_UNLIKELY(co_len == 0))
+ if (co_len == 0)
return;
SSM(editor->sci, SCI_BEGINUNDOACTION, 0, 0);
@@ -3263,9 +3260,8 @@
gboolean have_multiline_comment = FALSE;
GeanyDocument *doc;
- g_return_if_fail(G_LIKELY(editor != NULL) &&
- G_LIKELY(editor->document->file_type != NULL) &&
- G_LIKELY(editor->document->file_type->comment_open != NULL));
+ g_return_if_fail(editor != NULL &&
+ editor->document->file_type != NULL && editor->document->file_type->comment_open != NULL);
doc = editor->document;
@@ -3323,8 +3319,7 @@
gint vis1, los, delta;
GtkWidget *wid;
- if (G_UNLIKELY(editor == NULL))
- return;
+ g_return_if_fail(editor != NULL);
wid = GTK_WIDGET(editor->sci);
@@ -3352,8 +3347,7 @@
gchar *text;
GeanyIndentPrefs iprefs = *editor_get_indent_prefs(editor);
- if (G_UNLIKELY(editor == NULL))
- return;
+ g_return_if_fail(editor != NULL);
switch (iprefs.type)
{
@@ -3377,7 +3371,7 @@
gint start;
gint end;
- g_return_if_fail(G_LIKELY(editor != NULL));
+ g_return_if_fail(editor != NULL);
pos = SSM(editor->sci, SCI_GETCURRENTPOS, 0, 0);
start = SSM(editor->sci, SCI_WORDSTARTPOSITION, pos, TRUE);
@@ -3403,7 +3397,7 @@
{
gint start, end, line;
- g_return_if_fail(G_LIKELY(editor != NULL));
+ g_return_if_fail(editor != NULL);
start = sci_get_selection_start(editor->sci);
end = sci_get_selection_end(editor->sci);
@@ -3477,7 +3471,7 @@
{
gint pos_start, pos_end, line_start, line_found;
- g_return_if_fail(G_LIKELY(editor != NULL));
+ g_return_if_fail(editor != NULL);
line_start = SSM(editor->sci, SCI_LINEFROMPOSITION,
SSM(editor->sci, SCI_GETCURRENTPOS, 0, 0), 0);
@@ -3536,7 +3530,7 @@
gint first_sel_start, first_sel_end;
ScintillaObject *sci;
- g_return_if_fail(G_LIKELY(editor != NULL));
+ g_return_if_fail(editor != NULL);
sci = editor->sci;
@@ -3580,7 +3574,7 @@
gint i, first_line, last_line, line_start, indentation_end, count = 0;
gint sel_start, sel_end, first_line_offset = 0;
- g_return_if_fail(G_LIKELY(editor != NULL));
+ g_return_if_fail(editor != NULL);
sel_start = sci_get_selection_start(editor->sci);
sel_end = sci_get_selection_end(editor->sci);
@@ -3654,8 +3648,7 @@
{
gchar *s = NULL;
- if (G_UNLIKELY(editor == NULL))
- return NULL;
+ g_return_val_if_fail(editor != NULL, NULL);
if (sci_get_lines_selected(editor->sci) == 1)
{
@@ -3683,8 +3676,7 @@
{
gint vis1, los;
- if (G_UNLIKELY(editor == NULL))
- return FALSE;
+ g_return_val_if_fail(editor != NULL, FALSE);
/* If line is wrapped the result may occur on another virtual line than the first and may be
* still hidden, so increase the line number to check for the next document line */
@@ -3705,8 +3697,7 @@
{
gint line;
- if (G_UNLIKELY(editor == NULL))
- return;
+ g_return_if_fail(editor != NULL);
line = sci_get_current_line(editor->sci);
@@ -3744,10 +3735,10 @@
{
glong last_pos;
- g_return_if_fail(G_LIKELY(editor != NULL));
+ g_return_if_fail(editor != NULL);
last_pos = sci_get_length(editor->sci);
- if (G_LIKELY(last_pos > 0))
+ if (last_pos > 0)
{
sci_indicator_set(editor->sci, indic);
sci_indicator_clear(editor->sci, 0, last_pos);
@@ -3771,8 +3762,7 @@
guint i = 0, len;
gchar *linebuf;
- if (G_UNLIKELY(editor == NULL))
- return;
+ g_return_if_fail(editor != NULL);
start = sci_get_position_from_line(editor->sci, line);
end = sci_get_position_from_line(editor->sci, line + 1);
@@ -3812,7 +3802,8 @@
*/
void editor_indicator_set_on_range(GeanyEditor *editor, gint indic, gint start, gint end)
{
- if (G_UNLIKELY(editor == NULL) || G_UNLIKELY(start >= end))
+ g_return_if_fail(editor != NULL);
+ if (start >= end)
return;
sci_indicator_set(editor->sci, indic);
@@ -3824,7 +3815,7 @@
* the replacement will also start with 0x... */
void editor_insert_color(GeanyEditor *editor, const gchar *colour)
{
- g_return_if_fail(G_LIKELY(editor != NULL));
+ g_return_if_fail(editor != NULL);
if (sci_has_selection(editor->sci))
{
@@ -3853,7 +3844,7 @@
{
gint mode = file_prefs.default_eol_character;
- if (G_LIKELY(editor != NULL))
+ if (editor != NULL)
mode = sci_get_eol_mode(editor->sci);
switch (mode)
@@ -3870,7 +3861,7 @@
{
gint mode = file_prefs.default_eol_character;
- if (G_LIKELY(editor != NULL))
+ if (editor != NULL)
mode = sci_get_eol_mode(editor->sci);
switch (mode)
@@ -3886,7 +3877,7 @@
{
gint mode = file_prefs.default_eol_character;
- if (G_LIKELY(editor != NULL))
+ if (editor != NULL)
mode = sci_get_eol_mode(editor->sci);
switch (mode)
@@ -3902,7 +3893,7 @@
{
gint lines, first, i;
- if (G_UNLIKELY(editor == NULL) || ! editor_prefs.folding)
+ if (editor == NULL || ! editor_prefs.folding)
return;
lines = sci_get_line_count(editor->sci);
@@ -3940,8 +3931,7 @@
gchar *tab_str;
struct TextToFind ttf;
- if (G_UNLIKELY(editor == NULL))
- return;
+ g_return_if_fail(editor != NULL);
sci_start_undo_action(editor->sci);
tab_len = sci_get_tab_width(editor->sci);
@@ -3979,10 +3969,9 @@
gint tab_len;
struct TextToFind ttf;
- if (G_UNLIKELY(editor == NULL))
- return;
+ g_return_if_fail(editor != NULL);
- if (G_UNLIKELY(tab_len_f < 0.0))
+ if (tab_len_f < 0.0)
tab_len_f = sci_get_tab_width(editor->sci);
if (! dialogs_show_input_numeric(
@@ -4059,11 +4048,11 @@
gboolean append_newline = (max_lines == 1);
gint end_document = sci_get_position_from_line(editor->sci, max_lines);
- if (G_LIKELY(max_lines > 1))
+ if (max_lines > 1)
{
append_newline = end_document > sci_get_position_from_line(editor->sci, max_lines - 1);
}
- if (G_LIKELY(append_newline))
+ if (append_newline)
{
const gchar *eol = "\n";
switch (sci_get_eol_mode(editor->sci))
@@ -4086,7 +4075,7 @@
gchar *font_name;
PangoFontDescription *pfd;
- g_return_if_fail(G_LIKELY(editor));
+ g_return_if_fail(editor);
pfd = pango_font_description_from_string(font);
size = pango_font_description_get_size(pfd) / PANGO_SCALE;
@@ -4109,7 +4098,7 @@
void editor_set_line_wrapping(GeanyEditor *editor, gboolean wrap)
{
- g_return_if_fail(G_LIKELY(editor != NULL));
+ g_return_if_fail(editor != NULL);
editor->line_wrapping = wrap;
sci_set_lines_wrapped(editor->sci, wrap);
@@ -4147,8 +4136,8 @@
{
gint pos;
- g_return_val_if_fail(G_LIKELY(editor), FALSE);
- if (G_UNLIKELY(line < 0) || G_UNLIKELY(line >= sci_get_line_count(editor->sci)))
+ g_return_val_if_fail(editor, FALSE);
+ if (line < 0 || line >= sci_get_line_count(editor->sci))
return FALSE;
pos = sci_get_position_from_line(editor->sci, line);
@@ -4162,7 +4151,7 @@
{
gint page_num;
- g_return_val_if_fail(G_LIKELY(editor), FALSE);
+ g_return_val_if_fail(editor, FALSE);
if (G_UNLIKELY(pos < 0))
return FALSE;
@@ -4193,12 +4182,12 @@
/* Handle scroll events if Alt is pressed and scroll whole pages instead of a
* few lines only, maybe this could/should be done in Scintilla directly */
- if (G_UNLIKELY(event->state & GDK_MOD1_MASK))
+ if (event->state & GDK_MOD1_MASK)
{
sci_send_command(editor->sci, (event->direction == GDK_SCROLL_DOWN) ? SCI_PAGEDOWN : SCI_PAGEUP);
return TRUE;
}
- else if (G_UNLIKELY(event->state & GDK_SHIFT_MASK))
+ else if (event->state & GDK_SHIFT_MASK)
{
gint amount = (event->direction == GDK_SCROLL_DOWN) ? 8 : -8;
@@ -4462,7 +4451,7 @@
{
ScintillaObject *sci;
- g_return_if_fail(G_UNLIKELY(editor != NULL));
+ g_return_if_fail(editor != NULL);
sci = editor->sci;
Modified: trunk/src/encodings.c
===================================================================
--- trunk/src/encodings.c 2009-04-15 22:46:13 UTC (rev 3707)
+++ trunk/src/encodings.c 2009-04-15 22:47:33 UTC (rev 3708)
@@ -150,7 +150,7 @@
{
gint i;
- if (G_UNLIKELY(charset == NULL))
+ if (charset == NULL)
return GEANY_ENCODING_UTF_8;
i = 0;
@@ -169,7 +169,7 @@
{
gint i;
- if (G_UNLIKELY(charset == NULL))
+ if (charset == NULL)
return &encodings[GEANY_ENCODING_UTF_8];
i = 0;
@@ -187,7 +187,7 @@
const GeanyEncoding *encodings_get_from_index(gint idx)
{
- g_return_val_if_fail(G_LIKELY(idx >= 0) && G_LIKELY(idx < GEANY_ENCODINGS_MAX), NULL);
+ g_return_val_if_fail(idx >= 0 && idx < GEANY_ENCODINGS_MAX, NULL);
return &encodings[idx];
}
@@ -206,7 +206,7 @@
**/
const gchar* encodings_get_charset_from_index(gint idx)
{
- g_return_val_if_fail(G_LIKELY(idx >= 0) && G_LIKELY(idx < GEANY_ENCODINGS_MAX), NULL);
+ g_return_val_if_fail(idx >= 0 && idx < GEANY_ENCODINGS_MAX, NULL);
return encodings[idx].charset;
}
@@ -214,9 +214,9 @@
gchar *encodings_to_string(const GeanyEncoding* enc)
{
- g_return_val_if_fail(G_LIKELY(enc != NULL), NULL);
- g_return_val_if_fail(G_LIKELY(enc->name != NULL), NULL);
- g_return_val_if_fail(G_LIKELY(enc->charset != NULL), NULL);
+ g_return_val_if_fail(enc != NULL, NULL);
+ g_return_val_if_fail(enc->name != NULL, NULL);
+ g_return_val_if_fail(enc->charset != NULL, NULL);
return g_strdup_printf("%s (%s)", enc->name, enc->charset);
}
@@ -224,8 +224,8 @@
const gchar *encodings_get_charset(const GeanyEncoding* enc)
{
- g_return_val_if_fail(G_LIKELY(enc != NULL), NULL);
- g_return_val_if_fail(G_LIKELY(enc->charset != NULL), NULL);
+ g_return_val_if_fail(enc != NULL, NULL);
+ g_return_val_if_fail(enc->charset != NULL, NULL);
return enc->charset;
}
@@ -237,7 +237,7 @@
{
gint i;
- g_return_if_fail(G_LIKELY(charset != NULL));
+ g_return_if_fail(charset != NULL);
i = 0;
while (i < GEANY_ENCODINGS_MAX)
@@ -246,7 +246,7 @@
break;
i++;
}
- if (G_UNLIKELY(i == GEANY_ENCODINGS_MAX))
+ if (i == GEANY_ENCODINGS_MAX)
i = GEANY_ENCODING_UTF_8; /* fallback to UTF-8 */
/* ignore_callback has to be set by the caller */
@@ -263,7 +263,7 @@
static void regex_compile(regex_t *preg, const gchar *pattern)
{
gint retval = regcomp(preg, pattern, REG_EXTENDED | REG_ICASE);
- if (G_UNLIKELY(retval != 0))
+ if (retval != 0)
{
gchar errmsg[512];
regerror(retval, preg, errmsg, 512);
@@ -304,7 +304,7 @@
void encodings_finalize(void)
{
#ifdef HAVE_REGCOMP
- if (G_LIKELY(pregs_loaded))
+ if (pregs_loaded)
{
guint i, len;
len = G_N_ELEMENTS(pregs);
@@ -331,7 +331,7 @@
init_encodings();
#ifdef HAVE_REGCOMP
- if (G_UNLIKELY(! pregs_loaded))
+ if (! pregs_loaded)
{
regex_compile(&pregs[0], PATTERN_HTMLMETA);
regex_compile(&pregs[1], PATTERN_CODING);
@@ -448,8 +448,8 @@
gchar* converted_contents = NULL;
gsize bytes_written;
- g_return_val_if_fail(G_LIKELY(buffer != NULL), NULL);
- g_return_val_if_fail(G_LIKELY(charset != NULL), NULL);
+ g_return_val_if_fail(buffer != NULL, NULL);
+ g_return_val_if_fail(charset != NULL, NULL);
converted_contents = g_convert(buffer, size, "UTF-8", charset, NULL,
&bytes_written, &conv_error);
@@ -630,7 +630,7 @@
gboolean encodings_is_unicode_charset(const gchar *string)
{
- if (G_LIKELY(string != NULL) &&
+ if (string != NULL &&
(strncmp(string, "UTF", 3) == 0 || strncmp(string, "UCS", 3) == 0))
{
return TRUE;
Modified: trunk/src/filetypes.c
===================================================================
--- trunk/src/filetypes.c 2009-04-15 22:46:13 UTC (rev 3707)
+++ trunk/src/filetypes.c 2009-04-15 22:47:33 UTC (rev 3708)
@@ -611,8 +611,8 @@
* and set the filetype::id field. */
static void filetype_add(GeanyFiletype *ft)
{
- g_return_if_fail(G_LIKELY(ft));
- g_return_if_fail(G_LIKELY(ft->name));
+ g_return_if_fail(ft);
+ g_return_if_fail(ft->name);
ft->id = filetypes_array->len; /* len will be the index for filetype_array */
g_ptr_array_add(filetypes_array, ft);
@@ -627,8 +627,8 @@
{
filetype_id ft_id;
- g_return_if_fail(G_LIKELY(filetypes_array == NULL));
- g_return_if_fail(G_LIKELY(filetypes_hash == NULL));
+ g_return_if_fail(filetypes_array == NULL);
+ g_return_if_fail(filetypes_hash == NULL);
filetypes_array = g_ptr_array_sized_new(GEANY_MAX_BUILT_IN_FILETYPES);
filetypes_hash = g_hash_table_new(g_str_hash, g_str_equal);
@@ -902,7 +902,7 @@
if (ft != NULL)
return ft;
- if (G_UNLIKELY(utf8_filename == NULL))
+ if (utf8_filename == NULL)
return filetypes[GEANY_FILETYPES_NONE];
return filetypes_detect_from_extension(utf8_filename);
@@ -915,7 +915,7 @@
GeanyFiletype *ft;
gchar *line;
- if (G_UNLIKELY(doc == NULL))
+ if (doc == NULL)
return filetypes[GEANY_FILETYPES_NONE];
line = sci_get_line(doc->editor->sci, 0);
@@ -943,7 +943,7 @@
f = g_fopen(locale_name, "r");
g_free(locale_name);
- if (G_LIKELY(f != NULL))
+ if (f != NULL)
{
if (fgets(line, sizeof(line), f) != NULL)
{
@@ -962,7 +962,7 @@
/* ignore_callback has to be set by the caller */
g_return_if_fail(ignore_callback);
- if (G_UNLIKELY(ft == NULL))
+ if (ft == NULL)
ft = filetypes[GEANY_FILETYPES_NONE];
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(ft->priv->menu_item), TRUE);
@@ -974,7 +974,7 @@
gpointer user_data)
{
GeanyDocument *doc = document_get_current();
- if (G_UNLIKELY(ignore_callback) || G_UNLIKELY(doc == NULL))
+ if (ignore_callback || doc == NULL)
return;
document_set_filetype(doc, (GeanyFiletype*)user_data);
@@ -999,7 +999,7 @@
/* Remove a filetype pointer from the list of available filetypes. */
static void filetype_remove(GeanyFiletype *ft)
{
- g_return_if_fail(G_LIKELY(ft));
+ g_return_if_fail(ft);
g_ptr_array_remove(filetypes_array, ft);
@@ -1027,7 +1027,7 @@
{
GeanyFiletype *ft = data;
- g_return_if_fail(G_LIKELY(ft != NULL));
+ g_return_if_fail(ft != NULL);
g_free(ft->name);
g_free(ft->title);
@@ -1051,8 +1051,8 @@
/* frees the array and all related pointers */
void filetypes_free_types(void)
{
- g_return_if_fail(G_LIKELY(filetypes_array != NULL));
- g_return_if_fail(G_LIKELY(filetypes_hash != NULL));
+ g_return_if_fail(filetypes_array != NULL);
+ g_return_if_fail(filetypes_hash != NULL);
g_ptr_array_foreach(filetypes_array, filetype_free, NULL);
g_ptr_array_free(filetypes_array, TRUE);
@@ -1176,7 +1176,7 @@
GKeyFile *config, *config_home;
GeanyFiletypePrivate *pft;
- g_return_if_fail(G_LIKELY(ft_id >= 0) && G_LIKELY(ft_id < (gint) filetypes_array->len));
+ g_return_if_fail(ft_id >= 0 && ft_id < (gint) filetypes_array->len);
pft = filetypes[ft_id]->priv;
@@ -1245,7 +1245,7 @@
GKeyFile *config_home;
gchar *fname, *ext, *data;
- if (G_LIKELY(! bp->modified))
+ if (! bp->modified)
continue;
ext = filetypes_get_conf_extension(i);
@@ -1303,7 +1303,7 @@
gint i;
const gchar *title;
- g_return_val_if_fail(G_LIKELY(ft != NULL), NULL);
+ g_return_val_if_fail(ft != NULL, NULL);
new_filter = gtk_file_filter_new();
title = ft->id == GEANY_FILETYPES_NONE ? _("All files") : ft->title;
@@ -1321,7 +1321,7 @@
/* Indicates whether there is a tag parser for the filetype or not. */
gboolean filetype_has_tags(GeanyFiletype *ft)
{
- g_return_val_if_fail(G_LIKELY(ft != NULL), FALSE);
+ g_return_val_if_fail(ft != NULL, FALSE);
return ft->lang >= 0;
}
@@ -1389,9 +1389,9 @@
if (!NZV(ft->error_regex_string))
return FALSE;
- if (G_UNLIKELY(!ft->priv->error_regex_compiled))
+ if (!ft->priv->error_regex_compiled)
compile_regex(ft, regex);
- if (G_UNLIKELY(!ft->priv->error_regex_compiled)) /* regex error */
+ if (!ft->priv->error_regex_compiled) /* regex error */
return FALSE;
if (regexec(regex, message, G_N_ELEMENTS(pmatch), pmatch, 0) != 0)
@@ -1478,8 +1478,7 @@
*/
GeanyFiletype *filetypes_index(gint idx)
{
- return (G_LIKELY(idx >= 0) && G_LIKELY(idx < (gint) filetypes_array->len)) ?
- filetypes[idx] : NULL;
+ return (idx >= 0 && idx < (gint) filetypes_array->len) ? filetypes[idx] : NULL;
}
Modified: trunk/src/geanymenubuttonaction.c
===================================================================
--- trunk/src/geanymenubuttonaction.c 2009-04-15 22:46:13 UTC (rev 3707)
+++ trunk/src/geanymenubuttonaction.c 2009-04-15 22:47:33 UTC (rev 3708)
@@ -68,7 +68,7 @@
{
GeanyMenubuttonActionPrivate *priv = GEANY_MENU_BUTTON_ACTION_GET_PRIVATE(data);
- if (G_UNLIKELY(! priv->menu_added))
+ if (! priv->menu_added)
{
gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(priv->button), priv->menu);
priv->menu_added = TRUE;
@@ -161,7 +161,7 @@
{
GeanyMenubuttonActionPrivate *priv;
- g_return_val_if_fail(G_LIKELY(action != NULL), NULL);
+ g_return_val_if_fail(action != NULL, NULL);
priv = GEANY_MENU_BUTTON_ACTION_GET_PRIVATE(action);
Modified: trunk/src/geanyobject.c
===================================================================
--- trunk/src/geanyobject.c 2009-04-15 22:46:13 UTC (rev 3707)
+++ trunk/src/geanyobject.c 2009-04-15 22:47:33 UTC (rev 3708)
@@ -66,7 +66,7 @@
register GCClosure* cc = (GCClosure*) closure;
register gpointer data1, data2;
- g_return_if_fail(G_LIKELY(n_param_vals == 4));
+ g_return_if_fail(n_param_vals == 4);
if (G_CCLOSURE_SWAP_DATA(closure))
{
@@ -112,8 +112,8 @@
register gpointer data1, data2;
gboolean v_return;
- g_return_if_fail(G_LIKELY(return_value != NULL));
- g_return_if_fail(G_LIKELY(n_param_values == 3));
+ g_return_if_fail(return_value != NULL);
+ g_return_if_fail(n_param_values == 3);
if (G_CCLOSURE_SWAP_DATA(closure))
{
Modified: trunk/src/geanywraplabel.c
===================================================================
--- trunk/src/geanywraplabel.c 2009-04-15 22:46:13 UTC (rev 3707)
+++ trunk/src/geanywraplabel.c 2009-04-15 22:47:33 UTC (rev 3708)
@@ -84,7 +84,7 @@
{
GeanyWrapLabelPrivate *priv;
- if (G_UNLIKELY(width == 0))
+ if (width == 0)
return;
/*
Modified: trunk/src/highlighting.c
===================================================================
--- trunk/src/highlighting.c 2009-04-15 22:46:13 UTC (rev 3707)
+++ trunk/src/highlighting.c 2009-04-15 22:47:33 UTC (rev 3708)
@@ -121,7 +121,7 @@
{
gchar *result;
- if (G_UNLIKELY(config == NULL) || G_UNLIKELY(configh == NULL) || G_UNLIKELY(section == NULL))
+ if (config == NULL || configh == NULL || section == NULL)
{
style_sets[index].keywords[pos] = g_strdup(default_value);
return;
@@ -131,7 +131,7 @@
if (result == NULL)
result = g_key_file_get_string(config, section, key, NULL);
- if (G_UNLIKELY(result == NULL))
+ if (result == NULL)
{
style_sets[index].keywords[pos] = g_strdup(default_value);
}
@@ -146,7 +146,7 @@
{
gchar *result;
- if (G_UNLIKELY(config == NULL) || G_UNLIKELY(configh == NULL))
+ if (config == NULL || configh == NULL)
{
*wordchars = g_strdup(GEANY_WORDCHARS);
return;
@@ -155,7 +155,7 @@
result = g_key_file_get_string(configh, "settings", "wordchars", NULL);
if (result == NULL) result = g_key_file_get_string(config, "settings", "wordchars", NULL);
- if (G_UNLIKELY(result == NULL))
+ if (result == NULL)
{
*wordchars = g_strdup(GEANY_WORDCHARS);
}
@@ -179,11 +179,11 @@
gchar **list;
gsize len;
- g_return_if_fail(G_LIKELY(config));
- g_return_if_fail(G_LIKELY(configh));
- g_return_if_fail(G_LIKELY(key_name));
- g_return_if_fail(G_LIKELY(default_style));
- g_return_if_fail(G_LIKELY(style));
+ g_return_if_fail(config);
+ g_return_if_fail(configh);
+ g_return_if_fail(key_name);
+ g_return_if_fail(default_style);
+ g_return_if_fail(style);
list = g_key_file_get_string_list(configh, "styling", key_name, &len, NULL);
if (list == NULL)
@@ -219,10 +219,10 @@
gchar **list;
gsize len;
- g_return_if_fail(G_LIKELY(config));
- g_return_if_fail(G_LIKELY(configh));
- g_return_if_fail(G_LIKELY(section));
- g_return_if_fail(G_LIKELY(key));
+ g_return_if_fail(config);
+ g_return_if_fail(configh);
+ g_return_if_fail(section);
+ g_return_if_fail(key);
list = g_key_file_get_string_list(configh, section, key, &len, NULL);
if (list == NULL)
@@ -260,10 +260,10 @@
gchar *end1, *end2;
gsize len;
- g_return_if_fail(G_LIKELY(config));
- g_return_if_fail(G_LIKELY(configh));
- g_return_if_fail(G_LIKELY(section));
- g_return_if_fail(G_LIKELY(key));
+ g_return_if_fail(config);
+ g_return_if_fail(configh);
+ g_return_if_fail(section);
+ g_return_if_fail(key);
list = g_key_file_get_string_list(configh, section, key, &len, NULL);
if (list == NULL)
@@ -305,18 +305,18 @@
static GeanyLexerStyle *get_style(guint ft_id, guint styling_index)
{
- g_assert(G_LIKELY(ft_id < GEANY_MAX_BUILT_IN_FILETYPES));
+ g_assert(ft_id < GEANY_MAX_BUILT_IN_FILETYPES);
if (G_UNLIKELY(ft_id == GEANY_FILETYPES_NONE))
{
- g_assert(G_LIKELY(styling_index < GCS_MAX));
+ g_assert(styling_index < GCS_MAX);
return &common_style_set.styling[styling_index];
}
else
{
StyleSet *set = &style_sets[ft_id];
- g_assert(G_LIKELY(styling_index < set->count));
+ g_assert(styling_index < set->count);
return &set->styling[styling_index];
}
}
@@ -354,11 +354,11 @@
{
GString *s = NULL;
- if (G_LIKELY(app->tm_workspace))
+ if (app->tm_workspace)
{
GPtrArray *tags_array = app->tm_workspace->global_tags;
- if (G_LIKELY(tags_array))
+ if (tags_array)
{
s = symbols_find_tags_as_string(tags_array, TM_GLOBAL_TYPE_MASK, lang);
}
@@ -372,7 +372,7 @@
{
gchar *result;
- if (G_UNLIKELY(config == NULL) || G_UNLIKELY(configh == NULL))
+ if (config == NULL || configh == NULL)
{
result = NULL;
}
@@ -392,7 +392,7 @@
{
static gboolean common_style_set_valid = FALSE;
- if (G_LIKELY(common_style_set_valid))
+ if (common_style_set_valid)
return;
common_style_set_valid = TRUE; /* ensure filetypes.common is only loaded once */
@@ -646,7 +646,7 @@
static void
apply_filetype_properties(ScintillaObject *sci, gint lexer, filetype_id ft_id)
{
- g_assert(G_LIKELY(ft_id != GEANY_FILETYPES_NONE));
+ g_assert(ft_id != GEANY_FILETYPES_NONE);
SSM(sci, SCI_SETLEXER, lexer, 0);
@@ -3523,7 +3523,7 @@
* @see Scintilla messages @c SCI_STYLEGETFORE, etc, for use with ScintillaFuncs::send_message(). */
const GeanyLexerStyle *highlighting_get_style(gint ft_id, gint style_id)
{
- if (G_UNLIKELY(ft_id < 0) || G_UNLIKELY(ft_id > GEANY_MAX_BUILT_IN_FILETYPES))
+ if (ft_id < 0 || ft_id > GEANY_MAX_BUILT_IN_FILETYPES)
return NULL;
/* ensure filetype loaded */
Modified: trunk/src/keybindings.c
===================================================================
--- trunk/src/keybindings.c 2009-04-15 22:46:13 UTC (rev 3707)
+++ trunk/src/keybindings.c 2009-04-15 22:47:33 UTC (rev 3708)
@@ -126,7 +126,7 @@
{
GeanyKeyBinding *kb;
- g_assert(G_LIKELY(key_id < group->count));
+ g_assert(key_id < group->count);
kb = &group->keys[key_id];
@@ -526,7 +526,7 @@
static void on_document_close(GObject *obj, GeanyDocument *doc)
{
- if (G_LIKELY(! main_status.quitting))
+ if (! main_status.quitting)
{
g_queue_remove_all(mru_docs, doc);
g_idle_add(on_idle_close, NULL);
@@ -558,7 +558,7 @@
static void apply_kb_accel(GeanyKeyGroup *group, GeanyKeyBinding *kb, gpointer user_data)
{
- if (G_LIKELY(kb->key != 0) && kb->menu_item)
+ if (kb->key != 0 && kb->menu_item)
{
gtk_widget_add_accelerator(kb->menu_item, "activate", kb_accel_group,
kb->key, kb->mods, GTK_ACCEL_VISIBLE);
@@ -595,7 +595,7 @@
GdkModifierType mods;
val = g_key_file_get_string(config, group->name, kb->name, NULL);
- if (G_LIKELY(val != NULL))
+ if (val != NULL)
{
gtk_accelerator_parse(val, &key, &mods);
kb->key = key;
@@ -637,7 +637,7 @@
{
GeanyKeyBinding *kb = &group->keys[kb_id];
- if (G_LIKELY(kb->key != 0))
+ if (kb->key != 0)
gtk_widget_add_accelerator(menuitem, "activate", accel_group,
kb->key, kb->mods, GTK_ACCEL_VISIBLE);
}
@@ -751,7 +751,7 @@
{
group = g_ptr_array_index(keybinding_groups, g);
- if (G_LIKELY(g > 0))
+ if (g > 0)
{
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter, -1);
@@ -856,7 +856,7 @@
void keybindings_show_shortcuts(void)
{
- if (G_UNLIKELY(key_dialog))
+ if (key_dialog)
gtk_widget_destroy(key_dialog); /* in case the key_dialog is still visible */
key_dialog = create_dialog();
@@ -912,7 +912,7 @@
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
/* keybinding only valid when scintilla widget has focus */
- if (G_LIKELY(doc != NULL) && focusw == GTK_WIDGET(doc->editor->sci))
+ if (doc != NULL && focusw == GTK_WIDGET(doc->editor->sci))
{
ScintillaObject *sci = doc->editor->sci;
gint pos = sci_get_current_position(sci);
@@ -960,10 +960,10 @@
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
static GtkWidget *scribble = NULL;
- if (G_UNLIKELY(scribble == NULL))
+ if (scribble == NULL)
scribble = ui_lookup_widget(main_widgets.window, "textview_scribble");
- if (G_LIKELY(doc != NULL))
+ if (doc != NULL)
{
if (focusw == doc->priv->tag_tree)
{
@@ -1150,12 +1150,12 @@
{
GeanyKeyGroup *group;
- g_return_val_if_fail(G_LIKELY(group_id < keybinding_groups->len), NULL);
+ g_return_val_if_fail(group_id < keybinding_groups->len, NULL);
group = g_ptr_array_index(keybinding_groups, group_id);
- g_return_val_if_fail(G_LIKELY(group), NULL);
- g_return_val_if_fail(G_LIKELY(key_id < group->count), NULL);
+ g_return_val_if_fail(group, NULL);
+ g_return_val_if_fail(key_id < group->count, NULL);
return &group->keys[key_id];
}
@@ -1169,10 +1169,10 @@
{
GeanyKeyBinding *kb;
- g_return_if_fail(G_LIKELY(group_id < GEANY_KEY_GROUP_COUNT)); /* can't use this for plugin groups */
+ g_return_if_fail(group_id < GEANY_KEY_GROUP_COUNT); /* can't use this for plugin groups */
kb = keybindings_lookup_item(group_id, key_id);
- if (G_LIKELY(kb))
+ if (kb)
kb->callback(key_id);
}
@@ -1330,11 +1330,11 @@
BuildMenuItems *menu_items;
GeanyDocument *doc = document_get_current();
- if (G_UNLIKELY(doc == NULL))
+ if (doc == NULL)
return;
ft = doc->file_type;
- if (G_UNLIKELY(! ft))
+ if (! ft)
return;
menu_items = build_get_menu_items(ft->id);
@@ -1385,7 +1385,7 @@
{
gint pos;
- if (G_UNLIKELY(doc == NULL))
+ if (doc == NULL)
return FALSE;
pos = sci_get_current_position(doc->editor->sci);
@@ -1428,7 +1428,7 @@
case GEANY_KEYS_FOCUS_EDITOR:
{
GeanyDocument *doc = document_get_current();
- if (G_LIKELY(doc != NULL))
+ if (doc != NULL)
gtk_widget_grab_focus(GTK_WIDGET(doc->editor->sci));
break;
}
@@ -1553,7 +1553,7 @@
if (switch_dialog_cancelled)
return FALSE;
- if (G_UNLIKELY(! switch_dialog))
+ if (! switch_dialog)
switch_dialog = create_switch_dialog();
geany_wrap_label_set_text(GTK_LABEL(switch_dialog_label),
@@ -1600,7 +1600,7 @@
gint cur_page = gtk_notebook_get_current_page(nb);
GeanyDocument *doc = document_get_current();
- if (G_UNLIKELY(doc == NULL))
+ if (doc == NULL)
return;
sci = GTK_WIDGET(doc->editor->sci);
@@ -1634,7 +1634,7 @@
{
gint pos, new_pos;
- if (G_UNLIKELY(doc == NULL))
+ if (doc == NULL)
return;
pos = sci_get_current_position(doc->editor->sci);
@@ -1654,7 +1654,7 @@
{
GeanyDocument *doc = document_get_current();
- if (G_UNLIKELY(doc == NULL))
+ if (doc == NULL)
return;
switch (key_id)
@@ -1684,7 +1684,7 @@
gint cur_line;
GeanyDocument *doc = document_get_current();
- if (G_UNLIKELY(doc == NULL))
+ if (doc == NULL)
return;
cur_line = sci_get_current_line(doc->editor->sci);
@@ -1793,7 +1793,7 @@
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
/* edit keybindings only valid when scintilla widget has focus */
- if (G_UNLIKELY(doc == NULL) || focusw != GTK_WIDGET(doc->editor->sci))
+ if (doc == NULL || focusw != GTK_WIDGET(doc->editor->sci))
return;
switch (key_id)
@@ -1869,7 +1869,7 @@
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
/* keybindings only valid when scintilla widget has focus */
- if (G_UNLIKELY(doc == NULL) || focusw != GTK_WIDGET(doc->editor->sci))
+ if (doc == NULL || focusw != GTK_WIDGET(doc->editor->sci))
return;
switch (key_id)
@@ -1928,7 +1928,7 @@
static GtkWidget *scribble_widget = NULL;
/* special case for Select All in the scribble widget */
- if (G_UNLIKELY(scribble_widget == NULL)) /* lookup the scribble widget only once */
+ if (scribble_widget == NULL) /* lookup the scribble widget only once */
scribble_widget = ui_lookup_widget(main_widgets.window, "textview_scribble");
if (key_id == GEANY_KEYS_SELECT_ALL && focusw == scribble_widget)
{
@@ -1938,7 +1938,7 @@
doc = document_get_current();
/* keybindings only valid when scintilla widget has focus */
- if (G_UNLIKELY(doc == NULL) || focusw != GTK_WIDGET(doc->editor->sci))
+ if (doc == NULL || focusw != GTK_WIDGET(doc->editor->sci))
return;
switch (key_id)
@@ -1962,7 +1962,7 @@
static void cb_func_document_action(guint key_id)
{
GeanyDocument *doc = document_get_current();
- if (G_UNLIKELY(doc == NULL))
+ if (doc == NULL)
return;
switch (key_id)
@@ -2008,7 +2008,7 @@
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
/* keybindings only valid when scintilla widget has focus */
- if (G_UNLIKELY(doc == NULL) || focusw != GTK_WIDGET(doc->editor->sci))
+ if (doc == NULL || focusw != GTK_WIDGET(doc->editor->sci))
return;
switch (key_id)
Modified: trunk/src/keyfile.c
===================================================================
--- trunk/src/keyfile.c 2009-04-15 22:46:13 UTC (rev 3707)
+++ trunk/src/keyfile.c 2009-04-15 22:47:33 UTC (rev 3708)
@@ -233,7 +233,7 @@
gchar *locale_filename;
GeanyFiletype *ft = doc->file_type;
- if (G_UNLIKELY(ft == NULL)) /* can happen when saving a new file when quitting */
+ if (ft == NULL) /* can happen when saving a new file when quitting */
ft = filetypes[GEANY_FILETYPES_NONE];
locale_filename = utils_get_locale_from_utf8(doc->file_name);
@@ -275,7 +275,7 @@
for (i = 0; i < max; i++)
{
doc = document_get_from_page(i);
- if (G_LIKELY(doc != NULL) && G_LIKELY(doc->real_path != NULL))
+ if (doc != NULL && doc->real_path != NULL)
{
gchar *fname;
@@ -566,11 +566,11 @@
session_files = g_ptr_array_new();
have_session_files = TRUE;
i = 0;
- while (G_UNLIKELY(have_session_files))
+ while (have_session_files)
{
g_snprintf(entry, sizeof(entry), "FILE_NAME_%d", i);
tmp_array = g_key_file_get_string_list(config, "files", entry, NULL, &error);
- if (G_UNLIKELY(! tmp_array) || G_UNLIKELY(error))
+ if (! tmp_array || error)
{
g_error_free(error);
error = NULL;
@@ -670,7 +670,7 @@
if (tmp_string)
{
const GeanyEncoding *enc = encodings_get_from_charset(tmp_string);
- if (G_LIKELY(enc != NULL))
+ if (enc != NULL)
file_prefs.default_open_encoding = enc->idx;
else
file_prefs.default_open_encoding = -1;
@@ -799,7 +799,7 @@
_("Type here what you want, use it as a notice/scratch board"));
geo = g_key_file_get_integer_list(config, PACKAGE, "geometry", NULL, &error);
- if (G_UNLIKELY(error))
+ if (error)
{
ui_prefs.geometry[0] = -1;
g_error_free(error);
@@ -821,7 +821,7 @@
{
for (i = 2; i < 4; i++)
{
- if (G_UNLIKELY(ui_prefs.geometry[i] < -1))
+ if (ui_prefs.geometry[i] < -1)
ui_prefs.geometry[i] = -1;
}
}
@@ -924,7 +924,7 @@
/* replace ':' back with ';' (see get_session_file_string for details) */
g_strdelimit((gchar*) utils_path_skip_root(locale_filename), ":", ';');
- if (G_LIKELY(len > 8))
+ if (len > 8)
line_breaking = atoi(tmp[8]);
if (g_file_test(locale_filename, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_SYMLINK))
@@ -935,7 +935,7 @@
(enc_idx >= 0 && enc_idx < GEANY_ENCODINGS_MAX) ?
encodings[enc_idx].charset : NULL);
- if (G_LIKELY(doc))
+ if (doc)
{
editor_set_indent_type(doc->editor, indent_type);
editor_set_line_wrapping(doc->editor, line_wrapping);
@@ -971,7 +971,7 @@
gchar **tmp = g_ptr_array_index(session_files, i);
guint len;
- if (G_LIKELY(tmp != NULL) && (len = g_strv_length(tmp)) >= 8)
+ if (tmp != NULL && (len = g_strv_length(tmp)) >= 8)
{
if (! open_session_file(tmp, len))
failure = TRUE;
@@ -981,13 +981,13 @@
if (file_prefs.tab_order_ltr)
{
i++;
- if (G_UNLIKELY(i >= (gint)session_files->len))
+ if (i >= (gint)session_files->len)
break;
}
else
{
i--;
- if (G_UNLIKELY(i < 0))
+ if (i < 0)
break;
}
}
@@ -995,7 +995,7 @@
g_ptr_array_free(session_files, TRUE);
session_files = NULL;
- if (G_UNLIKELY(failure))
+ if (failure)
ui_set_statusbar(TRUE, _("Failed to load one or more session files."));
else if (session_notebook_page >= 0)
{
@@ -1014,7 +1014,7 @@
* realisation of the main window */
void configuration_apply_settings(void)
{
- if (G_LIKELY(scribble_text))
+ if (scribble_text)
{ /* update the scribble widget, because now it's realized */
gtk_text_buffer_set_text(
gtk_text_view_get_buffer(GTK_TEXT_VIEW(ui_lookup_widget(main_widgets.window,
Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c 2009-04-15 22:46:13 UTC (rev 3707)
+++ trunk/src/main.c 2009-04-15 22:47:33 UTC (rev 3708)
@@ -352,7 +352,7 @@
gboolean have_number = FALSE;
gsize len;
- g_assert(G_LIKELY(*line == -1) && G_LIKELY(*column == -1));
+ g_assert(*line == -1 && *column == -1);
if (! NZV(filename))
return;
@@ -499,7 +499,7 @@
* so we grab that here and replace it with a no-op */
for (i = 1; i < (*argc); i++)
{
- if (G_LIKELY((*argv)[i][0] != '+'))
+ if ((*argv)[i][0] != '+')
continue;
cl_options.goto_line = atoi((*argv)[i] + 1);
@@ -513,14 +513,14 @@
g_option_context_parse(context, argc, argv, &error);
g_option_context_free(context);
- if (G_UNLIKELY(error != NULL))
+ if (error != NULL)
{
g_printerr("Geany: %s\n", error->message);
g_error_free(error);
exit(1);
}
- if (G_UNLIKELY(show_version))
+ if (show_version)
{
printf(PACKAGE " %s ", main_get_version_string());
printf(_("(built on %s with GTK %d.%d.%d, GLib %d.%d.%d)"),
@@ -531,7 +531,7 @@
exit(0);
}
- if (G_UNLIKELY(print_prefix))
+ if (print_prefix)
{
printf("%s\n", GEANY_PREFIX);
printf("%s\n", GEANY_DATADIR);
@@ -563,14 +563,14 @@
}
#ifdef GEANY_DEBUG
- if (G_UNLIKELY(generate_datafiles))
+ if (generate_datafiles)
{
filetypes_init_types();
configuration_generate_data_files(); /* currently only filetype_extensions.conf */
exit(0);
}
#endif
- if (G_UNLIKELY(generate_tags))
+ if (generate_tags)
{
gboolean ret;
@@ -580,7 +580,7 @@
exit(ret);
}
- if (G_UNLIKELY(ft_names))
+ if (ft_names)
{
print_filetypes();
exit(0);
@@ -724,7 +724,7 @@
setptr(app->configdir, utils_get_locale_from_utf8(app->configdir));
mkdir_result = create_config_dir();
- if (G_UNLIKELY(mkdir_result != 0))
+ if (mkdir_result != 0)
{
if (! dialogs_show_question(
_("Configuration directory could not be created (%s).\nThere could be some problems "
@@ -759,11 +759,11 @@
gint line = -1, column = -1;
gchar *filename;
- g_return_val_if_fail(G_LIKELY(locale_filename), FALSE);
+ g_return_val_if_fail(locale_filename, FALSE);
/* check whether the passed filename is an URI */
filename = utils_get_path_from_uri(locale_filename);
- if (G_UNLIKELY(filename == NULL))
+ if (filename == NULL)
return FALSE;
get_line_and_column_from_filename(filename, &line, &column);
@@ -776,7 +776,7 @@
{
doc = document_open_file(filename, FALSE, NULL, NULL);
/* add recent file manually if opening_session_files is set */
- if (G_LIKELY(doc != NULL) && main_status.opening_session_files)
+ if (doc != NULL && main_status.opening_session_files)
ui_add_recent_file(doc->file_name);
g_free(filename);
return TRUE;
@@ -786,7 +786,7 @@
gchar *utf8_filename = utils_get_utf8_from_locale(filename);
doc = document_new_file(utf8_filename, NULL, NULL);
- if (G_LIKELY(doc != NULL))
+ if (doc != NULL)
ui_add_recent_file(doc->file_name);
g_free(utf8_filename);
g_free(filename);
@@ -811,7 +811,7 @@
/* It seems argv elements are encoded in CP1252 on a German Windows */
setptr(filename, g_locale_to_utf8(filename, -1, NULL, NULL, NULL));
#endif
- if (G_LIKELY(filename) && ! main_handle_filename(filename))
+ if (filename && ! main_handle_filename(filename))
{
const gchar *msg = _("Could not find file '%s'.");
@@ -829,7 +829,7 @@
{
gchar *locale_filename;
- g_return_if_fail(G_LIKELY(project_prefs.session_file != NULL));
+ g_return_if_fail(project_prefs.session_file != NULL);
locale_filename = utils_get_locale_from_utf8(project_prefs.session_file);
Modified: trunk/src/msgwindow.c
===================================================================
--- trunk/src/msgwindow.c 2009-04-15 22:46:13 UTC (rev 3707)
+++ trunk/src/msgwindow.c 2009-04-15 22:47:33 UTC (rev 3708)
@@ -327,7 +327,7 @@
* cut the string to a maximum of 1024 bytes and discard the rest */
/* TODO: find the real cause for the display problem / if it is GtkTreeView file a bug report */
len = strlen(string);
- if (G_UNLIKELY(len > 1024))
+ if (len > 1024)
tmp = g_strndup(string, 1024);
else
tmp = g_strdup(string);
@@ -475,7 +475,7 @@
}
/* copy the string into the clipboard */
- if (G_LIKELY(str->len > 0))
+ if (str->len > 0)
{
gtk_clipboard_set_text(
gtk_clipboard_get(gdk_atom_intern("CLIPBOARD", FALSE)),
@@ -562,7 +562,7 @@
{
gchar *string;
gtk_tree_model_get(model, &iter, 1, &string, -1);
- if (G_LIKELY(string != NULL) && build_parse_make_dir(string, prefix))
+ if (string != NULL && build_parse_make_dir(string, prefix))
{
g_free(string);
return TRUE;
@@ -598,7 +598,7 @@
gdk_color_free(color);
gtk_tree_model_get(model, &iter, 1, &string, -1);
- if (G_LIKELY(string != NULL))
+ if (string != NULL)
{
gint line;
gchar *filename, *dir;
@@ -625,7 +625,7 @@
if (doc == NULL) /* file not already open */
doc = document_open_file(filename, FALSE, NULL, NULL);
- if (G_LIKELY(doc != NULL))
+ if (doc != NULL)
{
if (! doc->changed) /* if modified, line may be wrong */
editor_indicator_set_on_line(doc->editor, GEANY_INDICATOR_ERROR, line - 1);
@@ -645,7 +645,7 @@
{
guint skip_dot_slash = 0; /* number of characters to skip at the beginning of the filename */
- if (G_UNLIKELY(*filename == NULL))
+ if (*filename == NULL)
return;
/* skip some characters at the beginning of the filename, at the moment only "./"
@@ -673,7 +673,7 @@
*filename = NULL;
*line = -1;
- g_return_if_fail(G_LIKELY(data->string != NULL));
+ g_return_if_fail(data->string != NULL);
fields = g_strsplit_set(data->string, data->pattern, data->min_fields);
@@ -687,7 +687,7 @@
*line = strtol(fields[data->line_idx], &end, 10);
/* if the line could not be read, line is 0 and an error occurred, so we leave */
- if (G_UNLIKELY(fields[data->line_idx] == end))
+ if (fields[data->line_idx] == end)
{
g_strfreev(fields);
return;
@@ -891,7 +891,7 @@
if (dir == NULL)
dir = build_info.dir;
- g_return_if_fail(G_LIKELY(dir != NULL));
+ g_return_if_fail(dir != NULL);
trimmed_string = g_strdup(string);
g_strchug(trimmed_string); /* remove possible leading whitespace */
@@ -930,7 +930,7 @@
{
ret = navqueue_goto_line(old_doc, doc, line);
}
- else if (line < 0 && G_LIKELY(string != NULL))
+ else if (line < 0 && string != NULL)
{
gchar *filename;
msgwin_parse_grep_line(string, &filename, &line);
@@ -938,7 +938,7 @@
{
/* use document_open_file to find an already open file, or open it in place */
doc = document_open_file(filename, FALSE, NULL, NULL);
- if (G_LIKELY(doc != NULL))
+ if (doc != NULL)
ret = navqueue_goto_line(old_doc, doc, line);
}
g_free(filename);
@@ -961,7 +961,7 @@
*filename = NULL;
*line = -1;
- if (G_UNLIKELY(string == NULL) || msgwindow.find_in_files_dir == NULL)
+ if (string == NULL || msgwindow.find_in_files_dir == NULL)
return;
/* conflict:3:conflicting types for `foo' */
@@ -1087,7 +1087,7 @@
case MSG_STATUS: store = msgwindow.store_status; break;
default: return;
}
- if (G_UNLIKELY(store == NULL))
+ if (store == NULL)
return;
gtk_list_store_clear(store);
}
Modified: trunk/src/navqueue.c
===================================================================
--- trunk/src/navqueue.c 2009-04-15 22:46:13 UTC (rev 3707)
+++ trunk/src/navqueue.c 2009-04-15 22:47:33 UTC (rev 3708)
@@ -149,8 +149,8 @@
{
gint pos;
- g_return_val_if_fail(G_LIKELY(new_doc != NULL), FALSE);
- g_return_val_if_fail(G_LIKELY(line >= 1), FALSE);
+ g_return_val_if_fail(new_doc != NULL, FALSE);
+ g_return_val_if_fail(line >= 1, FALSE);
pos = sci_get_position_from_line(new_doc->editor->sci, line - 1);
@@ -163,7 +163,7 @@
}
/* now add new file position */
- if (G_LIKELY(new_doc->file_name))
+ if (new_doc->file_name)
{
add_new_position(new_doc->file_name, pos);
}
@@ -176,7 +176,7 @@
{
GeanyDocument *doc = document_find_by_filename(file);
- if (G_UNLIKELY(doc == NULL))
+ if (doc == NULL)
return FALSE;
return editor_goto_pos(doc->editor, pos, TRUE);
@@ -245,7 +245,7 @@
{
GList *match;
- if (G_UNLIKELY(filename == NULL))
+ if (filename == NULL)
return;
while ((match = g_queue_find_custom(navigation_queue, filename, find_by_filename)))
Modified: trunk/src/notebook.c
===================================================================
--- trunk/src/notebook.c 2009-04-15 22:46:13 UTC (rev 3707)
+++ trunk/src/notebook.c 2009-04-15 22:47:33 UTC (rev 3708)
@@ -76,7 +76,7 @@
{
GeanyDocument *doc = document_get_current();
- if (G_LIKELY(doc != NULL) && G_LIKELY(event->button == 1))
+ if (doc != NULL && event->button == 1)
gtk_widget_grab_focus(GTK_WIDGET(doc->editor->sci));
return FALSE;
@@ -127,10 +127,10 @@
gdouble x, y;
page = gtk_notebook_get_nth_page(notebook, 0);
- g_return_val_if_fail(G_LIKELY(page != NULL), FALSE);
+ g_return_val_if_fail(page != NULL, FALSE);
tab = gtk_notebook_get_tab_label(notebook, page);
- g_return_val_if_fail(G_LIKELY(tab != NULL), FALSE);
+ g_return_val_if_fail(tab != NULL, FALSE);
tab_pos = gtk_notebook_get_tab_pos(notebook);
nb = GTK_WIDGET(notebook);
@@ -478,7 +478,7 @@
gint tabnum;
GtkWidget *page;
- g_return_val_if_fail(G_LIKELY(this != NULL), -1);
+ g_return_val_if_fail(this != NULL, -1);
page = GTK_WIDGET(this->editor->sci);
Modified: trunk/src/plugins.c
===================================================================
--- trunk/src/plugins.c 2009-04-15 22:46:13 UTC (rev 3707)
+++ trunk/src/plugins.c 2009-04-15 22:47:33 UTC (rev 3708)
@@ -406,7 +406,7 @@
{
GList *item;
- g_return_val_if_fail(G_LIKELY(filename), FALSE);
+ g_return_val_if_fail(filename, FALSE);
for (item = active_plugin_list; item != NULL; item = g_list_next(item))
{
@@ -443,7 +443,7 @@
"release of Geany - recompile it.", g_module_name(module));
return FALSE;
}
- if (G_UNLIKELY(result > 0))
+ if (result > 0)
{
geany_debug("Plugin \"%s\" requires a newer version of Geany (API >= v%d).",
g_module_name(module), result);
@@ -528,33 +528,33 @@
/* set these symbols before plugin_init() is called */
g_module_symbol(plugin->module, "geany_plugin", (void *) &p_geany_plugin);
- if (G_LIKELY(p_geany_plugin))
+ if (p_geany_plugin)
*p_geany_plugin = &plugin->public;
g_module_symbol(plugin->module, "plugin_info", (void *) &p_info);
- if (G_LIKELY(p_info))
+ if (p_info)
*p_info = &plugin->info;
g_module_symbol(plugin->module, "geany_data", (void *) &p_geany_data);
- if (G_LIKELY(p_geany_data))
+ if (p_geany_data)
*p_geany_data = &geany_data;
g_module_symbol(plugin->module, "geany_functions", (void *) &p_geany_functions);
- if (G_LIKELY(p_geany_functions))
+ if (p_geany_functions)
*p_geany_functions = &geany_functions;
g_module_symbol(plugin->module, "plugin_fields", (void *) &plugin_fields);
if (plugin_fields)
*plugin_fields = &plugin->fields;
/* start the plugin */
- g_return_if_fail(G_LIKELY(plugin->init));
+ g_return_if_fail(plugin->init);
plugin->init(&geany_data);
- if (G_LIKELY(p_geany_plugin) && (*p_geany_plugin)->priv->resident)
+ if (p_geany_plugin && (*p_geany_plugin)->priv->resident)
g_module_make_resident(plugin->module);
/* store some function pointers for later use */
g_module_symbol(plugin->module, "plugin_configure", (void *) &plugin->configure);
g_module_symbol(plugin->module, "plugin_help", (void *) &plugin->help);
g_module_symbol(plugin->module, "plugin_cleanup", (void *) &plugin->cleanup);
- if (G_UNLIKELY(plugin->cleanup == NULL))
+ if (plugin->cleanup == NULL)
{
if (app->debug_mode)
g_warning("Plugin '%s' has no plugin_cleanup() function - there may be memory leaks!",
@@ -596,7 +596,7 @@
GModule *module;
void (*plugin_set_info)(PluginInfo*);
- g_return_val_if_fail(G_LIKELY(fname), NULL);
+ g_return_val_if_fail(fname, NULL);
g_return_val_if_fail(g_module_supported(), NULL);
/* find the plugin in the list of already loaded, active plugins and use it, otherwise
@@ -617,7 +617,7 @@
* Also without G_MODULE_BIND_LOCAL calling public functions e.g. the old info()
* function from a plugin will be shadowed. */
module = g_module_open(fname, G_MODULE_BIND_LOCAL);
- if (G_UNLIKELY(! module))
+ if (! module)
{
geany_debug("Can't load plugin: %s", g_module_error());
return NULL;
@@ -640,7 +640,7 @@
}
g_module_symbol(module, "plugin_set_info", (void *) &plugin_set_info);
- if (G_UNLIKELY(plugin_set_info == NULL))
+ if (plugin_set_info == NULL)
{
geany_debug("No plugin_set_info() defined for \"%s\" - ignoring plugin!", fname);
@@ -665,7 +665,7 @@
}
g_module_symbol(module, "plugin_init", (void *) &plugin->init);
- if (G_UNLIKELY(plugin->init == NULL))
+ if (plugin->init == NULL)
{
geany_debug("Plugin '%s' has no plugin_init() function - ignoring plugin!",
plugin->info.name);
@@ -717,7 +717,7 @@
{
GtkWidget *widget;
- if (G_LIKELY(plugin->cleanup))
+ if (plugin->cleanup)
plugin->cleanup();
remove_callbacks(plugin);
@@ -736,8 +736,8 @@
static void
plugin_free(Plugin *plugin)
{
- g_return_if_fail(G_LIKELY(plugin));
- g_return_if_fail(G_LIKELY(plugin->module));
+ g_return_if_fail(plugin);
+ g_return_if_fail(plugin->module);
if (is_active_plugin(plugin))
plugin_cleanup(plugin);
@@ -788,7 +788,7 @@
for (item = list; item != NULL; item = g_slist_next(item))
{
tmp = strrchr(item->data, '.');
- if (G_UNLIKELY(tmp == NULL) || utils_str_casecmp(tmp, "." PLUGIN_EXT) != 0)
+ if (tmp == NULL || utils_str_casecmp(tmp, "." PLUGIN_EXT) != 0)
continue;
fname = g_strconcat(path, G_DIR_SEPARATOR_S, item->data, NULL);
@@ -1017,7 +1017,7 @@
{
gtk_tree_model_get(model, &iter, PLUGIN_COLUMN_PLUGIN, &p, -1);
- if (G_LIKELY(p != NULL))
+ if (p != NULL)
{
gchar *text;
PluginInfo *pi;
@@ -1053,8 +1053,7 @@
gtk_tree_model_get(GTK_TREE_MODEL(pm_widgets.store), &iter,
PLUGIN_COLUMN_CHECK, &old_state, PLUGIN_COLUMN_PLUGIN, &p, -1);
- if (G_UNLIKELY(p == NULL))
- return;
+ g_return_if_fail(p != NULL);
state = ! old_state; /* toggle the state */
/* save the filename of the plugin */
@@ -1195,7 +1194,7 @@
{
gtk_tree_model_get(model, &iter, PLUGIN_COLUMN_PLUGIN, &p, -1);
- if (G_LIKELY(p != NULL))
+ if (p != NULL)
{
if (GPOINTER_TO_INT(user_data) == PM_BUTTON_CONFIGURE)
configure_plugin(p);
@@ -1316,7 +1315,7 @@
gint pos;
GeanyAutoSeparator *autosep;
- g_return_if_fail(G_LIKELY(plugin));
+ g_return_if_fail(plugin);
autosep = &plugin->priv->toolbar_separator;
if (!autosep->widget)
@@ -1334,7 +1333,7 @@
else
{
pos = gtk_toolbar_get_item_index(toolbar, GTK_TOOL_ITEM(autosep->widget));
- g_return_if_fail(G_LIKELY(pos >= 0));
+ g_return_if_fail(pos >= 0);
gtk_toolbar_insert(toolbar, item, pos);
}
/* hide the separator widget if there are no toolbar items showing for the plugin */
@@ -1352,7 +1351,7 @@
*/
void plugin_module_make_resident(GeanyPlugin *plugin)
{
- g_return_if_fail(G_LIKELY(plugin));
+ g_return_if_fail(plugin);
plugin->priv->resident = TRUE;
}
Modified: trunk/src/prefs.c
===================================================================
--- trunk/src/prefs.c 2009-04-15 22:46:13 UTC (rev 3707)
+++ trunk/src/prefs.c 2009-04-15 22:47:33 UTC (rev 3708)
@@ -170,7 +170,7 @@
GeanyKeyGroup *group;
GeanyKeyBinding *kb;
- if (G_UNLIKELY(store == NULL))
+ if (store == NULL)
init_kb_tree();
for (g = 0; g < keybinding_groups->len; g++)
@@ -1185,7 +1185,7 @@
static void on_cell_edited(GtkCellRendererText *cellrenderertext, gchar *path, gchar *new_text, gpointer user_data)
{
- if (G_LIKELY(path != NULL) && new_text != NULL)
+ if (path != NULL && new_text != NULL)
{
GtkTreeIter iter;
guint lkey;
@@ -1222,7 +1222,7 @@
state = event->state & GEANY_KEYS_MODIFIER_MASK;
- if (G_UNLIKELY(event->keyval == GDK_Escape))
+ if (event->keyval == GDK_Escape)
return FALSE; /* close the dialog, don't allow escape when detecting keybindings. */
str = gtk_accelerator_name(event->keyval, state);
@@ -1281,7 +1281,7 @@
while (TRUE) /* foreach child */
{
gtk_tree_model_get(model, iter, KB_TREE_INDEX, &idx, -1);
- if (G_UNLIKELY(idx == i))
+ if (idx == i)
return TRUE;
if (! gtk_tree_model_iter_next(model, iter))
return FALSE; /* no more children */
@@ -1313,7 +1313,7 @@
gsize g, i;
/* allow duplicate if there is no key combination */
- if (G_UNLIKELY(key == 0) && G_UNLIKELY(mods == 0))
+ if (key == 0 && mods == 0)
return FALSE;
for (g = 0; g < keybinding_groups->len; g++)
@@ -1414,7 +1414,7 @@
void prefs_show_dialog(void)
{
- if (G_UNLIKELY(ui_widgets.prefs_dialog == NULL))
+ if (ui_widgets.prefs_dialog == NULL)
{
GtkWidget *combo_new, *combo_open, *combo_eol;
GtkWidget *label;
Modified: trunk/src/queue.c
===================================================================
--- trunk/src/queue.c 2009-04-15 22:46:13 UTC (rev 3707)
+++ trunk/src/queue.c 2009-04-15 22:47:33 UTC (rev 3708)
@@ -54,7 +54,7 @@
{
GeanyQueue *temp, *next;
- if (G_UNLIKELY(queue_start == NULL) || G_UNLIKELY(data == NULL))
+ if (queue_start == NULL || data == NULL)
return;
if (queue_start->data == NULL)
@@ -81,7 +81,7 @@
{
GeanyQueue *ret;
- if (G_UNLIKELY(NULL == queue_start))
+ if (NULL == queue_start)
return NULL;
if (data != NULL)
@@ -110,7 +110,7 @@
{
GeanyQueue *temp = param;
- if (G_UNLIKELY(! queue_start) || G_UNLIKELY(! param))
+ if (! queue_start || ! param)
return;
do
Modified: trunk/src/sciwrappers.c
===================================================================
--- trunk/src/sciwrappers.c 2009-04-15 22:46:13 UTC (rev 3707)
+++ trunk/src/sciwrappers.c 2009-04-15 22:47:33 UTC (rev 3708)
@@ -153,7 +153,7 @@
void sci_add_text(ScintillaObject* sci, const gchar* text)
{
- if (G_LIKELY(text != NULL))
+ if (text != NULL)
{ /* if null text is passed to scintilla will segfault */
SSM( sci, SCI_ADDTEXT, strlen(text), (sptr_t) text);
}
Modified: trunk/src/socket.c
===================================================================
--- trunk/src/socket.c 2009-04-15 22:46:13 UTC (rev 3707)
+++ trunk/src/socket.c 2009-04-15 22:47:33 UTC (rev 3708)
@@ -126,7 +126,7 @@
gint i;
gchar *filename;
- g_return_if_fail(G_LIKELY(argc > 1));
+ g_return_if_fail(argc > 1);
geany_debug("using running instance of Geany");
if (cl_options.goto_line >= 0)
@@ -154,7 +154,7 @@
filename = main_get_argv_filename(argv[i]);
/* if the filename is valid or if a new file should be opened is check on the other side */
- if (G_LIKELY(filename != NULL))
+ if (filename != NULL)
{
socket_fd_write_all(sock, filename, strlen(filename));
socket_fd_write_all(sock, "\n", 1);
@@ -203,7 +203,7 @@
HWND hwnd;
socket_init_win32();
hmutex = CreateMutexA(NULL, FALSE, "Geany");
- if (G_UNLIKELY(! hmutex))
+ if (! hmutex)
{
geany_debug("cannot create Mutex\n");
return -1;
@@ -217,20 +217,20 @@
* and the only data is the configuration directory path.
* For now we use one port number, that is we support only one instance at all. */
sock = socket_fd_open_inet(REMOTE_CMD_PORT);
- if (G_UNLIKELY(sock < 0))
+ if (sock < 0)
return 0;
return sock;
}
sock = socket_fd_connect_inet(REMOTE_CMD_PORT);
- if (G_UNLIKELY(sock < 0))
+ if (sock < 0)
return -1;
#else
gchar *display_name = gdk_get_display();
gchar *hostname = utils_get_hostname();
gchar *p;
- if (G_UNLIKELY(display_name == NULL))
+ if (display_name == NULL)
display_name = g_strdup("NODISPLAY");
/* these lines are taken from dcopc.c in kdelibs */
@@ -239,7 +239,7 @@
while ((p = strchr(display_name, ':')) != NULL)
*p = '_';
- if (G_UNLIKELY(socket_info.file_name == NULL))
+ if (socket_info.file_name == NULL)
socket_info.file_name = g_strdup_printf("%s%cgeany_socket_%s_%s",
app->configdir, G_DIR_SEPARATOR, hostname, display_name);
@@ -275,12 +275,12 @@
gint socket_finalize(void)
{
- if (G_UNLIKELY(socket_info.lock_socket < 0))
+ if (socket_info.lock_socket < 0)
return -1;
- if (G_LIKELY(socket_info.lock_socket_tag > 0))
+ if (socket_info.lock_socket_tag > 0)
g_source_remove(socket_info.lock_socket_tag);
- if (G_LIKELY(socket_info.read_ioc))
+ if (socket_info.read_ioc)
{
g_io_channel_shutdown(socket_info.read_ioc, FALSE, NULL);
g_io_channel_unref(socket_info.read_ioc);
@@ -290,7 +290,7 @@
#ifdef G_OS_WIN32
WSACleanup();
#else
- if (G_LIKELY(socket_info.file_name != NULL))
+ if (socket_info.file_name != NULL)
{
remove_socket_link_full(); /* deletes the socket file and the symlink */
g_free(socket_info.file_name);
@@ -308,7 +308,7 @@
struct sockaddr_un addr;
sock = socket(PF_UNIX, SOCK_STREAM, 0);
- if (G_UNLIKELY(sock < 0))
+ if (sock < 0)
{
perror("fd_connect_unix(): socket");
return -1;
@@ -337,7 +337,7 @@
sock = socket(PF_UNIX, SOCK_STREAM, 0);
- if (G_UNLIKELY(sock < 0))
+ if (sock < 0)
{
perror("sock_open_unix(): socket");
return -1;
@@ -503,7 +503,7 @@
utf8_filename = g_strdup(buf);
locale_filename = utils_get_locale_from_utf8(utf8_filename);
- if (G_LIKELY(locale_filename))
+ if (locale_filename)
main_handle_filename(locale_filename);
g_free(utf8_filename);
g_free(locale_filename);
@@ -641,7 +641,7 @@
#ifdef G_OS_UNIX
/* checking for non-blocking mode */
flags = fcntl(fd, F_GETFL, 0);
- if (G_UNLIKELY(flags < 0))
+ if (flags < 0)
{
perror("fcntl");
return 0;
@@ -681,7 +681,7 @@
while (len)
{
n = socket_fd_write(fd, buf, len);
- if (G_UNLIKELY(n <= 0))
+ if (n <= 0)
return -1;
len -= n;
wrlen += n;
Modified: trunk/src/symbols.c
===================================================================
--- trunk/src/symbols.c 2009-04-15 22:46:13 UTC (rev 3707)
+++ trunk/src/symbols.c 2009-04-15 22:47:33 UTC (rev 3708)
@@ -144,7 +144,7 @@
load_c_ignore_tags();
}
- if (cl_options.ignore_global_tags || G_UNLIKELY(app->tm_workspace == NULL))
@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list