Re: [PATCH 3/5] sequencer: sequencer state is useless without todo

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

 



Ramkumar Ramachandra <artagnon@xxxxxxxxx> writes:

> I noticed that sha1_to_hex() also operates like this.

A function to externalize our internal representation like sha1_to_hex()
is not such a big problem in practice, as the lifetime of its result is
inherently much shorter.

Anybody sane with a datum that eventually needs to be externalized will
keep it in its internal representation as long as possible, and then call
such an internal-to-external function just before it becomes absolutely
necessary to externalize it (e.g. calling printf(), packet_write(), etc).
This is because the whole point of having an internal representation
(e.g. when our code talks about an object name, we always use "unsigned
char[20]") is so that all of our functions can use that representation to
pass it around. It would be insane to call such a function earlier than
necessary, having to pass external representation around.

On the other hand, resolve_ref() is an interface to canonicalize external
representation into a form suitable to be kept and passed around as its
internal representation. The lifetime of its result fundamentally has to
be a lot longer than that of functions that work in the opposite
direction, e.g. sha1_to_hex().
--
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]