[RFC PATCH 4/9] lib: HACK: avoid warnings from talloc_steal()

Jani Nikula jani at nikula.org
Sat Jan 7 15:26:18 PST 2012


talloc.h #defines talloc_steal() with macros to make it type safe, but
introduces a warning when compiled using -std=c99 -pedantic:

lib/tags.c: In function ‘_notmuch_tags_create’:
lib/tags.c:43:5: warning: ISO C forbids braced-groups within expressions [-pedantic]

Call _talloc_steal_loc() directly without the macro wrapper. We aren't even
interested in the return value the macro is so hard trying to provide type
safety for.

Signed-off-by: Jani Nikula <jani at nikula.org>
---
 lib/tags.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/lib/tags.c b/lib/tags.c
index c58924f..56c43e2 100644
--- a/lib/tags.c
+++ b/lib/tags.c
@@ -40,7 +40,10 @@ _notmuch_tags_create (const void *ctx, notmuch_string_list_t *list)
 	return NULL;
 
     tags->iterator = list->head;
-    talloc_steal (tags, list);
+
+    /* _talloc_steal_loc() is talloc_steal() without macro wrapping to avoid
+     * -std=c99 -pedantic warning. __location__ is defined in talloc.h. */
+    _talloc_steal_loc (tags, list, __location__);
 
     return tags;
 }
-- 
1.7.5.4



More information about the notmuch mailing list