Remove extra whitespace at end of lines in all source files.

* Processed with rstrip-whitespace.py script added to scripts/ directory.
* Script run on all .c and .h files in src/ and plugins/ directories.
* Also remove more than one newline at the end of files.
This commit is contained in:
Matthew Brush 2011-10-11 21:52:58 -07:00
parent 182bdc3b17
commit bd5fba7eb5
22 changed files with 31 additions and 35 deletions

View File

@ -805,5 +805,3 @@ void plugin_cleanup(void)
if (config_file != NULL)
g_free(config_file);
}

23
scripts/rstrip-whitespace.py Executable file
View File

@ -0,0 +1,23 @@
#!/usr/bin/env python
import sys
filenames = sys.argv[1:]
def backup_file (fn):
open ("%s~" % fn, "w").write (open (fn, "r").read ())
for fn in filenames:
#backup_file (fn)
contents = open (fn, "r").read ()
lines = contents.split ('\n')
with open (fn, "w") as fobj:
for line in lines:
line = line.rstrip ()
fobj.write ("%s\n" % line)
contents = open (fn, "r").read ()
contents.rstrip ()
while contents[-1] in " \t\r\n":
contents = contents[:-1]
open (fn, "w").write ("%s\n" % contents)

View File

@ -1272,7 +1272,7 @@ static void on_build_menu_item(GtkWidget *w, gpointer user_data)
{
if (document_need_save_as(doc) && !dialogs_show_save_as())
return;
if (!document_save_file(doc, FALSE))
return;
}
@ -2767,5 +2767,3 @@ void build_init(void)
/* set the submenu to the toolbar item */
geany_menu_button_action_set_menu(GEANY_MENU_BUTTON_ACTION(widgets.build_action), toolmenu);
}

View File

@ -863,7 +863,7 @@ gboolean dialogs_show_unsaved_file(GeanyDocument *doc)
}
case GTK_RESPONSE_NO:
return TRUE;
case GTK_RESPONSE_CANCEL: /* fall through to default and leave the function */
default:
return FALSE;
@ -1703,5 +1703,3 @@ gint dialogs_show_prompt(GtkWidget *parent,
g_free(string);
return result;
}

View File

@ -2358,7 +2358,7 @@ void editor_insert_text_block(GeanyEditor *editor, const gchar *text, gint inser
{
const gchar *nl = replace_newlines ? "\n" : eol;
gchar *whitespace;
whitespace = g_strnfill(newline_indent_size, ' ');
setptr(whitespace, g_strconcat(nl, whitespace, NULL));
utils_string_replace_all(buf, nl, whitespace);
@ -3911,7 +3911,7 @@ void editor_finalize()
/* wordchars: NULL or a string containing characters to match a word.
* Returns: the current selection or the current word.
*
*
* Passing NULL as wordchars is NOT the same as passing GEANY_WORDCHARS: NULL means
* using Scintillas's word boundaries. */
gchar *editor_get_default_selection(GeanyEditor *editor, gboolean use_current_word,

View File

@ -1736,4 +1736,3 @@ const gchar *filetypes_get_display_name(GeanyFiletype *ft)
{
return ft->id == GEANY_FILETYPES_NONE ? _("None") : ft->name;
}

View File

@ -1811,5 +1811,3 @@ static gboolean gb_on_key_pressed(GtkWidget *widget, GdkEventKey *event, gpointe
}
}
}

View File

@ -184,4 +184,3 @@ GtkAction *geany_entry_action_new(const gchar *name, const gchar *label,
return action;
}

View File

@ -369,4 +369,3 @@ GObject *geany_object_new(void)
{
return g_object_new(GEANY_OBJECT_TYPE, NULL);
}

View File

@ -3978,4 +3978,3 @@ gboolean highlighting_is_code_style(gint lexer, gint style)
return !(highlighting_is_comment_style(lexer, style) ||
highlighting_is_string_style(lexer, style));
}

View File

@ -1689,4 +1689,3 @@ static const guint8 save_all_tango_inline[] =
"\0\0\0\12\0\0\0\12\0\0\0\12\0\0\0\12\0\0\0\12\0\0\0\12\0\0\0\12\0\0\0"
"\7\0\0\0\4\0\0\0\2\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
"\377\0"};

View File

@ -5816,4 +5816,3 @@ create_project_dialog (void)
return project_dialog;
}

View File

@ -690,7 +690,7 @@ static void load_dialog_prefs(GKeyFile *config)
g_key_file_set_boolean(config, PACKAGE, atomic_file_saving_key,
utils_get_setting_boolean(config, PACKAGE, "use_safe_file_saving", FALSE));
}
/* read stash prefs */
settings_action(config, SETTING_READ);

View File

@ -1209,5 +1209,3 @@ void msgwin_clear_tab(gint tabnum)
return;
gtk_list_store_clear(store);
}

View File

@ -505,5 +505,3 @@ on_window_drag_data_received(GtkWidget *widget, GdkDragContext *drag_context,
}
gtk_drag_finish(drag_context, success, FALSE, event_time);
}

View File

@ -917,4 +917,3 @@ void printing_print_doc(GeanyDocument *doc)
else
print_external(doc);
}

View File

@ -788,5 +788,3 @@ gint socket_fd_write(gint fd, const gchar *buf, gint len)
#endif

View File

@ -2202,5 +2202,3 @@ void symbols_finalize(void)
g_strfreev(html_entities);
g_strfreev(c_tags_ignore);
}

View File

@ -1114,5 +1114,3 @@ void toolbar_configure(GtkWindow *parent)
tb_editor_free_path(tbw);
g_free(tbw);
}

View File

@ -960,5 +960,3 @@ void tools_color_chooser(const gchar *color)
gtk_window_present(GTK_WINDOW(ui_widgets.open_colorsel));
#endif
}

View File

@ -1621,12 +1621,12 @@ guint utils_string_regex_replace_all(GString *haystack, GRegex *regex,
while (g_regex_match_full(regex, haystack->str, -1, start, 0, &minfo, NULL))
{
gint end, len;
g_match_info_fetch_pos(minfo, match_num, &start, &end);
len = end - start;
utils_string_replace(haystack, start, len, replace);
ret++;
/* skip past whole match */
g_match_info_fetch_pos(minfo, 0, NULL, &end);
start = end - len + strlen(replace);

View File

@ -533,7 +533,7 @@ void win32_show_font_dialog(void)
memset(&lf, 0, sizeof lf);
/* TODO: init lf members */
memset(&cf, 0, sizeof cf);
cf.lStructSize = sizeof cf;
cf.hwndOwner = GDK_WINDOW_HWND(main_widgets.window->window);