Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/librumpuser Since SA_SETLEN() is used only for sockaddr_...



details:   https://anonhg.NetBSD.org/src/rev/56123e34e64d
branches:  trunk
changeset: 782913:56123e34e64d
user:      pooka <pooka%NetBSD.org@localhost>
date:      Mon Nov 26 16:30:14 2012 +0000

description:
Since SA_SETLEN() is used only for sockaddr_in, convert it to SIN_SETLEN()
to avoid compiler whining on breaking strict aliasing rules.

diffstat:

 lib/librumpuser/rumpuser_port.h |  6 +++---
 lib/librumpuser/sp_common.c     |  4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diffs (39 lines):

diff -r 2107ad1d0911 -r 56123e34e64d lib/librumpuser/rumpuser_port.h
--- a/lib/librumpuser/rumpuser_port.h   Mon Nov 26 16:22:21 2012 +0000
+++ b/lib/librumpuser/rumpuser_port.h   Mon Nov 26 16:30:14 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rumpuser_port.h,v 1.6 2012/11/22 21:23:08 pooka Exp $  */
+/*     $NetBSD: rumpuser_port.h,v 1.7 2012/11/26 16:30:14 pooka Exp $  */
 
 /*
  * Portability header for non-NetBSD platforms.
@@ -102,9 +102,9 @@
 #endif
 
 #if defined(__linux__) || defined(__sun__)
-#define SA_SETLEN(a,b)
+#define SIN_SETLEN(a,b)
 #else /* BSD */
-#define SA_SETLEN(_sa_, _len_) ((struct sockaddr *)_sa_)->sa_len = _len_
+#define SIN_SETLEN(_sin_, _len_) _sin_.sin_len = _len_
 #endif
 
 #ifndef __predict_true
diff -r 2107ad1d0911 -r 56123e34e64d lib/librumpuser/sp_common.c
--- a/lib/librumpuser/sp_common.c       Mon Nov 26 16:22:21 2012 +0000
+++ b/lib/librumpuser/sp_common.c       Mon Nov 26 16:30:14 2012 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: sp_common.c,v 1.34 2012/11/18 19:29:40 pooka Exp $    */
+/*      $NetBSD: sp_common.c,v 1.35 2012/11/26 16:30:14 pooka Exp $    */
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -546,7 +546,7 @@
        int port;
 
        memset(&sin, 0, sizeof(sin));
-       SA_SETLEN(&sin, sizeof(sin));
+       SIN_SETLEN(sin, sizeof(sin));
        sin.sin_family = AF_INET;
 
        p = strchr(addr, ':');



Home | Main Index | Thread Index | Old Index