]> git.ipfire.org Git - thirdparty/git.git/commit - pkt-line.c
pkt-line: check write_in_full() errors against "< 0"
authorJeff King <peff@peff.net>
Wed, 13 Sep 2017 17:17:30 +0000 (13:17 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 14 Sep 2017 06:17:59 +0000 (15:17 +0900)
commit4c95e3dd28342878e0deed264ddc784b775361b7
tree42725a586833e30d8e790244a63b593bf5844a2a
parent564bde9ae69dc3d60e764078745275b637f90991
pkt-line: check write_in_full() errors against "< 0"

As with the previous two commits, we prefer to check
write_in_full()'s return value to see if it is negative,
rather than comparing it to the input length.

These cases actually flip the logic to check for success,
making conversion a little different than in other cases. We
could of course write:

  if (write_in_full(...) >= 0)
          return 0;
  return error(...);

But our usual method of spelling write() error checks is
just "< 0". So let's flip the logic for each of these
conditionals to our usual style.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
pkt-line.c