Re: [PATCH 4/7] revert: Allow mixed pick and revert instructions

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

 



Ramkumar Ramachandra wrote:

>  	if (!prefixcmp(start, "pick ")) {
> -		action = CHERRY_PICK;
> +		item->action = REPLAY_PICK;
>  		p += strlen("pick ");
>  	} else if (!prefixcmp(start, "revert ")) {
> -		action = REVERT;
> +		item->action = REPLAY_REVERT;
>  		p += strlen("revert ");
> -	} else
> -		return NULL;
> +	} else {
> +		int len = strchrnul(p, '\n') - p;
> +		if (len > 255)
> +			len = 255;
> +		return error(_("Unrecognized action: %.*s"), len, p);

What happens if the current line has more than INT_MAX characters?

Maybe it would make sense to factor out a function for this
computation, for brevity and so there is just one place to tweak.
--
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]