]> git.ipfire.org Git - thirdparty/git.git/commitdiff
strbuf: remove unreferenced strbuf_write_fd method.
authorRandall S. Becker <randall.becker@nexbridge.ca>
Fri, 19 Jun 2020 20:23:20 +0000 (16:23 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 19 Jun 2020 20:50:27 +0000 (13:50 -0700)
strbuf_write_fd was only used in bugreport.c. Since that file now uses
write_in_full, this method is no longer needed. In addition, strbuf_write_fd
did not guard against exceeding MAX_IO_SIZE for the platform, nor
provided error handling in the event of a failure if only partial data
was written to the file descriptor. Since already write_in_full has this
capability and is in general use, it should be used instead. The change
impacts strbuf.c and strbuf.h.

Signed-off-by: Randall S. Becker <rsbecker@nexbridge.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
strbuf.c
strbuf.h

index f1d66c7848e4dc68af0b89d05893cf77890a9930..4bbaff2bdad4709c424769a82777d55ab43c6bc7 100644 (file)
--- a/strbuf.c
+++ b/strbuf.c
@@ -539,11 +539,6 @@ ssize_t strbuf_write(struct strbuf *sb, FILE *f)
        return sb->len ? fwrite(sb->buf, 1, sb->len, f) : 0;
 }
 
-ssize_t strbuf_write_fd(struct strbuf *sb, int fd)
-{
-       return sb->len ? write(fd, sb->buf, sb->len) : 0;
-}
-
 #define STRBUF_MAXLINK (2*PATH_MAX)
 
 int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint)
index 1eaa944a4f0ad3546a8384908bd693bd873ceba7..bfa66569a4bffd063578477e68010a5ccc14f5a3 100644 (file)
--- a/strbuf.h
+++ b/strbuf.h
@@ -450,7 +450,6 @@ int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint);
  * NUL bytes.
  */
 ssize_t strbuf_write(struct strbuf *sb, FILE *stream);
-ssize_t strbuf_write_fd(struct strbuf *sb, int fd);
 
 /**
  * Read a line from a FILE *, overwriting the existing contents of