git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 5/7] strbuf.h: reorganize api function grouping headers

From
Jeff King <peff@peff.net>
Date
Jan 16, 2015, 09:05 UTC
Message-ID
<20150116090528.GE31113@peff.net>
In-Reply-To
<20150116090225.GA30797@peff.net>
The original API doc had something like:
    Functions
    ---------
    * Life cycle
      ... some life-cycle functions ...
    * Related to the contents of the buffer
      ... functions related to contents ....
    etc

This grouping can be hard to read in the comment sources, given the "*" in the comment lines, and the amount of text between each section.

Instead, let's make a flat list of groupings, and underline each as a section header. That makes them stand out, and eliminates the weird half-phrase of "Related to...". Like:

    Functions related to the contents of the buffer
    -----------------------------------------------
Signed-off-by: Jeff King <peff@peff.net>
---
 strbuf.h | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/strbuf.h b/strbuf.h
index caa4dad..6fa7156 100644
--- a/strbuf.h
+++ b/strbuf.h
@@ -71,12 +71,8 @@ extern char strbuf_slopbuf[];
 #define STRBUF_INIT  { 0, 0, strbuf_slopbuf }
 
 /**
- * Functions
- * ---------
- */
-
-/**
- * * Life Cycle
+ * Life Cycle Functions
+ * --------------------
  */
 
 /**
@@ -120,7 +116,8 @@ static inline void strbuf_swap(struct strbuf *a, struct strbuf *b)
 
 
 /**
- * * Related to the size of the buffer
+ * Functions related to the size of the buffer
+ * -------------------------------------------
  */
 
 /**
@@ -162,7 +159,8 @@ static inline void strbuf_setlen(struct strbuf *sb, size_t len)
 
 
 /**
- * * Related to the contents of the buffer
+ * Functions related to the contents of the buffer
+ * -----------------------------------------------
  */
 
 /**
@@ -201,7 +199,8 @@ extern int strbuf_cmp(const struct strbuf *, const struct strbuf *);
 
 
 /**
- * * Adding data to the buffer
+ * Adding data to the buffer
+ * -------------------------
  *
  * NOTE: All of the functions in this section will grow the buffer as
  * necessary.  If they fail for some reason other than memory shortage and the
-- 
2.2.1.425.g441bb3c
Previous: Jeff KingNext: Jeff King
Message 6 of 12 in “migrate api-strbuf.txt into strbuf.h”
  1. 0/7 migrate api-strbuf.txt into strbuf.hJeff King, Jan 16, 2015
  2. 1/7 strbuf.h: integrate api-strbuf.txt documentationJeff King, Jan 16, 2015
  3. 2/7 strbuf.h: unify documentation comments beginningsJeff King, Jan 16, 2015
  4. 3/7 strbuf.h: drop asciidoc list formatting from API docsJeff King, Jan 16, 2015
  5. 4/7 strbuf.h: format asciidoc code blocks as 4-space indentJeff King, Jan 16, 2015
  6. 5/7 strbuf.h: reorganize api function grouping headersJeff King, Jan 16, 2015
  7. 6/7 strbuf.h: drop boilerplate descriptions of strbuf_split_*Jeff King, Jan 16, 2015
  8. 7/7 strbuf.h: group documentation for trim functionsJeff King, Jan 16, 2015
  9. Junio C HamanoFeb 12, 2015
  10. Jeff KingFeb 12, 2015
  11. Junio C HamanoFeb 16, 2015
  12. Jonathan NiederFeb 17, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.