diff mbox series

[v2,09/10] cat-file: batch_write: use size_t for length

Message ID 20240823224630.1180772-10-e@80x24.org (mailing list archive)
State New
Headers show
Series cat-file speedups | expand

Commit Message

Eric Wong Aug. 23, 2024, 10:46 p.m. UTC
fwrite(3) and write(2), and all of our wrappers for them use
size_t while object size is `unsigned long', so there's no
excuse to use a potentially smaller representation.

Signed-off-by: Eric Wong <e@80x24.org>
---
 builtin/cat-file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Junio C Hamano Aug. 27, 2024, 5:06 a.m. UTC | #1
Eric Wong <e@80x24.org> writes:

> fwrite(3) and write(2), and all of our wrappers for them use
> size_t while object size is `unsigned long', so there's no
> excuse to use a potentially smaller representation.
>
> Signed-off-by: Eric Wong <e@80x24.org>
> ---
>  builtin/cat-file.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Obviously correct.  Thanks.

>
> diff --git a/builtin/cat-file.c b/builtin/cat-file.c
> index 067cdbdbf9..bf81054662 100644
> --- a/builtin/cat-file.c
> +++ b/builtin/cat-file.c
> @@ -369,7 +369,7 @@ static void expand_format(struct strbuf *sb, const char *start,
>  	}
>  }
>  
> -static void batch_write(struct batch_options *opt, const void *data, int len)
> +static void batch_write(struct batch_options *opt, const void *data, size_t len)
>  {
>  	if (opt->buffer_output) {
>  		if (fwrite(data, 1, len, stdout) != len)
diff mbox series

Patch

diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index 067cdbdbf9..bf81054662 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -369,7 +369,7 @@  static void expand_format(struct strbuf *sb, const char *start,
 	}
 }
 
-static void batch_write(struct batch_options *opt, const void *data, int len)
+static void batch_write(struct batch_options *opt, const void *data, size_t len)
 {
 	if (opt->buffer_output) {
 		if (fwrite(data, 1, len, stdout) != len)