From: Petr Baudis <pasky@ucw.cz>
To: Junio C Hamano <junkio@cox.net>
Cc: Linus Torvalds <torvalds@osdl.org>, git@vger.kernel.org
Subject: Re: [PATCH] Use correct U*MAX.
Date: Sat, 4 Jun 2005 01:02:37 +0200 [thread overview]
Message-ID: <20050603230234.GC13093@pasky.ji.cz> (raw)
In-Reply-To: <7vwtpc7lju.fsf_-_@assigned-by-dhcp.cox.net>
Dear diary, on Thu, Jun 02, 2005 at 06:47:33PM CEST, I got a letter
where Junio C Hamano <junkio@cox.net> told me that...
> The largest "unsigned long" value is ULONG_MAX, not UINT_MAX.
>
> Signed-off-by: Junio C Hamano <junkio@cox.net>
> diff --git a/diff.c b/diff.c
> --- a/diff.c
> +++ b/diff.c
> @@ -256,7 +256,7 @@ static struct sha1_size_cache *locate_si
> first = next+1;
> }
> /* not found */
> - if (size == UINT_MAX)
> + if (size == ULONG_MAX)
> return NULL;
> /* insert to make it at "first" */
> if (sha1_size_cache_alloc <= sha1_size_cache_nr) {
> @@ -338,7 +338,7 @@ int diff_populate_filespec(struct diff_f
> struct sha1_size_cache *e;
>
> if (size_only) {
> - e = locate_size_cache(s->sha1, UINT_MAX);
> + e = locate_size_cache(s->sha1, ULONG_MAX);
> if (e) {
> s->size = e->size;
> return 0;
This one still applies, but it might be better to get rid of it
altogether, like...
[PATCH] Kill UINT_MAX usage in locate_size_cache()
Use -1 instead of UINT_MAX to indicate that locate_size_cache() should
do only the lookup and not create new stuff in case the looked up hash
was not found.
Signed-off-by: Petr Baudis <pasky@ucw.cz>
diff --git a/diff.c b/diff.c
--- a/diff.c
+++ b/diff.c
@@ -256,7 +256,7 @@ static struct sha1_size_cache *locate_si
first = next+1;
}
/* not found */
- if (size == UINT_MAX)
+ if (size == -1)
return NULL;
/* insert to make it at "first" */
if (sha1_size_cache_alloc <= sha1_size_cache_nr) {
@@ -337,7 +337,7 @@ int diff_populate_filespec(struct diff_f
struct sha1_size_cache *e;
if (size_only) {
- e = locate_size_cache(s->sha1, UINT_MAX);
+ e = locate_size_cache(s->sha1, -1);
if (e) {
s->size = e->size;
return 0;
|
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
next prev parent reply other threads:[~2005-06-03 22:59 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <7vy89ums2l.fsf@assigned-by-dhcp.cox.net>
2005-06-01 18:38 ` [PATCH] diff: mode bits fixes Junio C Hamano
2005-06-02 16:46 ` [PATCH] Handle deltified object correctly in git-*-pull family Junio C Hamano
2005-06-02 17:03 ` Linus Torvalds
2005-06-02 18:55 ` Junio C Hamano
2005-06-02 21:31 ` Nicolas Pitre
2005-06-02 21:36 ` Nicolas Pitre
2005-06-02 22:19 ` [PATCH 1/2] " Junio C Hamano
2005-06-02 22:48 ` Linus Torvalds
2005-06-02 22:20 ` [PATCH 2/2] Find size of SHA1 object without inflating everything Junio C Hamano
2005-06-02 18:57 ` [PATCH] " Junio C Hamano
2005-06-02 22:10 ` Linus Torvalds
2005-06-02 22:47 ` Junio C Hamano
2005-06-02 17:03 ` [PATCH] Handle deltified object correctly in git-*-pull family McMullan, Jason
2005-06-02 18:02 ` Junio C Hamano
2005-06-02 16:47 ` [PATCH] Use correct U*MAX Junio C Hamano
2005-06-03 23:02 ` Petr Baudis [this message]
2005-06-03 23:40 ` Junio C Hamano
2005-06-04 0:00 ` Petr Baudis
2005-06-04 0:09 ` Junio C Hamano
2005-06-02 16:49 ` [PATCH] Find size of SHA1 object without inflating everything Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050603230234.GC13093@pasky.ji.cz \
--to=pasky@ucw.cz \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).