From 37a6a0bb3efc1433609c3d17f5b15c9fb83864a6 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 11 Nov 2005 22:04:11 +0000 Subject: Moved the sockaddr_storage definition to lib/sockaddr.h and only include that in files that actually need the struct. --- lib/sockaddr.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 lib/sockaddr.h (limited to 'lib/sockaddr.h') diff --git a/lib/sockaddr.h b/lib/sockaddr.h new file mode 100644 index 000000000..938d20b20 --- /dev/null +++ b/lib/sockaddr.h @@ -0,0 +1,36 @@ +#ifndef __SOCKADDR_H +#define __SOCKADDR_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2005, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * $Id$ + ***************************************************************************/ + +#include "setup.h" + +#ifndef HAVE_STRUCT_SOCKADDR_STORAGE +struct sockaddr_storage + { + char buffer[256]; /* this should be big enough to fit a lot */ + }; +#endif + + +#endif /* __SOCKADDR_H */ -- cgit v1.2.1 From a5da1219bb2b7a01f0e2ea2f6548e845c1eb7038 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 12 Nov 2005 22:10:42 +0000 Subject: Reversed the logic for sockaddr_storage and made our own Curl_sockaddr_storage struct instead to use. --- lib/sockaddr.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lib/sockaddr.h') diff --git a/lib/sockaddr.h b/lib/sockaddr.h index 938d20b20..1d6a1f464 100644 --- a/lib/sockaddr.h +++ b/lib/sockaddr.h @@ -26,11 +26,13 @@ #include "setup.h" #ifndef HAVE_STRUCT_SOCKADDR_STORAGE -struct sockaddr_storage - { - char buffer[256]; /* this should be big enough to fit a lot */ - }; +struct Curl_sockaddr_storage { + struct sockaddr_storage buffer; +} +#else +struct Curl_sockaddr_storage { + char buffer[256]; /* this should be big enough to fit a lot */ +}; #endif - #endif /* __SOCKADDR_H */ -- cgit v1.2.1 From 9ef7a134037f4f180298c4f6ded9f843085a8102 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 12 Nov 2005 22:12:42 +0000 Subject: oops --- lib/sockaddr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/sockaddr.h') diff --git a/lib/sockaddr.h b/lib/sockaddr.h index 1d6a1f464..e5c546831 100644 --- a/lib/sockaddr.h +++ b/lib/sockaddr.h @@ -25,7 +25,7 @@ #include "setup.h" -#ifndef HAVE_STRUCT_SOCKADDR_STORAGE +#ifdef HAVE_STRUCT_SOCKADDR_STORAGE struct Curl_sockaddr_storage { struct sockaddr_storage buffer; } -- cgit v1.2.1 From d58790af174d11d50541505c2f3fdebcc4911d96 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 12 Nov 2005 22:13:20 +0000 Subject: oops * 2 --- lib/sockaddr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/sockaddr.h') diff --git a/lib/sockaddr.h b/lib/sockaddr.h index e5c546831..78dad4d9e 100644 --- a/lib/sockaddr.h +++ b/lib/sockaddr.h @@ -28,7 +28,7 @@ #ifdef HAVE_STRUCT_SOCKADDR_STORAGE struct Curl_sockaddr_storage { struct sockaddr_storage buffer; -} +}; #else struct Curl_sockaddr_storage { char buffer[256]; /* this should be big enough to fit a lot */ -- cgit v1.2.1 From 4650732f4a8590c8f6a00566510f9cdd656397a7 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Mon, 18 May 2009 12:25:45 +0000 Subject: Update copyright year, to force CVS to update the $Id date string format --- lib/sockaddr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/sockaddr.h') diff --git a/lib/sockaddr.h b/lib/sockaddr.h index 78dad4d9e..47c01d6ab 100644 --- a/lib/sockaddr.h +++ b/lib/sockaddr.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2005, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms -- cgit v1.2.1 From 2309b4e330b96bc2e1f8e36b6184015e59544037 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 24 Mar 2010 11:02:54 +0100 Subject: remove the CVSish $Id$ lines --- lib/sockaddr.h | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/sockaddr.h') diff --git a/lib/sockaddr.h b/lib/sockaddr.h index 47c01d6ab..c69411b52 100644 --- a/lib/sockaddr.h +++ b/lib/sockaddr.h @@ -20,7 +20,6 @@ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * - * $Id$ ***************************************************************************/ #include "setup.h" -- cgit v1.2.1 From a8478fc8d3ee5ca8ad6264b18ca2896298c33a65 Mon Sep 17 00:00:00 2001 From: Marc Hoersken Date: Tue, 26 Jun 2012 07:27:02 +0200 Subject: sockaddr.h: Fixed dereferencing pointer breakin strict-aliasing Fixed warning: dereferencing pointer does break strict-aliasing rules by using a union inside the struct Curl_sockaddr_storage declaration. --- lib/sockaddr.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'lib/sockaddr.h') diff --git a/lib/sockaddr.h b/lib/sockaddr.h index c69411b52..440eb0a97 100644 --- a/lib/sockaddr.h +++ b/lib/sockaddr.h @@ -24,14 +24,19 @@ #include "setup.h" -#ifdef HAVE_STRUCT_SOCKADDR_STORAGE struct Curl_sockaddr_storage { - struct sockaddr_storage buffer; -}; + union { + struct sockaddr sa; + struct sockaddr_in sa_in; +#ifdef ENABLE_IPV6 + struct sockaddr_in6 sa_in6; +#endif +#ifdef HAVE_STRUCT_SOCKADDR_STORAGE + struct sockaddr_storage sa_stor; #else -struct Curl_sockaddr_storage { - char buffer[256]; /* this should be big enough to fit a lot */ -}; + char cbuf[256]; /* this should be big enough to fit a lot */ #endif + } buffer; +}; #endif /* __SOCKADDR_H */ -- cgit v1.2.1