diff mbox series

[24/30] tree-walk.h API: document and format tree_entry_extract()

Message ID 20210308150650.18626-25-avarab@gmail.com (mailing list archive)
State New, archived
Headers show
Series Move the read_tree() function to its only user | expand

Commit Message

Ævar Arnfjörð Bjarmason March 8, 2021, 3:06 p.m. UTC
Document and format the argument list of the tree_entry_extract()
function in preparation for adding a sister function.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 tree-walk.h | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

Comments

Elijah Newren March 9, 2021, 6:28 p.m. UTC | #1
On Mon, Mar 8, 2021 at 7:07 AM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
>
> Document and format the argument list of the tree_entry_extract()
> function in preparation for adding a sister function.
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
>  tree-walk.h | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/tree-walk.h b/tree-walk.h
> index 1bfa839b275..61fdcb166d2 100644
> --- a/tree-walk.h
> +++ b/tree-walk.h
> @@ -40,11 +40,17 @@ struct tree_desc {
>
>  /**
>   * Decode the entry currently being visited (the one pointed to by
> - * `tree_desc's` `entry` member) and return the sha1 of the entry. The
> - * `pathp` and `modep` arguments are set to the entry's pathname and mode
> - * respectively.
> + * `tree_desc's` `entry` member) and return the OID of the entry.
> +
> + * There are variants of this function depending on what fields in the
> + * "struct name_entry" you'd like. You always need to pointer to an

s/need to pointer/need a pointer/

> + * appropriate variable to fill in (NULL won't do!):
> + *
> + * tree_entry_extract_mode(): const char *path, unsigned int mode

Indenting this over slightly might make it easier to read

>   */
> -static inline const struct object_id *tree_entry_extract(struct tree_desc *desc, const char **pathp, unsigned short *modep)
> +static inline const struct object_id *tree_entry_extract(struct tree_desc *desc,
> +                                                        const char **pathp,
> +                                                        unsigned short *modep)
>  {
>         *pathp = desc->entry.path;
>         *modep = desc->entry.mode;
> --
> 2.31.0.rc0.126.g04f22c5b82
>
diff mbox series

Patch

diff --git a/tree-walk.h b/tree-walk.h
index 1bfa839b275..61fdcb166d2 100644
--- a/tree-walk.h
+++ b/tree-walk.h
@@ -40,11 +40,17 @@  struct tree_desc {
 
 /**
  * Decode the entry currently being visited (the one pointed to by
- * `tree_desc's` `entry` member) and return the sha1 of the entry. The
- * `pathp` and `modep` arguments are set to the entry's pathname and mode
- * respectively.
+ * `tree_desc's` `entry` member) and return the OID of the entry.
+
+ * There are variants of this function depending on what fields in the
+ * "struct name_entry" you'd like. You always need to pointer to an
+ * appropriate variable to fill in (NULL won't do!):
+ *
+ * tree_entry_extract_mode(): const char *path, unsigned int mode
  */
-static inline const struct object_id *tree_entry_extract(struct tree_desc *desc, const char **pathp, unsigned short *modep)
+static inline const struct object_id *tree_entry_extract(struct tree_desc *desc,
+							 const char **pathp,
+							 unsigned short *modep)
 {
 	*pathp = desc->entry.path;
 	*modep = desc->entry.mode;