Changeset 552da22 for lib/xmltree.c


Ignore:
Timestamp:
2023-04-01T20:29:42Z (13 months ago)
Author:
GitHub <noreply@…>
Branches:
master
Children:
10425b2
Parents:
a4ac9c4
git-author:
David Cantrell <dcantrell@…> (01-04-23 20:29:42)
git-committer:
GitHub <noreply@…> (01-04-23 20:29:42)
Message:

Use g_memdup2() with glib versions >= 2.68.0 (#168)

  • Use g_memdup2() with glib versions >= 2.68.0

g_memdup() was deprecated in glib 2.68.0. The new function is
g_memdup2(). Still support building with older versions of glib via
macros.

Signed-off-by: David Cantrell <dcantrell@…>

  • Fall back to g_memdup when g_memdup2 is not available, rather than defining custom macro

Signed-off-by: David Cantrell <dcantrell@…>
Co-authored-by: Jelmer Vernooij <jelmer@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/xmltree.c

    ra4ac9c4 r552da22  
    3333#define g_strncasecmp g_ascii_strncasecmp
    3434
     35/* g_memdup() deprecated as of glib 2.68.0 */
     36#ifdef GLIB_VERSION_2_68
     37#define g_memdup2 g_memdup2
     38#else
     39#define g_memdup2 g_memdup
     40#endif
     41
    3542static void xt_start_element(GMarkupParseContext *ctx, const gchar *element_name, const gchar **attr_names,
    3643                             const gchar **attr_values, gpointer data, GError **error)
     
    364371        dup->flags = node->flags;
    365372        if (node->text) {
    366                 dup->text = g_memdup(node->text, node->text_len + 1);
     373                dup->text = g_memdup2(node->text, node->text_len + 1);
    367374                dup->text_len = node->text_len;
    368375        }
Note: See TracChangeset for help on using the changeset viewer.