From: Erik Faye-Lund <kusmabite@googlemail.com>
To: msysgit@googlecode.com
Cc: git@vger.kernel.org, dotzenlabs@gmail.com,
Erik Faye-Lund <kusmabite@gmail.com>
Subject: [PATCH/RFC 04/11] compat: add inet_pton and inet_ntop prototypes
Date: Thu, 26 Nov 2009 00:39:11 +0000 [thread overview]
Message-ID: <1259195958-2372-5-git-send-email-kusmabite@gmail.com> (raw)
In-Reply-To: <1259195958-2372-4-git-send-email-kusmabite@gmail.com>
From: Mike Pape <dotzenlabs@gmail.com>
Windows doesn't have inet_pton and inet_ntop, so
add prototypes in git-compat-util.h for them.
At the same time include git-compat-util.h in
the sources for these functions, so they use the
network-wrappers from there on Windows.
Signed-off-by: Mike Pape <dotzenlabs@gmail.com>
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
---
Makefile | 2 ++
compat/inet_ntop.c | 6 +++---
compat/inet_pton.c | 8 +++++---
git-compat-util.h | 8 ++++++++
4 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile
index 70cee6d..3b01694 100644
--- a/Makefile
+++ b/Makefile
@@ -1227,9 +1227,11 @@ endif
endif
ifdef NO_INET_NTOP
LIB_OBJS += compat/inet_ntop.o
+ BASIC_CFLAGS += -DNO_INET_NTOP
endif
ifdef NO_INET_PTON
LIB_OBJS += compat/inet_pton.o
+ BASIC_CFLAGS += -DNO_INET_PTON
endif
ifdef NO_ICONV
diff --git a/compat/inet_ntop.c b/compat/inet_ntop.c
index f444982..e5b46a0 100644
--- a/compat/inet_ntop.c
+++ b/compat/inet_ntop.c
@@ -17,9 +17,9 @@
#include <errno.h>
#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
+
+#include "../git-compat-util.h"
+
#include <stdio.h>
#include <string.h>
diff --git a/compat/inet_pton.c b/compat/inet_pton.c
index 4078fc0..2ec995e 100644
--- a/compat/inet_pton.c
+++ b/compat/inet_pton.c
@@ -17,9 +17,9 @@
#include <errno.h>
#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
+
+#include "../git-compat-util.h"
+
#include <stdio.h>
#include <string.h>
@@ -41,7 +41,9 @@
*/
static int inet_pton4(const char *src, unsigned char *dst);
+#ifndef NO_IPV6
static int inet_pton6(const char *src, unsigned char *dst);
+#endif
/* int
* inet_pton4(src, dst)
diff --git a/git-compat-util.h b/git-compat-util.h
index 33a8e33..27fa601 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -340,6 +340,14 @@ static inline char *gitstrchrnul(const char *s, int c)
}
#endif
+#ifdef NO_INET_PTON
+int inet_pton(int af, const char *src, void *dst);
+#endif
+
+#ifdef NO_INET_NTOP
+const char *inet_ntop(int af, const void *src, char *dst, size_t size);
+#endif
+
extern void release_pack_memory(size_t, int);
extern char *xstrdup(const char *str);
--
1.6.5.rc2.7.g4f8d3
next prev parent reply other threads:[~2009-11-26 0:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-26 0:39 [PATCH/RFC 00/11] daemon-win32 Erik Faye-Lund
2009-11-26 0:39 ` [PATCH/RFC 01/11] mingw: add network-wrappers for daemon Erik Faye-Lund
2009-11-26 0:39 ` [PATCH/RFC 02/11] strbuf: add non-variadic function strbuf_vaddf() Erik Faye-Lund
2009-11-26 0:39 ` [PATCH/RFC 03/11] mingw: implement syslog Erik Faye-Lund
2009-11-26 0:39 ` Erik Faye-Lund [this message]
2009-11-26 0:39 ` [PATCH/RFC 05/11] inet_ntop: fix a couple of old-style decls Erik Faye-Lund
2009-11-26 0:39 ` [PATCH/RFC 06/11] run-command: add kill_async() and is_async_alive() Erik Faye-Lund
2009-11-26 0:39 ` [PATCH/RFC 07/11] run-command: support input-fd Erik Faye-Lund
2009-11-26 0:39 ` [PATCH/RFC 08/11] daemon: use explicit file descriptor Erik Faye-Lund
2009-11-26 0:39 ` [PATCH/RFC 09/11] daemon: use run-command api for async serving Erik Faye-Lund
2009-11-26 0:39 ` [PATCH/RFC 10/11] daemon: use full buffered mode for stderr Erik Faye-Lund
2009-11-26 0:39 ` [PATCH/RFC 11/11] mingw: compile git-daemon Erik Faye-Lund
2009-11-26 0:43 ` [PATCH/RFC 00/11] daemon-win32 Erik Faye-Lund
-- strict thread matches above, loose matches on Subject: below --
2009-11-26 0:44 Erik Faye-Lund
2009-11-26 0:44 ` [PATCH/RFC 01/11] mingw: add network-wrappers for daemon Erik Faye-Lund
2009-11-26 0:44 ` [PATCH/RFC 02/11] strbuf: add non-variadic function strbuf_vaddf() Erik Faye-Lund
2009-11-26 0:44 ` [PATCH/RFC 03/11] mingw: implement syslog Erik Faye-Lund
2009-11-26 0:44 ` [PATCH/RFC 04/11] compat: add inet_pton and inet_ntop prototypes Erik Faye-Lund
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=1259195958-2372-5-git-send-email-kusmabite@gmail.com \
--to=kusmabite@googlemail.com \
--cc=dotzenlabs@gmail.com \
--cc=git@vger.kernel.org \
--cc=kusmabite@gmail.com \
--cc=msysgit@googlecode.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).