Skip to content

Commit 98536a3

Browse files
committed
reduce the scope of some variables
1 parent 5cd8bf0 commit 98536a3

5 files changed

+23
-12
lines changed

lapiz/bacon-message-connection.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -224,14 +224,16 @@ find_file_with_pattern (const char *dir, const char *pattern)
224224
static char *
225225
socket_filename (const char *prefix)
226226
{
227-
char *pattern, *newfile, *path, *filename;
227+
char *pattern, *path, *filename;
228228
const char *tmpdir;
229229

230230
pattern = g_strdup_printf ("%s.%s.*", prefix, g_get_user_name ());
231231
tmpdir = g_get_tmp_dir ();
232232
filename = find_file_with_pattern (tmpdir, pattern);
233233
if (filename == NULL)
234234
{
235+
char *newfile;
236+
235237
newfile = g_strdup_printf ("%s.%s.%u", prefix,
236238
g_get_user_name (), g_random_int ());
237239
path = g_build_filename (tmpdir, newfile, NULL);

lapiz/lapiz-documents-panel.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,14 @@ window_active_tab_changed (LapizWindow *window,
146146
if (!_lapiz_window_is_removing_tabs (window))
147147
{
148148
CtkTreeIter iter;
149-
CtkTreeSelection *selection;
150149

151150
get_iter_from_tab (panel, tab, &iter);
152151

153152
if (ctk_list_store_iter_is_valid (CTK_LIST_STORE (panel->priv->model),
154153
&iter))
155154
{
155+
CtkTreeSelection *selection;
156+
156157
selection = ctk_tree_view_get_selection (
157158
CTK_TREE_VIEW (panel->priv->treeview));
158159

lapiz/lapiz-io-error-message-area.c

+12-7
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,7 @@ set_message_area_text_and_icon (CtkWidget *message_area,
113113
CtkWidget *image;
114114
CtkWidget *vbox;
115115
gchar *primary_markup;
116-
gchar *secondary_markup;
117116
CtkWidget *primary_label;
118-
CtkWidget *secondary_label;
119117

120118
hbox_content = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 8);
121119

@@ -139,6 +137,9 @@ set_message_area_text_and_icon (CtkWidget *message_area,
139137

140138
if (secondary_text != NULL)
141139
{
140+
gchar *secondary_markup;
141+
CtkWidget *secondary_label;
142+
142143
secondary_markup = g_strdup_printf ("<small>%s</small>",
143144
secondary_text);
144145
secondary_label = ctk_label_new (secondary_markup);
@@ -209,12 +210,13 @@ parse_gio_error (gint code,
209210
case G_IO_ERROR_NOT_SUPPORTED:
210211
{
211212
gchar *scheme_string;
212-
gchar *scheme_markup;
213213

214214
scheme_string = g_uri_parse_scheme (uri);
215215

216216
if ((scheme_string != NULL) && g_utf8_validate (scheme_string, -1, NULL))
217217
{
218+
gchar *scheme_markup;
219+
218220
scheme_markup = g_markup_printf_escaped ("<i>%s:</i>", scheme_string);
219221

220222
/* Translators: %s is a URI scheme (like for example http:, ftp:, etc.) */
@@ -475,9 +477,7 @@ create_conversion_error_message_area (const gchar *primary_text,
475477
CtkWidget *image;
476478
CtkWidget *vbox;
477479
gchar *primary_markup;
478-
gchar *secondary_markup;
479480
CtkWidget *primary_label;
480-
CtkWidget *secondary_label;
481481

482482
message_area = ctk_info_bar_new ();
483483

@@ -534,6 +534,9 @@ create_conversion_error_message_area (const gchar *primary_text,
534534

535535
if (secondary_text != NULL)
536536
{
537+
gchar *secondary_markup;
538+
CtkWidget *secondary_label;
539+
537540
secondary_markup = g_strdup_printf ("<small>%s</small>",
538541
secondary_text);
539542
secondary_label = ctk_label_new (secondary_markup);
@@ -1025,8 +1028,6 @@ lapiz_unrecoverable_saving_error_message_area_new (const gchar *uri,
10251028
gchar *error_message = NULL;
10261029
gchar *message_details = NULL;
10271030
gchar *full_formatted_uri;
1028-
gchar *scheme_string;
1029-
gchar *scheme_markup;
10301031
gchar *uri_for_display;
10311032
gchar *temp_uri_for_display;
10321033
CtkWidget *message_area;
@@ -1051,10 +1052,14 @@ lapiz_unrecoverable_saving_error_message_area_new (const gchar *uri,
10511052

10521053
if (is_gio_error (error, G_IO_ERROR_NOT_SUPPORTED))
10531054
{
1055+
gchar *scheme_string;
1056+
10541057
scheme_string = g_uri_parse_scheme (uri);
10551058

10561059
if ((scheme_string != NULL) && g_utf8_validate (scheme_string, -1, NULL))
10571060
{
1061+
gchar *scheme_markup;
1062+
10581063
scheme_markup = g_markup_printf_escaped ("<i>%s:</i>", scheme_string);
10591064

10601065
/* Translators: %s is a URI scheme (like for example http:, ftp:, etc.) */

lapiz/lapiz-session.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,16 @@ client_save_state_cb (EggSMClient *client,
134134
gpointer user_data)
135135
{
136136
const GList *windows;
137-
gchar *group_name;
138137
int n;
139138

140139
windows = lapiz_app_get_windows (lapiz_app_get_default ());
141140
n = 1;
142141

143142
while (windows != NULL)
144143
{
145-
group_name = g_strdup_printf ("lapiz window %d", n);
144+
gchar *group_name;
145+
146+
group_name = g_strdup_printf ("lapiz window %d", n);
146147
save_window_session (state_file,
147148
group_name,
148149
LAPIZ_WINDOW (windows->data));

lapiz/lapiz-utils.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -1493,7 +1493,7 @@ lapiz_utils_decode_uri (const gchar *uri,
14931493
if (hier_part_start[0] == '/' && hier_part_start[1] == '/')
14941494
{
14951495
const char *authority_start, *authority_end;
1496-
const char *userinfo_start, *userinfo_end;
1496+
const char *userinfo_end;
14971497
const char *host_start, *host_end;
14981498
const char *port_start;
14991499

@@ -1512,6 +1512,8 @@ lapiz_utils_decode_uri (const gchar *uri,
15121512

15131513
if (userinfo_end)
15141514
{
1515+
const char *userinfo_start;
1516+
15151517
userinfo_start = authority_start;
15161518

15171519
if (user)

0 commit comments

Comments
 (0)