README.Coding: Approve DBG statements using dom_sid_str_buf
authorVolker Lendecke <vl@samba.org>
Wed, 21 Nov 2018 14:58:21 +0000 (15:58 +0100)
committerRalph Boehme <slow@samba.org>
Thu, 22 Nov 2018 07:22:18 +0000 (08:22 +0100)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
README.Coding

index 65d72d6fb735cc5274903f023833894183b096c3..ac9bcd43065fea7246ecddafaeac389319087628 100644 (file)
@@ -432,6 +432,22 @@ an iterator style:
                   ... do something with opt ...
        }
 
+Another exception: DBG messages for example printing a SID or a GUID:
+Here we don't expect any surprise from the printing functions, and the
+main reason of this guideline is to make debugging easier. That reason
+rarely exists for this particular use case, and we gain some
+efficiency because the DBG_ macros don't evaluate their arguments if
+the debuglevel is not high enough.
+
+       if (!NT_STATUS_IS_OK(status)) {
+               struct dom_sid_buf sid_buf;
+               struct GUID_txt_buf guid_buf;
+               DBG_WARNING(
+                   "objectSID [%s] for GUID [%s] invalid\n",
+                   dom_sid_str_buf(objectsid, &sid_buf),
+                   GUID_buf_string(&cache->entries[idx], &guid_buf));
+       }
+
 But in general, please try to avoid this pattern.