git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: strbuf name conflict on Mac OS

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Mar 31, 2009, 20:24 UTC
Message-ID
<alpine.DEB.1.00.0903312222440.6616@intel-tinevez-2-302>
In-Reply-To
<E5D92A5D-B2CC-44CE-B117-0BB88C0E663E@gmail.com>
Hi,
On Tue, 31 Mar 2009, Joshua Juran wrote:
Show 24 quoted lines
> Apple's OpenTransport.h from Universal Interfaces 3.4.2 defines its own struct
> strbuf, with which git's collides.
> 
> Since OpenTransport.h also defines some POSIX constants (such as O_NONBLOCK)
> as enums, it's necessary to include OpenTransport.h from fcntl.h (and other
> affected headers) so as to control the order in which the definitions appear
> in the translation unit.
> 
> This is the minimal patch:
> 
> 
> diff --git a/strbuf.h b/strbuf.h
> index 89bd36e..b8f380e 100644
> --- a/strbuf.h
> +++ b/strbuf.h
> @@ -40,6 +40,8 @@
> 
> #include <assert.h>
> 
> +#define strbuf git_strbuf
> +
> extern char strbuf_slopbuf[];
> struct strbuf {
>        size_t alloc;
How about this instead?
-- snip --
diff --git a/Makefile b/Makefile
index 32d6782..370c2d9 100644
--- a/Makefile
+++ b/Makefile
@@ -659,6 +659,7 @@ ifeq ($(uname_S),SCO_SV)
 	TAR = gtar
 endif
 ifeq ($(uname_S),Darwin)
+	BASIC_CFLAGS += -Dstrbuf=git_strbuf
 	NEEDS_SSL_WITH_CRYPTO = YesPlease
 	NEEDS_LIBICONV = YesPlease
 	ifeq ($(shell expr "$(uname_R)" : '[15678]\.'),2)
-- snap --

No need to let other platforms (and the C source) suffer...

Ciao,
Dscho
Previous: Joshua JuranNext: Jay Soffian
Message 2 of 5 in “strbuf name conflict on Mac OS”
  1. Joshua JuranMar 31, 2009
  2. Johannes SchindelinMar 31, 2009
  3. Jay SoffianMar 31, 2009
  4. Joshua JuranMar 31, 2009
  5. Brian GernhardtMar 31, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.