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>
This commit is contained in:

committed by
Junio C Hamano

parent
5d94d54564
commit
6ad656db9b
@ -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);
|
||||
|
Reference in New Issue
Block a user