Permalink
Browse files

Don't use G_LIKELY() in macros commonly used in g_return_if_fail()

g_return_if_fail() puts itself its condition in a G_LIKELY() clause,
and nested G_LIKELY() lead to warnings about shadowed variables, as
well as not being of any use.

Also, hiding G_LIKELY() in a macro may lead to unexpected use of it
which may hint the compiler incorrectly.
  • Loading branch information...
1 parent 7473e4b commit c2dcec7107514c0632d8f657c3325b3963cf22a6 @b4n b4n committed Jan 18, 2014
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/document.h
View
2 src/document.h
@@ -146,7 +146,7 @@ extern GPtrArray *documents_array;
* @note This should not be used to check the result of the main API functions,
* these only need a NULL-pointer check - @c document_get_current() != @c NULL. */
#define DOC_VALID(doc_ptr) \
- (G_LIKELY((doc_ptr) != NULL && (doc_ptr)->is_valid))
+ ((doc_ptr) != NULL && (doc_ptr)->is_valid)
/**
* Returns the filename of the document passed or @c GEANY_STRING_UNTITLED

1 comment on commit c2dcec7

@codebrainz
Geany member

Thanks, this warning bit me each plugin I wrote :)

Please sign in to comment.