Thread (38 messages) flat view 38 messages, 4 authors, 2016-06-15

Re: mark parsing in fast-import

From: Jörg Sommer <hidden>
Date: 2016-06-15 22:44:31

Hallo Shawn,

Shawn O. Pearce schrieb am Mon 21. Apr, 19:59 (-0400):
Jrg Sommer [off-list ref] wrote:
quoted
Yes, you're right. I've checked some other functions and found this
behaviour. Can I use a different behabiour, i.e. return 0 on failure and
!0 on success?
I wasn't objected to the return values as written, but more to the
fact that it seemed like a logic error to me.  We use both patterns
in Git.  Perhaps the best example to follow is get_sha1_hex();
it returns -1 on error and 0 on success.  So a common pattern is
"!get_sha1_hex()" to ensure a successful conversion of a hex string
to an unsigned char array.
Thanks for this explanation. This was what I was looking for.

Another question: Is :0 a valid mark? In import_marks() is a check for
!mark, but I haven't seen it anywhere else.

Bye, Jörg.
-- 
Du hast keine Chance – also nutze sie.

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help