[gtk/ebassi/memdup2: 8/11] gtk: Move from g_memdup() to g_memdup2()
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/ebassi/memdup2: 8/11] gtk: Move from g_memdup() to g_memdup2()
- Date: Thu, 4 Feb 2021 19:48:13 +0000 (UTC)
commit 3e9979ca4f4d83a02a602a2ab7e1ae488bfe9c01
Author: Emmanuele Bassi <ebassi gnome org>
Date: Thu Feb 4 19:18:28 2021 +0000
gtk: Move from g_memdup() to g_memdup2()
The g_memdup() function is replaced by a safer version in newer versions
of GLib.
gtk/gtkbuilderparser.c | 2 +-
gtk/gtkcsskeyframes.c | 4 ++--
gtk/gtkcssnodedeclaration.c | 2 +-
gtk/gtkexpression.c | 2 +-
gtk/gtkrange.c | 2 +-
gtk/gtkroundedbox.c | 2 +-
gtk/gtktreednd.c | 2 +-
modules/printbackends/gtkprintbackendcups.c | 4 ++--
8 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkbuilderparser.c b/gtk/gtkbuilderparser.c
index b368d82cc5..bc5501977e 100644
--- a/gtk/gtkbuilderparser.c
+++ b/gtk/gtkbuilderparser.c
@@ -1610,7 +1610,7 @@ create_subparser (GObject *object,
subparser->child = child;
subparser->tagname = g_strdup (element_name);
subparser->start = element_name;
- subparser->parser = g_memdup (parser, sizeof (GtkBuildableParser));
+ subparser->parser = g_memdup2 (parser, sizeof (GtkBuildableParser));
subparser->data = user_data;
return subparser;
diff --git a/gtk/gtkcsskeyframes.c b/gtk/gtkcsskeyframes.c
index e4a577379d..97f47fbaaa 100644
--- a/gtk/gtkcsskeyframes.c
+++ b/gtk/gtkcsskeyframes.c
@@ -441,9 +441,9 @@ _gtk_css_keyframes_compute (GtkCssKeyframes *keyframes,
resolved = gtk_css_keyframes_alloc ();
resolved->n_keyframes = keyframes->n_keyframes;
- resolved->keyframe_progress = g_memdup (keyframes->keyframe_progress, keyframes->n_keyframes * sizeof
(double));
+ resolved->keyframe_progress = g_memdup2 (keyframes->keyframe_progress, keyframes->n_keyframes * sizeof
(double));
resolved->n_properties = keyframes->n_properties;
- resolved->property_ids = g_memdup (keyframes->property_ids, keyframes->n_properties * sizeof (guint));
+ resolved->property_ids = g_memdup2 (keyframes->property_ids, keyframes->n_properties * sizeof (guint));
resolved->values = g_new0 (GtkCssValue *, resolved->n_keyframes * resolved->n_properties);
for (p = 0; p < resolved->n_properties; p++)
diff --git a/gtk/gtkcssnodedeclaration.c b/gtk/gtkcssnodedeclaration.c
index ae78cf74ce..fab98c9d34 100644
--- a/gtk/gtkcssnodedeclaration.c
+++ b/gtk/gtkcssnodedeclaration.c
@@ -51,7 +51,7 @@ gtk_css_node_declaration_make_writable (GtkCssNodeDeclaration **decl)
(*decl)->refcount--;
- *decl = g_memdup (*decl, sizeof_this_node (*decl));
+ *decl = g_memdup2 (*decl, sizeof_this_node (*decl));
(*decl)->refcount = 1;
}
diff --git a/gtk/gtkexpression.c b/gtk/gtkexpression.c
index b08c8bf80f..987a7188c8 100644
--- a/gtk/gtkexpression.c
+++ b/gtk/gtkexpression.c
@@ -685,7 +685,7 @@ gtk_expression_type_register_static (const char *type_name,
info.base_finalize = NULL;
info.class_init = gtk_expression_generic_class_init;
info.class_finalize = NULL;
- info.class_data = g_memdup (type_info, sizeof (GtkExpressionTypeInfo));
+ info.class_data = g_memdup2 (type_info, sizeof (GtkExpressionTypeInfo));
info.instance_size = type_info->instance_size;
info.n_preallocs = 0;
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index bf119199b0..d0e4d70833 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -2831,7 +2831,7 @@ _gtk_range_get_stop_positions (GtkRange *range,
gtk_range_calc_marks (range);
if (values)
- *values = g_memdup (priv->mark_pos, priv->n_marks * sizeof (int));
+ *values = g_memdup2 (priv->mark_pos, priv->n_marks * sizeof (int));
return priv->n_marks;
}
diff --git a/gtk/gtkroundedbox.c b/gtk/gtkroundedbox.c
index 172f58c4d5..be42668817 100644
--- a/gtk/gtkroundedbox.c
+++ b/gtk/gtkroundedbox.c
@@ -106,7 +106,7 @@ append_arc (cairo_t *cr, double angle1, double angle2, gboolean negative)
cairo_arc (tmp, 0.0, 0.0, 1.0, angle1, angle2);
arc = fixup_path (cairo_copy_path (tmp));
- g_hash_table_insert (arc_path_cache, g_memdup (&key, sizeof (key)), arc);
+ g_hash_table_insert (arc_path_cache, g_memdup2 (&key, sizeof (key)), arc);
cairo_destroy (tmp);
cairo_surface_destroy (surface);
diff --git a/gtk/gtktreednd.c b/gtk/gtktreednd.c
index fe038ea18c..0ebb9e4f9e 100644
--- a/gtk/gtktreednd.c
+++ b/gtk/gtktreednd.c
@@ -245,7 +245,7 @@ struct _GtkTreeRowData
static GtkTreeRowData *
gtk_tree_row_data_copy (GtkTreeRowData *src)
{
- return g_memdup (src, sizeof (GtkTreeRowData) + strlen (src->path) + 1 -
+ return g_memdup2 (src, sizeof (GtkTreeRowData) + strlen (src->path) + 1 -
(sizeof (GtkTreeRowData) - G_STRUCT_OFFSET (GtkTreeRowData, path)));
}
diff --git a/modules/printbackends/gtkprintbackendcups.c b/modules/printbackends/gtkprintbackendcups.c
index d499e11f98..1e26848b61 100644
--- a/modules/printbackends/gtkprintbackendcups.c
+++ b/modules/printbackends/gtkprintbackendcups.c
@@ -6363,8 +6363,8 @@ localtime_to_utctime (const char *local_time)
time_t rawtime;
time (&rawtime);
- actual_utc_time = g_memdup (gmtime (&rawtime), sizeof (struct tm));
- actual_local_time = g_memdup (localtime (&rawtime), sizeof (struct tm));
+ actual_utc_time = g_memdup2 (gmtime (&rawtime), sizeof (struct tm));
+ actual_local_time = g_memdup2 (localtime (&rawtime), sizeof (struct tm));
diff_time.tm_hour = actual_utc_time->tm_hour - actual_local_time->tm_hour;
diff_time.tm_min = actual_utc_time->tm_min - actual_local_time->tm_min;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]