X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=common-src%2Fglib-util.h;h=89909f5b16afed7a3608b985425782761df7336d;hb=HEAD;hp=3151d2baac119dc711a865202d9f04b6e1d43831;hpb=6ba576375c19b829b2a13dbe6562eedd2716b9ea;p=debian%2Famanda diff --git a/common-src/glib-util.h b/common-src/glib-util.h index 3151d2b..89909f5 100644 --- a/common-src/glib-util.h +++ b/common-src/glib-util.h @@ -1,20 +1,21 @@ /* - * Copyright (c) 2005 Zmanda, Inc. All Rights Reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License version 2.1 as - * published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but + * Copyright (c) 2007-2012 Zmanda, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120 + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Contact information: Zmanda Inc., 465 S. Mathilda Ave., Suite 300 * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com */ /* @@ -29,6 +30,13 @@ #include #include +/* Call the requisite glib init functions, including calling + * g_init_types and setting up threading support. This function can + * be called multiple times with no harm, although it is not + * re-entrant. + */ +void glib_init(void); + /* like g_[s]list_foreach, but with a function taking only * one argument. */ @@ -55,11 +63,16 @@ GValue* g_value_unset_init(GValue* val, GType type); * Returns its second (reset) argument.*/ GValue* g_value_unset_copy(const GValue* from, GValue * to); +/* This function is available in glib-2.28.0 and higher; for lower versions + * we build our own version with a different name */ +#if (GLIB_MAJOR_VERSION < 2 || (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 28)) +void slist_free_full(GSList * list, GDestroyNotify free_fn); +#else +#define slist_free_full(list, free_fn) g_slist_free_full((list), (free_fn)) +#endif + /* These functions all take a GLib container, and call free() on all the * pointers in the container before free()ing the container itself. */ -void g_list_free_full(GList * list); -void g_slist_free_full(GSList * list); -void g_queue_free_full(GQueue * queue); void g_ptr_array_free_full(GPtrArray * array); /* g_value_compare() does what you expect. It returns TRUE if and @@ -107,5 +120,14 @@ char * g_english_strjoinv_and_free(char ** strv, const char * conjunction); guint g_strv_length(gchar ** strv); #endif +#if !GLIB_CHECK_VERSION(2,4,0) +void g_ptr_array_foreach (GPtrArray *array, + GFunc func, + gpointer user_data); #endif +/* functions for g_hash_table_new to hash and compare case-insensitive strings */ +guint g_str_amanda_hash(gconstpointer v); +gboolean g_str_amanda_equal(gconstpointer v1, gconstpointer v2); + +#endif