g_slist_free_full in sipe-media.c

Developers
2011-05-27
2013-03-28
  • Jochen De Smet
    Jochen De Smet
    2011-05-27

    A patch somewhere in march added a few calls to g_slist_free_full in sipe-media.c ; according to the glib docs here this function is only available in glib 2.28 and up.

    Configure is still set to check for just glib 2.12 or higher though.

    In my local copy I've added the following to provide g_slist_free_full for glib < 2.28, but maybe it's easier to just replace the two calls with a loop or something?

    --- ../siplcs/src/core/sipe-utils.h     2011-05-25 22:29:39.253221634 -0400
    +++ src/core/sipe-utils.h       2011-05-26 10:32:34.390487634 -0400
    @@ -464,3 +464,9 @@
      * @return @c TRUE if the string represents AV conference URI
      */
     gboolean sipe_utils_is_avconf_uri(const gchar *uri);
    +
    +#if GLIB_CHECK_VERSION(2,28,0)
    +#else
    +void g_slist_free_full (GSList *list, GDestroyNotify free_func);
    +#endif
    +
    --- ../siplcs/src/core/sipe-utils.c     2011-05-25 22:29:39.233221634 -0400
    +++ src/core/sipe-utils.c       2011-05-26 10:32:26.670487634 -0400
    @@ -612,6 +615,27 @@
            return g_strstr_len(uri, -1, "app:conf:audio-video:") != NULL;
     }
    +#if GLIB_CHECK_VERSION(2,28,0)
    +#else
    +/**
    + * g_slist_free_full:
    + * @list: a pointer to a #GSList
    + * @free_func: the function to be called to free each element's data
    + *
    + * Convenience method, which frees all the memory used by a #GSList, and
    + * calls the specified destroy function on every element's data.
    + *
    + * Since: 2.28
    +**/
    +void
    +g_slist_free_full (GSList         *list,
    +                  GDestroyNotify  free_func)
    +{
    +  g_slist_foreach (list, (GFunc) free_func, NULL);
    +  g_slist_free (list);
    +}
    +#endif
    +
     /*
       Local Variables:
       mode: c
    
     
  • Stefan Becker
    Stefan Becker
    2011-05-27

    g_slist_free_full() is only used in sipe-media.c. As sipe-media.c will never be compiled on obsolete platforms, I don't think this patch is necessary.