From: "Blake Ramsdell" <blaker@gmail.com>
To: "David Symonds" <dsymonds@gmail.com>,
"Junio C Hamano" <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Mac OS X 10.5 does not require the OLD_ICONV flag set
Date: Fri, 2 Nov 2007 13:03:05 -0700 [thread overview]
Message-ID: <985966520711021303g905f638y2056219c22e5edeb@mail.gmail.com> (raw)
In-Reply-To: <ee77f5c20711020423t6ce58818gcc5220b6427ded1@mail.gmail.com>
On 11/2/07, David Symonds <dsymonds@gmail.com> wrote:
> It would probably be most appropriate for the autoconf script. Now
> that I look at configure.ac, there's already a test for iconv in
> there; is it not used?
The crux of this problem is that the prototype for iconv in
/usr/include/iconv.h is different between OS X 10.4 and OS X 10.5. So
the "right thing" is definitely to determine what is in the function
prototype, and then act accordingly.
>From OS X 10.4.10:
#define _LIBICONV_VERSION 0x0109 /* version number: (major<<8) + minor */
...
extern size_t iconv (iconv_t cd, const char* * inbuf, size_t
*inbytesleft, char* * outbuf, size_t *outbytesleft);
>From OS X 10.5:
#define _LIBICONV_VERSION 0x010B /* version number: (major<<8) + minor */
...
size_t iconv (iconv_t /*cd*/,
char ** __restrict /*inbuf*/, size_t * __restrict /*inbytesleft*/,
char ** __restrict /*outbuf*/, size_t * __restrict /*outbytesleft*/);
So what happened in git is that someone put in OLD_ICONV to
dynamically adjust the const-ness of parameter 2 to the iconv
function, and the way they chose to do that is to identify the OS
(more accurately, the kernel), and then I went and furthered that by
identifying the version.
Now that I look at it further, it seems that yanking OLD_ICONV
altogether is a better approach, and to just check _LIBICONV_VERSION
to make sure it's "new enough". Now, I'm not sure what that comparison
would be, but we know that "later than 0x0109" is a good start. Based
on the version difference between OS X 10.4 and 10.5 I note that there
is only 0x010A intervening.
This strategy presumes that this const parameter was const all the way
up to a particular point, and then stopped being const, which is
probably a reasonable assumption.
Blake
--
Blake Ramsdell | http://www.blakeramsdell.com
next prev parent reply other threads:[~2007-11-02 20:03 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-02 2:38 [PATCH] Mac OS X 10.5 does not require the OLD_ICONV flag set Blake Ramsdell
2007-11-02 2:38 ` [PATCH] Fixed a gcc 4.0.1 complaint about an uninitialized variable Blake Ramsdell
2007-11-02 5:37 ` Junio C Hamano
2007-11-02 9:03 ` [PATCH] Mac OS X 10.5 does not require the OLD_ICONV flag set Junio C Hamano
2007-11-02 9:20 ` Blake Ramsdell
2007-11-02 9:30 ` Mike Hommey
2007-11-02 9:39 ` Benoit SIGOURE
2007-11-02 9:45 ` Mike Hommey
2007-11-02 10:19 ` David Symonds
2007-11-02 10:33 ` Junio C Hamano
2007-11-02 11:23 ` David Symonds
2007-11-02 20:03 ` Blake Ramsdell [this message]
2007-11-03 0:00 ` [PATCH] Removed OLD_ICONV in favor of checking _LIBICONV_VERSION directly Blake Ramsdell
2007-11-03 0:07 ` Junio C Hamano
2007-11-03 0:21 ` Blake Ramsdell
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=985966520711021303g905f638y2056219c22e5edeb@mail.gmail.com \
--to=blaker@gmail.com \
--cc=dsymonds@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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).