Re: [PATCH v2 3/8] object.c: add and use oid_is_type_or_die_msg() function

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

 



> +char* oid_is_type_or_die_msg(const struct object_id *oid,
> +				   enum object_type want,
> +				   enum object_type *type)
> +{
> +	struct strbuf sb = STRBUF_INIT;
> +	if (want == *type)
> +		BUG("call this just to get the message!");
> +	strbuf_addf(&sb, _(object_type_mismatch_msg), oid_to_hex(oid),
> +		    type_name(*type), type_name(want));
> +	return strbuf_detach(&sb, NULL);
> +}

It would be more convenient for the caller if this function also checks
want vs type and returns NULL if they match. That would also be more
consistent with the other functions, and the caller wouldn't need to
remember that this function only works if want and type are different.



[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]

  Powered by Linux