diff mbox

[4.5/7] glib: add compatibility interface for g_hash_table_add()

Message ID 1445957481-21059-1-git-send-email-armbru@redhat.com
State New
Headers show

Commit Message

Markus Armbruster Oct. 27, 2015, 2:51 p.m. UTC
The next commit will use it.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 include/glib-compat.h | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Eric Blake Oct. 27, 2015, 3:10 p.m. UTC | #1
On 10/27/2015 08:51 AM, Markus Armbruster wrote:
> The next commit will use it.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  include/glib-compat.h | 7 +++++++
>  1 file changed, 7 insertions(+)

One nit:

> 
> diff --git a/include/glib-compat.h b/include/glib-compat.h
> index fb25f43..5185630 100644
> --- a/include/glib-compat.h
> +++ b/include/glib-compat.h
> @@ -165,6 +165,13 @@ static inline GThread *g_thread_new(const char *name,
>  #define CompatGCond GCond
>  #endif /* glib 2.31 */
>  
> +#if !GLIB_CHECK_VERSION(2, 32, 0)
> +static inline gboolean g_hash_table_add (GHashTable *hash_table, gpointer key)

Drop the space before (

Reviewed-by: Eric Blake <eblake@redhat.com>
Markus Armbruster Oct. 27, 2015, 4:06 p.m. UTC | #2
Eric Blake <eblake@redhat.com> writes:

> On 10/27/2015 08:51 AM, Markus Armbruster wrote:
>> The next commit will use it.
>> 
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>>  include/glib-compat.h | 7 +++++++
>>  1 file changed, 7 insertions(+)
>
> One nit:
>
>> 
>> diff --git a/include/glib-compat.h b/include/glib-compat.h
>> index fb25f43..5185630 100644
>> --- a/include/glib-compat.h
>> +++ b/include/glib-compat.h
>> @@ -165,6 +165,13 @@ static inline GThread *g_thread_new(const char *name,
>>  #define CompatGCond GCond
>>  #endif /* glib 2.31 */
>>  
>> +#if !GLIB_CHECK_VERSION(2, 32, 0)
>> +static inline gboolean g_hash_table_add (GHashTable *hash_table,
>> gpointer key)
>
> Drop the space before (
>
> Reviewed-by: Eric Blake <eblake@redhat.com>

Done.  Thanks!
diff mbox

Patch

diff --git a/include/glib-compat.h b/include/glib-compat.h
index fb25f43..5185630 100644
--- a/include/glib-compat.h
+++ b/include/glib-compat.h
@@ -165,6 +165,13 @@  static inline GThread *g_thread_new(const char *name,
 #define CompatGCond GCond
 #endif /* glib 2.31 */
 
+#if !GLIB_CHECK_VERSION(2, 32, 0)
+static inline gboolean g_hash_table_add (GHashTable *hash_table, gpointer key)
+{
+    return g_hash_table_replace(hash_table, key, key)
+}
+#endif
+
 #ifndef g_assert_true
 #define g_assert_true(expr)                                                    \
     do {                                                                       \