summaryrefslogtreecommitdiff
path: root/README.Coding
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2018-11-21 15:58:21 +0100
committerRalph Boehme <slow@samba.org>2018-11-22 08:22:18 +0100
commit1295e2b754da6aeb1b5d2c6b07c8cc9afbba21f9 (patch)
treeb36de4d97c813b9d708677b167fed2c569ac4504 /README.Coding
parenta3dd28c635206272673ea1f62b35121c7e808db4 (diff)
downloadsamba-1295e2b754da6aeb1b5d2c6b07c8cc9afbba21f9.tar.gz
README.Coding: Approve DBG statements using dom_sid_str_buf
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'README.Coding')
-rw-r--r--README.Coding16
1 files changed, 16 insertions, 0 deletions
diff --git a/README.Coding b/README.Coding
index 65d72d6fb73..ac9bcd43065 100644
--- a/README.Coding
+++ b/README.Coding
@@ -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.