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

Re: [PATCH v4 1/5] dir_iterator: add helpers to dir_iterator_advance

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Mar 29, 2017, 04:32 UTC
Message-ID
<cdcbf8ce-6641-8a96-6805-b9ff6fa0f3e1@alum.mit.edu>
In-Reply-To
<1490747533-89143-2-git-send-email-bnmvco@gmail.com>
On 03/29/2017 02:32 AM, Daniel Ferreira wrote:
> Create inline helpers to dir_iterator_advance(). Make
> dir_iterator_advance()'s code more legible and allow some behavior to
> be reusable.
Thanks for breaking up the patches. That makes them a lot easier to review.
Show 26 quoted lines
> Signed-off-by: Daniel Ferreira <bnmvco@gmail.com>
> ---
>  dir-iterator.c | 65 +++++++++++++++++++++++++++++++++++++---------------------
>  1 file changed, 42 insertions(+), 23 deletions(-)
> 
> diff --git a/dir-iterator.c b/dir-iterator.c
> index 34182a9..853c040 100644
> --- a/dir-iterator.c
> +++ b/dir-iterator.c
> @@ -50,6 +50,43 @@ struct dir_iterator_int {
>  	struct dir_iterator_level *levels;
>  };
> 
> +static inline void push_dir_level(struct dir_iterator_int *iter, struct dir_iterator_level *level)
> +{
> +	level->dir_state = DIR_STATE_RECURSE;
> +	ALLOC_GROW(iter->levels, iter->levels_nr + 1,
> +		   iter->levels_alloc);
> +	level = &iter->levels[iter->levels_nr++];
> +	level->initialized = 0;
> +}
> +
> +static inline int pop_dir_level(struct dir_iterator_int *iter, struct dir_iterator_level *level)
> +{
> +	return --iter->levels_nr;
> +}
`pop_dir_level()` doesn't use its `level` argument; it can be removed.
> [...]
Michael
Previous: Daniel FerreiraNext: Daniel Ferreira
Message 6 of 19 in “[GSoC] remove_subtree(): reimplement using iterators”
  1. 0/5 [GSoC] remove_subtree(): reimplement using iteratorsDaniel Ferreira, Mar 29, 2017
  2. 4/5 remove_subtree(): test removing nested directoriesDaniel Ferreira, Mar 29, 2017
  3. 5/5 files_reflog_iterator: amend use of dir_iteratorDaniel Ferreira, Mar 29, 2017
  4. Michael HaggertyMar 29, 2017
  5. 1/5 dir_iterator: add helpers to dir_iterator_advanceDaniel Ferreira, Mar 29, 2017
  6. Michael HaggertyMar 29, 2017
  7. 3/5 remove_subtree(): reimplement using iteratorsDaniel Ferreira, Mar 29, 2017
  8. Michael HaggertyMar 29, 2017
  9. 2/5 dir_iterator: iterate over dir after its contentsDaniel Ferreira, Mar 29, 2017
  10. Michael HaggertyMar 29, 2017
  11. Michael HaggertyMar 29, 2017
  12. Junio C HamanoMar 29, 2017
  13. Michael HaggertyMar 30, 2017
  14. Junio C HamanoMar 30, 2017
  15. Michael HaggertyMar 30, 2017
  16. Duy NguyenMar 30, 2017
  17. Daniel Ferreira (theiostream)Apr 2, 2017
  18. Duy NguyenApr 5, 2017
  19. Junio C HamanoMar 30, 2017

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.