Re: [PATCH v3] commit.c: Replace starts_with() with skip_prefix()

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

 



Karthik Nayak <karthik.188@xxxxxxxxx> writes:

> @@ -1098,6 +1099,7 @@ int parse_signed_commit(const unsigned char *sha1,
>  	char *buffer = read_sha1_file(sha1, &type, &size);
>  	int in_signature, saw_signature = -1;
>  	char *line, *tail;
> +	const char *gpg_sig;
>  
>  	if (!buffer || type != OBJ_COMMIT)
>  		goto cleanup;
> @@ -1113,9 +1115,9 @@ int parse_signed_commit(const unsigned char *sha1,
>  		next = next ? next + 1 : tail;
>  		if (in_signature && line[0] == ' ')
>  			sig = line + 1;
> -		else if (starts_with(line, gpg_sig_header) &&
> -			 line[gpg_sig_header_len] == ' ')
> -			sig = line + gpg_sig_header_len + 1;
> +		else if ((gpg_sig = skip_prefix(line, gpg_sig_header))
> +			  && gpg_sig[0] == ' ')
> +			sig = gpg_sig + 1;

I am not sure if this hunk is a great improvement, as we know the
length of what we are skipping in the gpg_sig_header_len constant
that is used throughout this file.
--
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]