Re: [PATCH] Convert size datatype to size_t

3 messages, 2 authors, 2017-08-09 · open the first message on its own page

Re: [PATCH] Convert size datatype to size_t

From: Junio C Hamano <hidden>
Date: 2017-08-09 06:04:46

Martin Koegler [off-list ref] writes:
From: Martin Koegler <redacted>

It changes the signature of the core object access function
including any other functions to assure a clean compile if
sizeof(size_t) != sizeof(unsigned long).
As https://travis-ci.org/git/git/jobs/262463159 shows, unfortunately
it turns out that things are not so simple X-<.  On Linux32, size_t
is uint, which is the same size as ulong, but "%lu" is not appropriate
for showing a size_t value.

So you are correct to say in the comment under three-dashes that
there is much more to change in the codebase.

Re: [PATCH] Convert size datatype to size_t

From: Martin Koegler <hidden>
Date: 2017-08-09 07:19:16

On Tue, Aug 08, 2017 at 11:04:20PM -0700, Junio C Hamano wrote:
Martin Koegler [off-list ref] writes:
quoted
From: Martin Koegler <redacted>

It changes the signature of the core object access function
including any other functions to assure a clean compile if
sizeof(size_t) != sizeof(unsigned long).
As https://travis-ci.org/git/git/jobs/262463159 shows, unfortunately
it turns out that things are not so simple X-<.  On Linux32, size_t
is uint, which is the same size as ulong, but "%lu" is not appropriate
for showing a size_t value.

So you are correct to say in the comment under three-dashes that
there is much more to change in the codebase.
My patch is based on V2 of my "Fix delta integer overflows" patch [also changing the variable types].

I'll post a new version fixing the *printf issues.

The patch can't be splitted without causing compile errors, if sizeof(size_t) != sizeof(ulong).
Many variables are not changed to keep the patch small.

Regards,
Martin

Re: [PATCH] Convert size datatype to size_t

From: Martin Koegler <hidden>
Date: 2017-08-09 07:26:29

On Wed, Aug 09, 2017 at 09:19:06AM +0200, Martin Koegler wrote:
On Tue, Aug 08, 2017 at 11:04:20PM -0700, Junio C Hamano wrote:
quoted
As https://travis-ci.org/git/git/jobs/262463159 shows, unfortunately
it turns out that things are not so simple X-<.  On Linux32, size_t
is uint, which is the same size as ulong, but "%lu" is not appropriate
for showing a size_t value.

So you are correct to say in the comment under three-dashes that
there is much more to change in the codebase.
I'll post a new version fixing the *printf issues.
What is the correct format specifier for size_t?
Linux has %zu (C99). Is that OK for the GIT codebase?

Regards,
Martin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help