Skip to content

Commit f20e56e

Browse files
peffgitster
authored andcommitted
strbuf.h: drop boilerplate descriptions of strbuf_split_*
The description of strbuf_split_buf says most of what needs to be said for all of the split variants that take strings, raw memory, etc. We have a boilerplate comment above each that points to the first. This boilerplate ends up making it harder to read, because it spaces out the functions, which could otherwise be read as a group. Let's drop the boilerplate completely, and mention the variants in the top comment. This is perhaps slightly worse for a hypothetical system which pulls the documentation for each function out of the comment immediately preceding it. But such a system does not yet exist, and anyway, the end result of extracting the boilerplate comments would not lead to a very easy-to-read result. We would do better in the long run to teach the extraction system about groups of related functions. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 14e2177 commit f20e56e

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

strbuf.h

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -441,36 +441,29 @@ static inline int strbuf_strip_suffix(struct strbuf *sb, const char *suffix)
441441
* substring containing everything following the (max-1)th terminator
442442
* character).
443443
*
444+
* The most generic form is `strbuf_split_buf`, which takes an arbitrary
445+
* pointer/len buffer. The `_str` variant takes a NUL-terminated string,
446+
* the `_max` variant takes a strbuf, and just `strbuf_split` is a convenience
447+
* wrapper to drop the `max` parameter.
448+
*
444449
* For lighter-weight alternatives, see string_list_split() and
445450
* string_list_split_in_place().
446451
*/
447452
extern struct strbuf **strbuf_split_buf(const char *, size_t,
448453
int terminator, int max);
449454

450-
/**
451-
* Split a NUL-terminated string at the specified terminator
452-
* character. See strbuf_split_buf() for more information.
453-
*/
454455
static inline struct strbuf **strbuf_split_str(const char *str,
455456
int terminator, int max)
456457
{
457458
return strbuf_split_buf(str, strlen(str), terminator, max);
458459
}
459460

460-
/**
461-
* Split a strbuf at the specified terminator character. See
462-
* strbuf_split_buf() for more information.
463-
*/
464461
static inline struct strbuf **strbuf_split_max(const struct strbuf *sb,
465462
int terminator, int max)
466463
{
467464
return strbuf_split_buf(sb->buf, sb->len, terminator, max);
468465
}
469466

470-
/**
471-
* Split a strbuf at the specified terminator character. See
472-
* strbuf_split_buf() for more information.
473-
*/
474467
static inline struct strbuf **strbuf_split(const struct strbuf *sb,
475468
int terminator)
476469
{

0 commit comments

Comments
 (0)