diff mbox series

[v2,1/7] strbuf: clarify API boundary

Message ID 20230503185031.1810078-1-calvinwan@google.com (mailing list archive)
State Superseded
Headers show
Series strbuf cleanups | expand

Commit Message

Calvin Wan May 3, 2023, 6:50 p.m. UTC
strbuf, as a generic and widely used structure across the codebase,
should be limited as a libary to only interact with primitives. Add
documentation so future functions can be appropriately be placed. Older
functions that do not follow this boundary should eventually be moved or
refactored.

Signed-off-by: Calvin Wan <calvinwan@google.com>
---
 strbuf.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/strbuf.h b/strbuf.h
index 3dfeadb44c..c856253216 100644
--- a/strbuf.h
+++ b/strbuf.h
@@ -5,7 +5,11 @@  struct string_list;
 
 /**
  * strbuf's are meant to be used with all the usual C string and memory
- * APIs. Given that the length of the buffer is known, it's often better to
+ * APIs. The objects that this API interacts with in this file should be 
+ * limited to other primitives, however, there are older functions in here 
+ * that should eventually be moved out or refactored. 
+ * 
+ * Given that the length of the buffer is known, it's often better to
  * use the mem* functions than a str* one (memchr vs. strchr e.g.).
  * Though, one has to be careful about the fact that str* functions often
  * stop on NULs and that strbufs may have embedded NULs.