Skip to content

Commit 47ef3be

Browse files
committed
Initialize GValues with G_VALUE_INIT instead of { 0, }
1 parent d1d3a5e commit 47ef3be

32 files changed

+78
-78
lines changed

app/config/gimpconfig-utils.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ gimp_config_connect_notify (GObject *src,
4747
(dest_spec->flags & G_PARAM_WRITABLE) &&
4848
(dest_spec->flags & G_PARAM_CONSTRUCT_ONLY) == 0)
4949
{
50-
GValue value = { 0, };
50+
GValue value = G_VALUE_INIT;
5151

5252
g_value_init (&value, param_spec->value_type);
5353

@@ -128,7 +128,7 @@ gimp_config_connect_full_notify (GObject *src,
128128
(dest_spec->flags & G_PARAM_WRITABLE) &&
129129
(dest_spec->flags & G_PARAM_CONSTRUCT_ONLY) == 0)
130130
{
131-
GValue value = { 0, };
131+
GValue value = G_VALUE_INIT;
132132

133133
g_value_init (&value, param_spec->value_type);
134134

app/config/gimprc.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ gimp_rc_query (GimpRc *rc,
407407
if (prop_spec)
408408
{
409409
GString *str = g_string_new (NULL);
410-
GValue value = { 0, };
410+
GValue value = G_VALUE_INIT;
411411

412412
g_value_init (&value, prop_spec->value_type);
413413
g_object_get_property (rc_object, prop_spec->name, &value);
@@ -556,7 +556,7 @@ gimp_rc_migrate (GimpRc *rc)
556556

557557
if (GIMP_IS_PARAM_SPEC_CONFIG_PATH (pspec))
558558
{
559-
GValue value = { 0, };
559+
GValue value = G_VALUE_INIT;
560560

561561
g_value_init (&value, pspec->value_type);
562562

app/config/test-config.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ notify_callback (GObject *object,
194194
GParamSpec *pspec)
195195
{
196196
GString *str;
197-
GValue value = { 0, };
197+
GValue value = G_VALUE_INIT;
198198

199199
g_return_if_fail (G_IS_OBJECT (object));
200200
g_return_if_fail (G_IS_PARAM_SPEC (pspec));

app/core/gimp.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -957,8 +957,8 @@ gimp_global_config_notify (GObject *global_config,
957957
GParamSpec *param_spec,
958958
GObject *edit_config)
959959
{
960-
GValue global_value = { 0, };
961-
GValue edit_value = { 0, };
960+
GValue global_value = G_VALUE_INIT;
961+
GValue edit_value = G_VALUE_INIT;
962962

963963
g_value_init (&global_value, param_spec->value_type);
964964
g_value_init (&edit_value, param_spec->value_type);
@@ -988,8 +988,8 @@ gimp_edit_config_notify (GObject *edit_config,
988988
GParamSpec *param_spec,
989989
GObject *global_config)
990990
{
991-
GValue edit_value = { 0, };
992-
GValue global_value = { 0, };
991+
GValue edit_value = G_VALUE_INIT;
992+
GValue global_value = G_VALUE_INIT;
993993

994994
g_value_init (&edit_value, param_spec->value_type);
995995
g_value_init (&global_value, param_spec->value_type);

app/core/gimpcurve.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ gimp_curve_get_property (GObject *object,
312312
case PROP_POINTS:
313313
{
314314
GimpValueArray *array = gimp_value_array_new (curve->n_points * 2);
315-
GValue v = { 0, };
315+
GValue v = G_VALUE_INIT;
316316
gint i;
317317

318318
g_value_init (&v, G_TYPE_DOUBLE);
@@ -339,7 +339,7 @@ gimp_curve_get_property (GObject *object,
339339
case PROP_SAMPLES:
340340
{
341341
GimpValueArray *array = gimp_value_array_new (curve->n_samples);
342-
GValue v = { 0, };
342+
GValue v = G_VALUE_INIT;
343343
gint i;
344344

345345
g_value_init (&v, G_TYPE_DOUBLE);

app/core/gimpdashpattern.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ gimp_dash_pattern_to_value_array (GArray *pattern)
254254
if (pattern != NULL && pattern->len > 0)
255255
{
256256
GimpValueArray *value_array = gimp_value_array_new (pattern->len);
257-
GValue item = { 0, };
257+
GValue item = G_VALUE_INIT;
258258
gint i;
259259

260260
g_value_init (&item, G_TYPE_DOUBLE);

app/core/gimpparamspecs-duplicate.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ gimp_param_spec_duplicate (GParamSpec *pspec)
215215
gdouble g = 0.0;
216216
gdouble b = 0.0;
217217
gdouble a = 1.0;
218-
GValue value = { 0, };
218+
GValue value = G_VALUE_INIT;
219219

220220
g_value_init (&value, GEGL_TYPE_COLOR);
221221
g_param_value_set_default (pspec, &value);

app/core/gimpsymmetry-tiling.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ gimp_tiling_set_property (GObject *object,
204204

205205
if (tiling->interval_x <= tiling->shift + G_DOUBLE_EPSILON)
206206
{
207-
GValue val = {0,};
207+
GValue val = G_VALUE_INIT;
208208

209209
g_value_init (&val, G_TYPE_DOUBLE);
210210
g_value_set_double (&val, 0.0);
@@ -225,7 +225,7 @@ gimp_tiling_set_property (GObject *object,
225225

226226
if (tiling->interval_y <= G_DOUBLE_EPSILON)
227227
{
228-
GValue val = {0,};
228+
GValue val = G_VALUE_INIT;
229229

230230
g_value_init (&val, G_TYPE_DOUBLE);
231231
g_value_set_double (&val, 0.0);

app/dialogs/preferences-dialog.c

+9-9
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ prefs_config_notify (GObject *config,
180180
GParamSpec *param_spec,
181181
GObject *config_copy)
182182
{
183-
GValue global_value = { 0, };
184-
GValue copy_value = { 0, };
183+
GValue global_value = G_VALUE_INIT;
184+
GValue copy_value = G_VALUE_INIT;
185185

186186
g_value_init (&global_value, param_spec->value_type);
187187
g_value_init (&copy_value, param_spec->value_type);
@@ -211,8 +211,8 @@ prefs_config_copy_notify (GObject *config_copy,
211211
GParamSpec *param_spec,
212212
GObject *config)
213213
{
214-
GValue copy_value = { 0, };
215-
GValue global_value = { 0, };
214+
GValue copy_value = G_VALUE_INIT;
215+
GValue global_value = G_VALUE_INIT;
216216

217217
g_value_init (&copy_value, param_spec->value_type);
218218
g_value_init (&global_value, param_spec->value_type);
@@ -324,7 +324,7 @@ prefs_response (GtkWidget *widget,
324324
for (list = confirm_diff; list; list = g_list_next (list))
325325
{
326326
GParamSpec *param_spec = list->data;
327-
GValue value = { 0, };
327+
GValue value = G_VALUE_INIT;
328328

329329
g_value_init (&value, param_spec->value_type);
330330

@@ -395,7 +395,7 @@ prefs_response (GtkWidget *widget,
395395
for (list = diff; list; list = g_list_next (list))
396396
{
397397
GParamSpec *param_spec = list->data;
398-
GValue value = { 0, };
398+
GValue value = G_VALUE_INIT;
399399

400400
g_value_init (&value, param_spec->value_type);
401401

@@ -704,7 +704,7 @@ prefs_format_string_select_callback (GtkTreeSelection *sel,
704704

705705
if (gtk_tree_selection_get_selected (sel, &model, &iter))
706706
{
707-
GValue val = { 0, };
707+
GValue val = G_VALUE_INIT;
708708

709709
gtk_tree_model_get_value (model, &iter, 1, &val);
710710
gtk_entry_set_text (entry, g_value_get_string (&val));
@@ -721,7 +721,7 @@ prefs_theme_select_callback (GtkTreeSelection *sel,
721721

722722
if (gtk_tree_selection_get_selected (sel, &model, &iter))
723723
{
724-
GValue val = { 0, };
724+
GValue val = G_VALUE_INIT;
725725

726726
gtk_tree_model_get_value (model, &iter, 0, &val);
727727
g_object_set_property (G_OBJECT (gimp->config), "theme", &val);
@@ -745,7 +745,7 @@ prefs_icon_theme_select_callback (GtkTreeSelection *sel,
745745

746746
if (gtk_tree_selection_get_selected (sel, &model, &iter))
747747
{
748-
GValue val = { 0, };
748+
GValue val = G_VALUE_INIT;
749749

750750
gtk_tree_model_get_value (model, &iter, 1, &val);
751751
g_object_set_property (G_OBJECT (gimp->config), "icon-theme", &val);

app/gegl/gimp-gegl-config.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ gimp_gegl_config_sync_node (GimpObject *config,
376376

377377
if (gimp_pspec)
378378
{
379-
GValue value = { 0, };
379+
GValue value = G_VALUE_INIT;
380380

381381
g_value_init (&value, gimp_pspec->value_type);
382382

app/pdb/gimpprocedure.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ GimpValueArray *
511511
gimp_procedure_get_arguments (GimpProcedure *procedure)
512512
{
513513
GimpValueArray *args;
514-
GValue value = { 0, };
514+
GValue value = G_VALUE_INIT;
515515
gint i;
516516

517517
g_return_val_if_fail (GIMP_IS_PROCEDURE (procedure), NULL);
@@ -534,7 +534,7 @@ gimp_procedure_get_return_values (GimpProcedure *procedure,
534534
const GError *error)
535535
{
536536
GimpValueArray *args;
537-
GValue value = { 0, };
537+
GValue value = G_VALUE_INIT;
538538
gint i;
539539

540540
g_return_val_if_fail (success == FALSE || GIMP_IS_PROCEDURE (procedure),
@@ -753,7 +753,7 @@ gimp_procedure_validate_args (GimpProcedure *procedure,
753753
}
754754
else if (! (pspec->flags & GIMP_PARAM_NO_VALIDATE))
755755
{
756-
GValue string_value = { 0, };
756+
GValue string_value = G_VALUE_INIT;
757757

758758
g_value_init (&string_value, G_TYPE_STRING);
759759

app/plug-in/plug-in-params.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ plug_in_params_to_args (GParamSpec **pspecs,
5454

5555
for (i = 0; i < n_params; i++)
5656
{
57-
GValue value = { 0, };
57+
GValue value = G_VALUE_INIT;
5858
GType type;
5959
gint count;
6060

app/tools/gimprectangleoptions.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -1126,12 +1126,12 @@ static void
11261126
gimp_number_pair_entry_history_add (GtkWidget *entry,
11271127
GtkTreeModel *model)
11281128
{
1129-
GValue value = { 0, };
1130-
GtkTreeIter iter;
1131-
gboolean iter_valid;
1132-
gdouble left_number;
1133-
gdouble right_number;
1134-
const gchar *text;
1129+
GValue value = G_VALUE_INIT;
1130+
GtkTreeIter iter;
1131+
gboolean iter_valid;
1132+
gdouble left_number;
1133+
gdouble right_number;
1134+
const gchar *text;
11351135

11361136
text = gtk_entry_get_text (GTK_ENTRY (entry));
11371137
gimp_number_pair_entry_get_values (GIMP_NUMBER_PAIR_ENTRY (entry),

app/tools/gimptexttool.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,7 @@ gimp_text_tool_text_notify (GimpText *text,
11551155

11561156
if ((pspec->flags & G_PARAM_READWRITE) == G_PARAM_READWRITE)
11571157
{
1158-
GValue value = { 0, };
1158+
GValue value = G_VALUE_INIT;
11591159

11601160
g_value_init (&value, pspec->value_type);
11611161

@@ -1313,7 +1313,7 @@ gimp_text_tool_apply (GimpTextTool *text_tool,
13131313

13141314
for (; list; list = g_list_next (list))
13151315
{
1316-
GValue value = { 0, };
1316+
GValue value = G_VALUE_INIT;
13171317

13181318
/* look ahead and compress changes */
13191319
if (list->next && list->next->data == list->data)

app/widgets/gimpcolordisplayeditor.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ gimp_color_display_editor_src_changed (GtkTreeSelection *sel,
521521

522522
if (gtk_tree_selection_get_selected (sel, &model, &iter))
523523
{
524-
GValue val = { 0, };
524+
GValue val = G_VALUE_INIT;
525525

526526
gtk_tree_model_get_value (model, &iter, SRC_COLUMN_NAME, &val);
527527

@@ -556,7 +556,7 @@ gimp_color_display_editor_dest_changed (GtkTreeSelection *sel,
556556

557557
if (gtk_tree_selection_get_selected (sel, &model, &iter))
558558
{
559-
GValue val = { 0, };
559+
GValue val = G_VALUE_INIT;
560560

561561
gtk_tree_model_get_value (model, &iter, DEST_COLUMN_FILTER, &val);
562562

app/widgets/gimpdeviceinfo.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ gimp_device_info_get_property (GObject *object,
410410
case PROP_AXES:
411411
{
412412
GimpValueArray *array;
413-
GValue enum_value = { 0, };
413+
GValue enum_value = G_VALUE_INIT;
414414
gint n_axes;
415415
gint i;
416416

@@ -436,7 +436,7 @@ gimp_device_info_get_property (GObject *object,
436436
case PROP_KEYS:
437437
{
438438
GimpValueArray *array;
439-
GValue string_value = { 0, };
439+
GValue string_value = G_VALUE_INIT;
440440
gint n_keys;
441441
gint i;
442442

app/widgets/gimplanguagestore.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ gimp_language_store_sort (GtkTreeModel *model,
113113
GtkTreeIter *b,
114114
gpointer userdata)
115115
{
116-
GValue avalue = { 0, };
117-
GValue bvalue = { 0, };
116+
GValue avalue = G_VALUE_INIT;
117+
GValue bvalue = G_VALUE_INIT;
118118
gint cmp = 0;
119119

120120
/* keep system language at the top of the list */

app/widgets/gimpsessioninfo-aux.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ gimp_session_info_aux_new_from_props (GObject *object,
8787
if (pspec)
8888
{
8989
GString *str = g_string_new (NULL);
90-
GValue value = { 0, };
90+
GValue value = G_VALUE_INIT;
9191

9292
g_value_init (&value, pspec->value_type);
9393
g_object_get_property (object, pspec->name, &value);
@@ -146,7 +146,7 @@ gimp_session_info_aux_set_props (GObject *object,
146146

147147
if (pspec)
148148
{
149-
GValue value = { 0, };
149+
GValue value = G_VALUE_INIT;
150150

151151
g_value_init (&value, pspec->value_type);
152152

@@ -173,7 +173,7 @@ gimp_session_info_aux_set_props (GObject *object,
173173
}
174174
else
175175
{
176-
GValue str_value = { 0, };
176+
GValue str_value = G_VALUE_INIT;
177177

178178
g_value_init (&str_value, G_TYPE_STRING);
179179
g_value_set_static_string (&str_value, aux->value);

app/xcf/xcf-load.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2386,7 +2386,7 @@ xcf_load_vector (XcfInfo *info,
23862386
gint j;
23872387

23882388
GimpValueArray *control_points;
2389-
GValue value = { 0, };
2389+
GValue value = G_VALUE_INIT;
23902390
GimpAnchor anchor = { { 0, } };
23912391
GType stroke_type;
23922392

libgimpconfig/gimpconfig-deserialize.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,8 @@ gimp_config_deserialize_property (GimpConfig *config,
238238
GimpConfigInterface *config_iface = NULL;
239239
GimpConfigInterface *parent_iface = NULL;
240240
GParamSpec *prop_spec;
241-
GTokenType token = G_TOKEN_RIGHT_PAREN;
242-
GValue value = { 0, };
241+
GTokenType token = G_TOKEN_RIGHT_PAREN;
242+
GValue value = G_VALUE_INIT;
243243
guint old_scope_id;
244244

245245
old_scope_id = g_scanner_set_scope (scanner, 0);
@@ -714,7 +714,7 @@ gimp_config_deserialize_value_array (GValue *value,
714714
{
715715
GimpParamSpecValueArray *array_spec;
716716
GimpValueArray *array;
717-
GValue array_value = { 0, };
717+
GValue array_value = G_VALUE_INIT;
718718
gint n_values;
719719
GTokenType token;
720720
gint i;

libgimpconfig/gimpconfig-iface.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ gimp_config_iface_equal (GimpConfig *a,
201201
for (i = 0; equal && i < n_property_specs; i++)
202202
{
203203
GParamSpec *prop_spec;
204-
GValue a_value = { 0, };
205-
GValue b_value = { 0, };
204+
GValue a_value = G_VALUE_INIT;
205+
GValue b_value = G_VALUE_INIT;
206206

207207
prop_spec = property_specs[i];
208208

0 commit comments

Comments
 (0)