Re: [PATCH 17/18] revert: Introduce --continue to continue the operation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tuesday 02 August 2011 04:36:41 Christian Couder wrote:
>
> static int parse_insn_buffer(char *buffer,
> 			     struct commit_list **todo_list,
> 			     struct replay_opts *opts)
> {
> 	struct commit_list **next = todo_list;
> 	char *p = buffer;
> 	int i;
> 
> 	for (i = 1; p && *p; i++) {
> 		struct commit *commit = parse_insn_line(p, opts);
> 		if (!commit)
> 			return error(_("Could not parse line %d."), i);
> 		next = commit_list_append(commit, next);
> 		p = strchr(p, '\n');
> 		if (p)
> 			p++;
> 	}

We can simplify this loop using strchrnul() like this:

 	for (i = 1; *p; i++) {
 		struct commit *commit = parse_insn_line(p, opts);
 		if (!commit)
 			return error(_("Could not parse line %d."), i);
 		next = commit_list_append(commit, next);
 		p = strchrnul(p, '\n');
 	}

Thanks,
Christian.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]