* [PATCH] Add a compat/strtoumax.c for Solaris 8.
@ 2007-02-20 0:22 Jason Riedy
2007-02-20 0:35 ` Shawn O. Pearce
0 siblings, 1 reply; 9+ messages in thread
From: Jason Riedy @ 2007-02-20 0:22 UTC (permalink / raw)
To: git
Solaris 8 was pre-c99, and they weren't willing to commit to
the strtoumax definition according to /usr/include/inttypes.h.
This adds NO_STRTOUMAX and NO_STRTOULL for ancient systems.
If NO_STRTOUMAX is defined, the routine in compat/strtoumax.c
will be used instead. That routine passes its arguments to
strtoull unless NO_STRTOULL is defined. If NO_STRTOULL, then
the routine uses strtoul (unsigned long).
Signed-off-by: Jason Riedy <ejr@cs.berkeley.edu>
---
I suppose the Sun libc folks were so burnt on the math additions
that they decided not to support *any* potential C99 bits on
Solaris 8. sigh. (Solaris 8 is slated to reach EOL on 2012, so
it'll be around a while.)
This alone won't pass tests on Solaris 8. The next patch fixes
fast-import.c to avoid C99 formats when necessary.
Makefile | 12 ++++++++++++
compat/strtoumax.c | 10 ++++++++++
git-compat-util.h | 5 +++++
3 files changed, 27 insertions(+), 0 deletions(-)
create mode 100644 compat/strtoumax.c
diff --git a/Makefile b/Makefile
index ebecbbd..5ae509f 100644
--- a/Makefile
+++ b/Makefile
@@ -28,6 +28,10 @@ all::
#
# Define NO_STRLCPY if you don't have strlcpy.
#
+# Define NO_STRTOUMAX if you don't have strtoumax in the C library.
+# If your compiler also does not support long long or does not have
+# strtoull, define NO_STRTOULL.
+#
# Define NO_SETENV if you don't have setenv in the C library.
#
# Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
@@ -353,6 +357,7 @@ ifeq ($(uname_S),SunOS)
NO_UNSETENV = YesPlease
NO_SETENV = YesPlease
NO_C99_FORMAT = YesPlease
+ NO_STRTOUMAX = YesPlease
endif
ifeq ($(uname_R),5.9)
NO_UNSETENV = YesPlease
@@ -517,6 +522,13 @@ ifdef NO_STRLCPY
COMPAT_CFLAGS += -DNO_STRLCPY
COMPAT_OBJS += compat/strlcpy.o
endif
+ifdef NO_STRTOUMAX
+ COMPAT_CFLAGS += -DNO_STRTOUMAX
+ COMPAT_OBJS += compat/strtoumax.o
+endif
+ifdef NO_STRTOULL
+ COMPAT_CFLAGS += -DNO_STRTOULL
+endif
ifdef NO_SETENV
COMPAT_CFLAGS += -DNO_SETENV
COMPAT_OBJS += compat/setenv.o
diff --git a/compat/strtoumax.c b/compat/strtoumax.c
new file mode 100644
index 0000000..f97bd08
--- /dev/null
+++ b/compat/strtoumax.c
@@ -0,0 +1,10 @@
+#include "../git-compat-util.h"
+
+uintmax_t gitstrtoumax (const char *nptr, char **endptr, int base)
+{
+#if defined(NO_STRTOULL)
+ return strtoul(nptr, endptr, base);
+#else
+ return strtoull(nptr, endptr, base);
+#endif
+}
diff --git a/git-compat-util.h b/git-compat-util.h
index 105ac28..9863cf6 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -139,6 +139,11 @@ extern char *gitstrcasestr(const char *haystack, const char *needle);
extern size_t gitstrlcpy(char *, const char *, size_t);
#endif
+#ifdef NO_STRTOUMAX
+#define strtoumax gitstrtoumax
+extern uintmax_t gitstrtoumax(const char *, char **, int);
+#endif
+
extern void release_pack_memory(size_t);
static inline char* xstrdup(const char *str)
--
1.5.0.1.28.g7b18f
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] Add a compat/strtoumax.c for Solaris 8.
2007-02-20 0:22 [PATCH] Add a compat/strtoumax.c for Solaris 8 Jason Riedy
@ 2007-02-20 0:35 ` Shawn O. Pearce
2007-02-20 0:53 ` Junio C Hamano
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Shawn O. Pearce @ 2007-02-20 0:35 UTC (permalink / raw)
To: Jason Riedy, Junio C Hamano; +Cc: git
Jason Riedy <ejr@EECS.Berkeley.EDU> wrote:
> Solaris 8 was pre-c99, and they weren't willing to commit to
> the strtoumax definition according to /usr/include/inttypes.h.
>
> This adds NO_STRTOUMAX and NO_STRTOULL for ancient systems.
> If NO_STRTOUMAX is defined, the routine in compat/strtoumax.c
> will be used instead. That routine passes its arguments to
> strtoull unless NO_STRTOULL is defined. If NO_STRTOULL, then
> the routine uses strtoul (unsigned long).
Ack'd (this and the fast-import patch that follows).
This is a better version than the patch I sent out last night,
so Junio please drop my patch in favor of Jason's.
--
Shawn.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Add a compat/strtoumax.c for Solaris 8.
2007-02-20 0:35 ` Shawn O. Pearce
@ 2007-02-20 0:53 ` Junio C Hamano
2007-02-20 0:58 ` Shawn O. Pearce
2007-02-20 2:20 ` Junio C Hamano
2007-02-20 20:16 ` Jason Riedy
2 siblings, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2007-02-20 0:53 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: Jason Riedy, git
"Shawn O. Pearce" <spearce@spearce.org> writes:
> This is a better version than the patch I sent out last night,
> so Junio please drop my patch in favor of Jason's.
Agh. Too late...
I need some rewinding and reshuffling.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Add a compat/strtoumax.c for Solaris 8.
2007-02-20 0:53 ` Junio C Hamano
@ 2007-02-20 0:58 ` Shawn O. Pearce
2007-02-20 1:29 ` Junio C Hamano
0 siblings, 1 reply; 9+ messages in thread
From: Shawn O. Pearce @ 2007-02-20 0:58 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Jason Riedy, git
Junio C Hamano <junkio@cox.net> wrote:
> "Shawn O. Pearce" <spearce@spearce.org> writes:
>
> > This is a better version than the patch I sent out last night,
> > so Junio please drop my patch in favor of Jason's.
>
> Agh. Too late...
>
> I need some rewinding and reshuffling.
Whoops. :-)
I hear Git is good at rewinding and reshuffling. Provided you have
not pushed the commits out yet. Maybe that will help you here? ;-)
--
Shawn.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Add a compat/strtoumax.c for Solaris 8.
2007-02-20 0:58 ` Shawn O. Pearce
@ 2007-02-20 1:29 ` Junio C Hamano
0 siblings, 0 replies; 9+ messages in thread
From: Junio C Hamano @ 2007-02-20 1:29 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: Jason Riedy, git
"Shawn O. Pearce" <spearce@spearce.org> writes:
> Junio C Hamano <junkio@cox.net> wrote:
>> "Shawn O. Pearce" <spearce@spearce.org> writes:
>>
>> > This is a better version than the patch I sent out last night,
>> > so Junio please drop my patch in favor of Jason's.
>>
>> Agh. Too late...
>>
>> I need some rewinding and reshuffling.
>
> Whoops. :-)
>
> I hear Git is good at rewinding and reshuffling. Provided you have
> not pushed the commits out yet. Maybe that will help you here? ;-)
That's what I'll do later.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Add a compat/strtoumax.c for Solaris 8.
2007-02-20 0:35 ` Shawn O. Pearce
2007-02-20 0:53 ` Junio C Hamano
@ 2007-02-20 2:20 ` Junio C Hamano
2007-02-20 2:51 ` Shawn O. Pearce
2007-02-20 20:16 ` Jason Riedy
2 siblings, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2007-02-20 2:20 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: Jason Riedy, git
"Shawn O. Pearce" <spearce@spearce.org> writes:
> Jason Riedy <ejr@EECS.Berkeley.EDU> wrote:
>> Solaris 8 was pre-c99, and they weren't willing to commit to
>> the strtoumax definition according to /usr/include/inttypes.h.
>>
>> This adds NO_STRTOUMAX and NO_STRTOULL for ancient systems.
>> If NO_STRTOUMAX is defined, the routine in compat/strtoumax.c
>> will be used instead. That routine passes its arguments to
>> strtoull unless NO_STRTOULL is defined. If NO_STRTOULL, then
>> the routine uses strtoul (unsigned long).
>
> Ack'd (this and the fast-import patch that follows).
>
> This is a better version than the patch I sent out last night,
> so Junio please drop my patch in favor of Jason's.
Yours talk about Sol 9 and Jason talks about Sol 8. Should I
take your ack to mean you want this patch on top of Jason's?
diff --git a/Makefile b/Makefile
index 821996f..f85fb7c 100644
--- a/Makefile
+++ b/Makefile
@@ -358,16 +358,17 @@ ifeq ($(uname_S),SunOS)
NO_SETENV = YesPlease
NO_C99_FORMAT = YesPlease
NO_STRTOUMAX = YesPlease
endif
ifeq ($(uname_R),5.9)
NO_UNSETENV = YesPlease
NO_SETENV = YesPlease
NO_C99_FORMAT = YesPlease
+ NO_STRTOUMAX = YesPlease
endif
INSTALL = ginstall
TAR = gtar
BASIC_CFLAGS += -D__EXTENSIONS__
endif
ifeq ($(uname_O),Cygwin)
NO_D_TYPE_IN_DIRENT = YesPlease
NO_D_INO_IN_DIRENT = YesPlease
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] Add a compat/strtoumax.c for Solaris 8.
2007-02-20 2:20 ` Junio C Hamano
@ 2007-02-20 2:51 ` Shawn O. Pearce
2007-02-20 3:00 ` Junio C Hamano
0 siblings, 1 reply; 9+ messages in thread
From: Shawn O. Pearce @ 2007-02-20 2:51 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Jason Riedy, git
Junio C Hamano <junkio@cox.net> wrote:
> Yours talk about Sol 9 and Jason talks about Sol 8. Should I
> take your ack to mean you want this patch on top of Jason's?
Yes, indeed. Please apply that. :-)
--
Shawn.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Add a compat/strtoumax.c for Solaris 8.
2007-02-20 2:51 ` Shawn O. Pearce
@ 2007-02-20 3:00 ` Junio C Hamano
0 siblings, 0 replies; 9+ messages in thread
From: Junio C Hamano @ 2007-02-20 3:00 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: Jason Riedy, git
Thanks.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Add a compat/strtoumax.c for Solaris 8.
2007-02-20 0:35 ` Shawn O. Pearce
2007-02-20 0:53 ` Junio C Hamano
2007-02-20 2:20 ` Junio C Hamano
@ 2007-02-20 20:16 ` Jason Riedy
2 siblings, 0 replies; 9+ messages in thread
From: Jason Riedy @ 2007-02-20 20:16 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: git
And Shawn O. Pearce writes:
> This is a better version than the patch I sent out last night,
> so Junio please drop my patch in favor of Jason's.
Sorry, didn't even notice... Houseguest, cold, and too much
work. ;) Thanks for working on this!
Jason
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2007-02-20 20:16 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-20 0:22 [PATCH] Add a compat/strtoumax.c for Solaris 8 Jason Riedy
2007-02-20 0:35 ` Shawn O. Pearce
2007-02-20 0:53 ` Junio C Hamano
2007-02-20 0:58 ` Shawn O. Pearce
2007-02-20 1:29 ` Junio C Hamano
2007-02-20 2:20 ` Junio C Hamano
2007-02-20 2:51 ` Shawn O. Pearce
2007-02-20 3:00 ` Junio C Hamano
2007-02-20 20:16 ` Jason Riedy
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).