[geany/geany] c2dcec: Don't use G_LIKELY() in macros commonly used in g_return_if_fail()

Colomban Wendling git-noreply at xxxxx
Wed Jan 22 16:38:29 UTC 2014


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Wed, 22 Jan 2014 16:38:29 UTC
Commit:      c2dcec7107514c0632d8f657c3325b3963cf22a6
             https://github.com/geany/geany/commit/c2dcec7107514c0632d8f657c3325b3963cf22a6

Log Message:
-----------
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.


Modified Paths:
--------------
    src/document.h

Modified: src/document.h
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -146,7 +146,7 @@ struct GeanyDocument
  * @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



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list