Re: [PATCH v3 00/36] object_id part 12

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

 



"brian m. carlson" <sandals@xxxxxxxxxxxxxxxxxxxx> writes:

>     -+		buf += the_hash_algo->rawsz;
>     -+		size -= the_hash_algo->rawsz;
>     ++		memcpy(it->oid.hash, (const unsigned char*)buf, rawsz);
>     ++		buf += rawsz;
>     ++		size -= rawsz;
>       	}

Using memcpy() to stuff the hash[] field of oid structure with a
bare byte array of rawsz bytes appears twice as a pattern in these
patches.  I wonder if this is something we want to abstract behind
the API, e.g.

	size_t oidstuff_(struct object_id *oid, const unsigned char *buf)
	{
		size_t rawsz = the_hash_algo->rawsz;
		memcpy(oid->hash, buf, rawsz);
                return rawsz;
	}

It just felt a bit uneven to be using a bare-metal memcpy() when
oidcpy() abstraction releaves the callers from having to be aware of
the rawsz all the time.




[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