{"thread":{"id":"6887","subject":"[PATCH] Add a compat/strtoumax.c for Solaris 8.","startedAt":"2007-02-20T00:22:56Z","lastAt":"2007-02-20T20:16:08Z","messageCount":9,"participants":["Jason Riedy","Shawn O. Pearce","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"35052","messageId":"17777.1171930976@lotus.CS.Berkeley.EDU","threadId":"6887","inReplyTo":null,"subject":"[PATCH] Add a compat/strtoumax.c for Solaris 8.","fromName":"Jason Riedy","fromEmail":"ejr@eecs.berkeley.edu","sentAt":"2007-02-20T00:22:56Z","receivedAt":"2007-02-20T00:22:56Z","isPatch":true,"sender":{"key":"ejr@eecs.berkeley.edu","avatar":"https://gravatar.com/avatar/547fa56f887cab01599edab4e9f813c949c1269e02714f20e0496c56185d9837?d=mp&s=160"},"body":"Solaris 8 was pre-c99, and they weren't willing to commit to\nthe strtoumax definition according to /usr/include/inttypes.h.\n\nThis adds NO_STRTOUMAX and NO_STRTOULL for ancient systems.\nIf NO_STRTOUMAX is defined, the routine in compat/strtoumax.c\nwill be used instead.  That routine passes its arguments to\nstrtoull unless NO_STRTOULL is defined.  If NO_STRTOULL, then\nthe routine uses strtoul (unsigned long).\n\nSigned-off-by: Jason Riedy <ejr@cs.berkeley.edu>\n---\n  I suppose the Sun libc folks were so burnt on the math additions\n  that they decided not to support *any* potential C99 bits on\n  Solaris 8.  sigh.  (Solaris 8 is slated to reach EOL on 2012, so\n  it'll be around a while.)\n\n  This alone won't pass tests on Solaris 8.  The next patch fixes\n  fast-import.c to avoid C99 formats when necessary.\n\n Makefile           |   12 ++++++++++++\n compat/strtoumax.c |   10 ++++++++++\n git-compat-util.h  |    5 +++++\n 3 files changed, 27 insertions(+), 0 deletions(-)\n create mode 100644 compat/strtoumax.c\n\ndiff --git a/Makefile b/Makefile\nindex ebecbbd..5ae509f 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -28,6 +28,10 @@ all::\n #\n # Define NO_STRLCPY if you don't have strlcpy.\n #\n+# Define NO_STRTOUMAX if you don't have strtoumax in the C library.\n+# If your compiler also does not support long long or does not have\n+# strtoull, define NO_STRTOULL.\n+#\n # Define NO_SETENV if you don't have setenv in the C library.\n #\n # Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.\n@@ -353,6 +357,7 @@ ifeq ($(uname_S),SunOS)\n \t\tNO_UNSETENV = YesPlease\n \t\tNO_SETENV = YesPlease\n \t\tNO_C99_FORMAT = YesPlease\n+\t\tNO_STRTOUMAX = YesPlease\n \tendif\n \tifeq ($(uname_R),5.9)\n \t\tNO_UNSETENV = YesPlease\n@@ -517,6 +522,13 @@ ifdef NO_STRLCPY\n \tCOMPAT_CFLAGS += -DNO_STRLCPY\n \tCOMPAT_OBJS += compat/strlcpy.o\n endif\n+ifdef NO_STRTOUMAX\n+\tCOMPAT_CFLAGS += -DNO_STRTOUMAX\n+\tCOMPAT_OBJS += compat/strtoumax.o\n+endif\n+ifdef NO_STRTOULL\n+\tCOMPAT_CFLAGS += -DNO_STRTOULL\n+endif\n ifdef NO_SETENV\n \tCOMPAT_CFLAGS += -DNO_SETENV\n \tCOMPAT_OBJS += compat/setenv.o\ndiff --git a/compat/strtoumax.c b/compat/strtoumax.c\nnew file mode 100644\nindex 0000000..f97bd08\n--- /dev/null\n+++ b/compat/strtoumax.c\n@@ -0,0 +1,10 @@\n+#include \"../git-compat-util.h\"\n+\n+uintmax_t gitstrtoumax (const char *nptr, char **endptr, int base)\n+{\n+#if defined(NO_STRTOULL)\n+\treturn strtoul(nptr, endptr, base);\n+#else\n+\treturn strtoull(nptr, endptr, base);\n+#endif\n+}\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex 105ac28..9863cf6 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -139,6 +139,11 @@ extern char *gitstrcasestr(const char *haystack, const char *needle);\n extern size_t gitstrlcpy(char *, const char *, size_t);\n #endif\n \n+#ifdef NO_STRTOUMAX\n+#define strtoumax gitstrtoumax\n+extern uintmax_t gitstrtoumax(const char *, char **, int);\n+#endif\n+\n extern void release_pack_memory(size_t);\n \n static inline char* xstrdup(const char *str)\n-- \n1.5.0.1.28.g7b18f\n"},{"id":"35057","messageId":"20070220003533.GB28314@spearce.org","threadId":"6887","inReplyTo":"17777.1171930976@lotus.CS.Berkeley.EDU","subject":"Re: [PATCH] Add a compat/strtoumax.c for Solaris 8.","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-02-20T00:35:33Z","receivedAt":"2007-02-20T00:35:33Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Jason Riedy <ejr@EECS.Berkeley.EDU> wrote:\n> Solaris 8 was pre-c99, and they weren't willing to commit to\n> the strtoumax definition according to /usr/include/inttypes.h.\n> \n> This adds NO_STRTOUMAX and NO_STRTOULL for ancient systems.\n> If NO_STRTOUMAX is defined, the routine in compat/strtoumax.c\n> will be used instead.  That routine passes its arguments to\n> strtoull unless NO_STRTOULL is defined.  If NO_STRTOULL, then\n> the routine uses strtoul (unsigned long).\n\nAck'd (this and the fast-import patch that follows).\n\nThis is a better version than the patch I sent out last night,\nso Junio please drop my patch in favor of Jason's.\n\n-- \nShawn.\n"},{"id":"35068","messageId":"7virdx4pl2.fsf@assigned-by-dhcp.cox.net","threadId":"6887","inReplyTo":"20070220003533.GB28314@spearce.org","subject":"Re: [PATCH] Add a compat/strtoumax.c for Solaris 8.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-02-20T00:53:13Z","receivedAt":"2007-02-20T00:53:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Shawn O. Pearce\" <spearce@spearce.org> writes:\n\n> This is a better version than the patch I sent out last night,\n> so Junio please drop my patch in favor of Jason's.\n\nAgh.  Too late...\n\nI need some rewinding and reshuffling.\n"},{"id":"35069","messageId":"20070220005821.GC28314@spearce.org","threadId":"6887","inReplyTo":"7virdx4pl2.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Add a compat/strtoumax.c for Solaris 8.","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-02-20T00:58:22Z","receivedAt":"2007-02-20T00:58:22Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Junio C Hamano <junkio@cox.net> wrote:\n> \"Shawn O. Pearce\" <spearce@spearce.org> writes:\n> \n> > This is a better version than the patch I sent out last night,\n> > so Junio please drop my patch in favor of Jason's.\n> \n> Agh.  Too late...\n> \n> I need some rewinding and reshuffling.\n\nWhoops.  :-)\n\nI hear Git is good at rewinding and reshuffling.  Provided you have\nnot pushed the commits out yet.  Maybe that will help you here?  ;-)\n\n-- \nShawn.\n"},{"id":"35072","messageId":"7vy7mt39c0.fsf@assigned-by-dhcp.cox.net","threadId":"6887","inReplyTo":"20070220005821.GC28314@spearce.org","subject":"Re: [PATCH] Add a compat/strtoumax.c for Solaris 8.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-02-20T01:29:35Z","receivedAt":"2007-02-20T01:29:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Shawn O. Pearce\" <spearce@spearce.org> writes:\n\n> Junio C Hamano <junkio@cox.net> wrote:\n>> \"Shawn O. Pearce\" <spearce@spearce.org> writes:\n>> \n>> > This is a better version than the patch I sent out last night,\n>> > so Junio please drop my patch in favor of Jason's.\n>> \n>> Agh.  Too late...\n>> \n>> I need some rewinding and reshuffling.\n>\n> Whoops.  :-)\n>\n> I hear Git is good at rewinding and reshuffling.  Provided you have\n> not pushed the commits out yet.  Maybe that will help you here?  ;-)\n\nThat's what I'll do later.\n"},{"id":"35079","messageId":"7vfy9136zu.fsf@assigned-by-dhcp.cox.net","threadId":"6887","inReplyTo":"20070220003533.GB28314@spearce.org","subject":"Re: [PATCH] Add a compat/strtoumax.c for Solaris 8.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-02-20T02:20:05Z","receivedAt":"2007-02-20T02:20:05Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Shawn O. Pearce\" <spearce@spearce.org> writes:\n\n> Jason Riedy <ejr@EECS.Berkeley.EDU> wrote:\n>> Solaris 8 was pre-c99, and they weren't willing to commit to\n>> the strtoumax definition according to /usr/include/inttypes.h.\n>> \n>> This adds NO_STRTOUMAX and NO_STRTOULL for ancient systems.\n>> If NO_STRTOUMAX is defined, the routine in compat/strtoumax.c\n>> will be used instead.  That routine passes its arguments to\n>> strtoull unless NO_STRTOULL is defined.  If NO_STRTOULL, then\n>> the routine uses strtoul (unsigned long).\n>\n> Ack'd (this and the fast-import patch that follows).\n>\n> This is a better version than the patch I sent out last night,\n> so Junio please drop my patch in favor of Jason's.\n\nYours talk about Sol 9 and Jason talks about Sol 8.  Should I\ntake your ack to mean you want this patch on top of Jason's?\n\ndiff --git a/Makefile b/Makefile\nindex 821996f..f85fb7c 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -358,16 +358,17 @@ ifeq ($(uname_S),SunOS)\n \t\tNO_SETENV = YesPlease\n \t\tNO_C99_FORMAT = YesPlease\n \t\tNO_STRTOUMAX = YesPlease\n \tendif\n \tifeq ($(uname_R),5.9)\n \t\tNO_UNSETENV = YesPlease\n \t\tNO_SETENV = YesPlease\n \t\tNO_C99_FORMAT = YesPlease\n+\t\tNO_STRTOUMAX = YesPlease\n \tendif\n \tINSTALL = ginstall\n \tTAR = gtar\n \tBASIC_CFLAGS += -D__EXTENSIONS__\n endif\n ifeq ($(uname_O),Cygwin)\n \tNO_D_TYPE_IN_DIRENT = YesPlease\n \tNO_D_INO_IN_DIRENT = YesPlease\n"},{"id":"35083","messageId":"20070220025110.GA28797@spearce.org","threadId":"6887","inReplyTo":"7vfy9136zu.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Add a compat/strtoumax.c for Solaris 8.","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-02-20T02:51:10Z","receivedAt":"2007-02-20T02:51:10Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Junio C Hamano <junkio@cox.net> wrote:\n> Yours talk about Sol 9 and Jason talks about Sol 8.  Should I\n> take your ack to mean you want this patch on top of Jason's?\n\nYes, indeed.  Please apply that.  :-)\n\n-- \nShawn.\n"},{"id":"35084","messageId":"7v7iud354s.fsf@assigned-by-dhcp.cox.net","threadId":"6887","inReplyTo":"20070220025110.GA28797@spearce.org","subject":"Re: [PATCH] Add a compat/strtoumax.c for Solaris 8.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-02-20T03:00:19Z","receivedAt":"2007-02-20T03:00:19Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks.\n"},{"id":"35140","messageId":"19776.1172002568@lotus.CS.Berkeley.EDU","threadId":"6887","inReplyTo":"20070220003533.GB28314@spearce.org","subject":"Re: [PATCH] Add a compat/strtoumax.c for Solaris 8.","fromName":"Jason Riedy","fromEmail":"ejr@cs.berkeley.edu","sentAt":"2007-02-20T20:16:08Z","receivedAt":"2007-02-20T20:16:08Z","isPatch":true,"sender":{"key":"ejr@eecs.berkeley.edu","avatar":"https://gravatar.com/avatar/547fa56f887cab01599edab4e9f813c949c1269e02714f20e0496c56185d9837?d=mp&s=160"},"body":"And Shawn O. Pearce writes:\n> This is a better version than the patch I sent out last night,\n> so Junio please drop my patch in favor of Jason's.\n\nSorry, didn't even notice...  Houseguest, cold, and too much\nwork.  ;)  Thanks for working on this!\n\nJason\n"}]}