diff options
author | Alban Gruin <alban.gruin@gmail.com> | 2019-01-29 18:01:46 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-01-29 23:09:24 +0300 |
commit | 6ad656db9b2d2426a0a884b431e8adc9877101bc (patch) | |
tree | 380e995210735a71810703f59fbe88f3872c4d47 /sequencer.h | |
parent | 5d94d54564fb0dea1f3caf2f1dacb7701f4be25c (diff) |
sequencer: remove the 'arg' field from todo_item
The 'arg' field of todo_item used to store the address of the first byte
of the parameter of a command in a todo list. It was associated with
the length of the parameter (the 'arg_len' field).
This replaces the 'arg' field by 'arg_offset'. This new field does not
store the address of the parameter, but the position of the first
character of the parameter in the buffer. todo_item_get_arg() is added
to return the address of the parameter of an item.
This will prevent todo_list_add_exec_commands() from having to do awful
pointer arithmetics when growing the todo list buffer.
Signed-off-by: Alban Gruin <alban.gruin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.h')
-rw-r--r-- | sequencer.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sequencer.h b/sequencer.h index c6360bac66..50d552429c 100644 --- a/sequencer.h +++ b/sequencer.h @@ -104,9 +104,9 @@ struct todo_item { enum todo_command command; struct commit *commit; unsigned int flags; - const char *arg; int arg_len; - size_t offset_in_buf; + /* The offset of the command and its argument in the strbuf */ + size_t offset_in_buf, arg_offset; }; struct todo_list { @@ -122,6 +122,8 @@ struct todo_list { int todo_list_parse_insn_buffer(struct repository *r, char *buf, struct todo_list *todo_list); void todo_list_release(struct todo_list *todo_list); +const char *todo_item_get_arg(struct todo_list *todo_list, + struct todo_item *item); /* Call this to setup defaults before parsing command line options */ void sequencer_init_config(struct replay_opts *opts); |