Skip to content

Commit 5f2b643

Browse files
rsbeckercagitster
authored andcommitted
strbuf: remove unreferenced strbuf_write_fd method.
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f64b6a1 commit 5f2b643

File tree

2 files changed

+0
-6
lines changed

2 files changed

+0
-6
lines changed

strbuf.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -539,11 +539,6 @@ ssize_t strbuf_write(struct strbuf *sb, FILE *f)
539539
return sb->len ? fwrite(sb->buf, 1, sb->len, f) : 0;
540540
}
541541

542-
ssize_t strbuf_write_fd(struct strbuf *sb, int fd)
543-
{
544-
return sb->len ? write(fd, sb->buf, sb->len) : 0;
545-
}
546-
547542
#define STRBUF_MAXLINK (2*PATH_MAX)
548543

549544
int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint)

strbuf.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,6 @@ int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint);
450450
* NUL bytes.
451451
*/
452452
ssize_t strbuf_write(struct strbuf *sb, FILE *stream);
453-
ssize_t strbuf_write_fd(struct strbuf *sb, int fd);
454453

455454
/**
456455
* Read a line from a FILE *, overwriting the existing contents of

0 commit comments

Comments
 (0)