diff mbox series

[v1,2/3] strbuf.c: remove unreferenced strbuf_write_fd method.

Message ID 20200619150445.4380-3-randall.s.becker@rogers.com (mailing list archive)
State New, archived
Headers show
Series Replace strbuf_write_fd with write_in_full | expand

Commit Message

Randall S. Becker June 19, 2020, 3:04 p.m. UTC
From: "Randall S. Becker" <rsbecker@nexbridge.com>

strbuf_write_fd was only used in bugreport.c. Since that file now uses
write_in_full, this method is no longer needed.

Signed-off-by: Randall S. Becker <rsbecker@nexbridge.com>
---
 strbuf.c | 5 -----
 1 file changed, 5 deletions(-)

Comments

Junio C Hamano June 19, 2020, 7:30 p.m. UTC | #1
randall.s.becker@rogers.com writes:

> From: "Randall S. Becker" <rsbecker@nexbridge.com>
>
> strbuf_write_fd was only used in bugreport.c. Since that file now uses
> write_in_full, this method is no longer needed.

Yay!


> Signed-off-by: Randall S. Becker <rsbecker@nexbridge.com>
> ---
>  strbuf.c | 5 -----
>  1 file changed, 5 deletions(-)
>
> diff --git a/strbuf.c b/strbuf.c
> index 2f1a7d3209..e3397cc4c7 100644
> --- a/strbuf.c
> +++ b/strbuf.c
> @@ -556,11 +556,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)
Jeff King June 19, 2020, 7:49 p.m. UTC | #2
On Fri, Jun 19, 2020 at 11:04:44AM -0400, randall.s.becker@rogers.com wrote:

> From: "Randall S. Becker" <rsbecker@nexbridge.com>
> 
> strbuf_write_fd was only used in bugreport.c. Since that file now uses
> write_in_full, this method is no longer needed.

Just because there are no callers _now_ does not necessarily mean that
it's a good idea to get rid of a function. I think the real argument is
that we don't expect new ones, because it's a badly designed function
(for the reasons in our earlier discussion). Maybe worth summarizing
here.

-Peff
diff mbox series

Patch

diff --git a/strbuf.c b/strbuf.c
index 2f1a7d3209..e3397cc4c7 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -556,11 +556,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)