diff --git a/configure.ac b/configure.ac index 46e7c775..651805cd 100644 --- a/configure.ac +++ b/configure.ac @@ -159,8 +159,8 @@ AS_IF([test "x$ncurses_cv_wget_wch" != xyes], [AC_MSG_ERROR([ncurses does not support wide characters])]) ### Check for other profanity dependencies -PKG_CHECK_MODULES([glib], [glib-2.0 >= 2.26], [], - [AC_MSG_ERROR([glib 2.26 or higher is required for profanity])]) +PKG_CHECK_MODULES([glib], [glib-2.0 >= 2.40], [], + [AC_MSG_ERROR([glib 2.40 or higher is required for profanity])]) PKG_CHECK_MODULES([curl], [libcurl], [], [AC_CHECK_LIB([curl], [main], [], [AC_MSG_ERROR([libcurl is required for profanity])])]) diff --git a/src/common.c b/src/common.c index 898f62fa..d9c7d73f 100644 --- a/src/common.c +++ b/src/common.c @@ -67,54 +67,6 @@ static unsigned long unique_id = 0; static size_t _data_callback(void *ptr, size_t size, size_t nmemb, void *data); -// taken from glib 2.30.3 -gchar* -p_utf8_substring(const gchar *str, glong start_pos, glong end_pos) -{ - gchar *start, *end, *out; - - start = g_utf8_offset_to_pointer (str, start_pos); - end = g_utf8_offset_to_pointer (start, end_pos - start_pos); - - out = g_malloc (end - start + 1); - memcpy (out, start, end - start); - out[end - start] = 0; - - return out; -} - -void -p_slist_free_full(GSList *items, GDestroyNotify free_func) -{ - g_slist_foreach (items, (GFunc) free_func, NULL); - g_slist_free (items); -} - -void -p_list_free_full(GList *items, GDestroyNotify free_func) -{ - g_list_foreach (items, (GFunc) free_func, NULL); - g_list_free (items); -} - -gboolean -p_hash_table_add(GHashTable *hash_table, gpointer key) -{ - // doesn't handle when key exists, but value == NULL - gpointer found = g_hash_table_lookup(hash_table, key); - g_hash_table_replace(hash_table, key, key); - - return (found == NULL); -} - -gboolean -p_hash_table_contains(GHashTable *hash_table, gconstpointer key) -{ - // doesn't handle when key exists, but value == NULL - gpointer found = g_hash_table_lookup(hash_table, key); - return (found != NULL); -} - gboolean create_dir(char *name) { diff --git a/src/common.h b/src/common.h index 8c42ae52..421c56cd 100644 --- a/src/common.h +++ b/src/common.h @@ -40,20 +40,6 @@ #include -#if !GLIB_CHECK_VERSION(2,28,0) -#define g_slist_free_full(items, free_func) p_slist_free_full(items, free_func) -#define g_list_free_full(items, free_func) p_list_free_full(items, free_func) -#endif - -#if !GLIB_CHECK_VERSION(2,30,0) -#define g_utf8_substring(str, start_pos, end_pos) p_utf8_substring(str, start_pos, end_pos) -#endif - -#if !GLIB_CHECK_VERSION(2,32,0) -#define g_hash_table_add(hash_table, key) p_hash_table_add(hash_table, key) -#define g_hash_table_contains(hash_table, key) p_hash_table_contains(hash_table, key) -#endif - #ifndef NOTIFY_CHECK_VERSION #define notify_notification_new(summary, body, icon) notify_notification_new(summary, body, icon, NULL) #endif @@ -94,12 +80,6 @@ typedef enum { RESOURCE_XA } resource_presence_t; -gchar* p_utf8_substring(const gchar *str, glong start_pos, glong end_pos); -void p_slist_free_full(GSList *items, GDestroyNotify free_func); -void p_list_free_full(GList *items, GDestroyNotify free_func); -gboolean p_hash_table_add(GHashTable *hash_table, gpointer key); -gboolean p_hash_table_contains(GHashTable *hash_table, gconstpointer key); - gboolean create_dir(char *name); gboolean mkdir_recursive(const char *dir); gboolean copy_file(const char *const src, const char *const target);