diff options
| author | Linus Arver <linusa@google.com> | 2024-10-13 11:58:42 +0000 |
|---|---|---|
| committer | Taylor Blau <me@ttaylorr.com> | 2024-10-14 12:33:02 -0400 |
| commit | 3f0346d4dcdb6cf03f758895719dfe1e6a8cc696 (patch) | |
| tree | c0f646e899bf5cffe947d02982cc924bd0ed7b58 /trailer.h | |
| parent | ef8ce8f3d4344fd3af049c17eeba5cd20d98b69f (diff) | |
| download | git-3f0346d4dcdb6cf03f758895719dfe1e6a8cc696.tar.gz | |
trailer: spread usage of "trailer_block" language
Deprecate the "trailer_info" struct name and replace it with
"trailer_block". This is more readable, for two reasons:
1. "trailer_info" on the surface sounds like it's about a single
trailer when in reality it is a collection of one or more trailers,
and
2. the "*_block" suffix is more informative than "*_info", because it
describes a block (or region) of contiguous text which has trailers
in it, which has been parsed into the trailer_block structure.
Rename the
size_t trailer_block_start, trailer_block_end;
members of trailer_info to just "start" and "end". Rename the "info"
pointer to "trailer_block" because it is more descriptive. Update
comments accordingly.
Signed-off-by: Linus Arver <linus@ucla.edu>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Diffstat (limited to 'trailer.h')
| -rw-r--r-- | trailer.h | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -4,7 +4,7 @@ #include "list.h" #include "strbuf.h" -struct trailer_info; +struct trailer_block; struct strvec; enum trailer_where { @@ -72,12 +72,12 @@ void process_trailers_lists(struct list_head *head, struct list_head *arg_head); /* - * Given some input string "str", return a pointer to an opaque trailer_info + * Given some input string "str", return a pointer to an opaque trailer_block * structure. Also populate the trailer_objects list with parsed trailer * objects. Internally this calls trailer_info_get() to get the opaque pointer, * but does some extra work to populate the trailer_objects linked list. * - * The opaque trailer_info pointer can be used to check the position of the + * The opaque trailer_block pointer can be used to check the position of the * trailer block as offsets relative to the beginning of "str" in * trailer_block_start() and trailer_block_end(). * blank_line_before_trailer_block() returns 1 if there is a blank line just @@ -89,21 +89,21 @@ void process_trailers_lists(struct list_head *head, * For iterating through the parsed trailer block (if you don't care about the * position of the trailer block itself in the context of the larger string text * from which it was parsed), please see trailer_iterator_init() which uses the - * trailer_info struct internally. + * trailer_block struct internally. * * Lastly, callers should call trailer_info_release() when they are done using * the opaque pointer. * - * NOTE: Callers should treat both trailer_info and trailer_objects as - * read-only items, because there is some overlap between the two (trailer_info + * NOTE: Callers should treat both trailer_block and trailer_objects as + * read-only items, because there is some overlap between the two (trailer_block * has "char **trailers" string array, and trailer_objects will have the same * data but as a linked list of trailer_item objects). This API does not perform * any synchronization between the two. In the future we should be able to * reduce the duplication and use just the linked list. */ -struct trailer_info *parse_trailers(const struct process_trailer_options *, - const char *str, - struct list_head *trailer_objects); +struct trailer_block *parse_trailers(const struct process_trailer_options *, + const char *str, + struct list_head *trailer_objects); /* * Return the offset of the start of the trailer block. That is, 0 is the start @@ -111,24 +111,24 @@ struct trailer_info *parse_trailers(const struct process_trailer_options *, * indicates how many bytes we have to skip over before we get to the beginning * of the trailer block. */ -size_t trailer_block_start(struct trailer_info *); +size_t trailer_block_start(struct trailer_block *); /* * Return the end of the trailer block, again relative to the start of the * input. */ -size_t trailer_block_end(struct trailer_info *); +size_t trailer_block_end(struct trailer_block *); /* * Return 1 if the trailer block had an extra newline (blank line) just before * it. */ -int blank_line_before_trailer_block(struct trailer_info *); +int blank_line_before_trailer_block(struct trailer_block *); /* - * Free trailer_info struct. + * Free trailer_block struct. */ -void trailer_info_release(struct trailer_info *info); +void trailer_block_release(struct trailer_block *); void trailer_config_init(void); void format_trailers(const struct process_trailer_options *, @@ -167,7 +167,7 @@ struct trailer_iterator { /* private */ struct { - struct trailer_info *info; + struct trailer_block *trailer_block; size_t cur; } internal; }; |
