]> git.samba.org - abartlet/samba.git/.git/commitdiff
util: use likely/unlikely for NT_STATUS_* macros
authorAndrew Tridgell <tridge@samba.org>
Thu, 17 Sep 2009 16:07:44 +0000 (09:07 -0700)
committerAndrew Tridgell <tridge@samba.org>
Fri, 18 Sep 2009 04:52:24 +0000 (21:52 -0700)
libcli/util/ntstatus.h

index 5ef429598e7bfeec724440e0f5cfe4ea810f0c91..1025f472104f2ba027a680e4191a9efaa20c5aed 100644 (file)
@@ -637,8 +637,8 @@ NTSTATUS nt_status_string_to_code(const char *nt_status_str);
 /** Used by ntstatus_dos_equal: */
 extern bool ntstatus_check_dos_mapping;
 
-#define NT_STATUS_IS_OK(x) (NT_STATUS_V(x) == 0)
-#define NT_STATUS_IS_ERR(x) ((NT_STATUS_V(x) & 0xc0000000) == 0xc0000000)
+#define NT_STATUS_IS_OK(x) (likely(NT_STATUS_V(x) == 0))
+#define NT_STATUS_IS_ERR(x) (unlikely((NT_STATUS_V(x) & 0xc0000000) == 0xc0000000))
 /* checking for DOS error mapping here is ugly, but unfortunately the
    alternative is a very intrusive rewrite of the torture code */
 #if _SAMBA_BUILD_ == 4
@@ -648,7 +648,7 @@ extern bool ntstatus_check_dos_mapping;
 #endif
 
 #define NT_STATUS_HAVE_NO_MEMORY(x) do { \
-       if (!(x)) {\
+       if (unlikely(!(x))) {           \
                return NT_STATUS_NO_MEMORY;\
        }\
 } while (0)