]> git.ipfire.org Git - thirdparty/git.git/commit
Make fread/fwrite-like functions in http.c more like fread/fwrite.
authorMike Hommey <mh@glandium.org>
Tue, 7 May 2019 23:03:54 +0000 (08:03 +0900)
committerJunio C Hamano <gitster@pobox.com>
Wed, 8 May 2019 03:15:25 +0000 (12:15 +0900)
commit5c3d5a38231c2c8c5414232cfbb662b6610662b1
tree99ad24fe40a95f4a7e314d024c5cc458c3f5e173
parent83232e38648b51abbcbdb56c94632b6906cc85a6
Make fread/fwrite-like functions in http.c more like fread/fwrite.

The fread/fwrite-like functions in http.c, namely fread_buffer,
fwrite_buffer, fwrite_null, fwrite_sha1_file all return the
multiplication of the size and number of items they are being given.

Practically speaking, it doesn't matter, because in all contexts where
those functions are used, size is 1.

But those functions being similar to fread and fwrite (the curl API is
designed around being able to use fread and fwrite directly), it might
be preferable to make them behave like fread and fwrite, which, from
the fread/fwrite manual page, is:
   On  success, fread() and fwrite() return the number of items read
   or written.  This number equals the number of bytes transferred
   only when size is 1.  If an error occurs, or the end of the file
   is reached, the return value is a short item count (or zero).

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http.c