diff mbox series

[01/15] sequencer: clear the number of items of a todo_list before parsing

Message ID 20181007195418.25752-2-alban.gruin@gmail.com (mailing list archive)
State New, archived
Headers show
Series sequencer: refactor functions working on a todo_list | expand

Commit Message

Alban Gruin Oct. 7, 2018, 7:54 p.m. UTC
This clears the number of items of a todo_list before parsing it to
allow to parse the same list multiple times without issues.

As its items are not dynamically allocated, or don’t need to allocate
memory, no additionnal memory management is required here.

Signed-off-by: Alban Gruin <alban.gruin@gmail.com>
 sequencer.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series


diff --git a/sequencer.c b/sequencer.c
index 0a3292d5c4..ed798b95d1 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -2063,6 +2063,8 @@  static int parse_insn_buffer(char *buf, struct todo_list *todo_list)
 	char *p = buf, *next_p;
 	int i, res = 0, fixup_okay = file_exists(rebase_path_done());
+	todo_list->current = todo_list->nr = 0;
 	for (i = 1; *p; i++, p = next_p) {
 		char *eol = strchrnul(p, '\n');