[quake3-commits] r1865 - trunk/code/qcommon

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun Feb 6 15:26:18 EST 2011


Author: thilo
Date: 2011-02-06 15:26:18 -0500 (Sun, 06 Feb 2011)
New Revision: 1865

Modified:
   trunk/code/qcommon/net_ip.c
   trunk/code/qcommon/q_shared.h
   trunk/code/qcommon/vm_x86_64_assembler.c
Log:
 - Hopefully fix (#3984) compiler errors on Solaris while not introducing too many new ones on the other platforms
 - With _BSD_SOURCE now explicitly defined bring back strdup to vm_x86_64_assembler.c


Modified: trunk/code/qcommon/net_ip.c
===================================================================
--- trunk/code/qcommon/net_ip.c	2011-02-06 20:10:43 UTC (rev 1864)
+++ trunk/code/qcommon/net_ip.c	2011-02-06 20:26:18 UTC (rev 1865)
@@ -50,6 +50,7 @@
 #	define EADDRNOTAVAIL	WSAEADDRNOTAVAIL
 #	define EAFNOSUPPORT		WSAEAFNOSUPPORT
 #	define ECONNRESET			WSAECONNRESET
+typedef u_long	ioctlarg_t;
 #	define socketError		WSAGetLastError( )
 
 static WSADATA	winsockdata;
@@ -85,6 +86,7 @@
 #	define SOCKET_ERROR			-1
 #	define closesocket			close
 #	define ioctlsocket			ioctl
+typedef int	ioctlarg_t;
 #	define socketError			errno
 
 #endif
@@ -831,7 +833,7 @@
 int NET_IPSocket( char *net_interface, int port, int *err ) {
 	SOCKET				newsocket;
 	struct sockaddr_in	address;
-	u_long				_true = 1;
+	ioctlarg_t			_true = 1;
 	int					i = 1;
 
 	*err = 0;
@@ -899,7 +901,7 @@
 int NET_IP6Socket( char *net_interface, int port, struct sockaddr_in6 *bindto, int *err ) {
 	SOCKET				newsocket;
 	struct sockaddr_in6	address;
-	u_long				_true = 1;
+	ioctlarg_t			_true = 1;
 
 	*err = 0;
 

Modified: trunk/code/qcommon/q_shared.h
===================================================================
--- trunk/code/qcommon/q_shared.h	2011-02-06 20:10:43 UTC (rev 1864)
+++ trunk/code/qcommon/q_shared.h	2011-02-06 20:26:18 UTC (rev 1865)
@@ -23,6 +23,14 @@
 #ifndef __Q_SHARED_H
 #define __Q_SHARED_H
 
+#ifndef _BSD_SOURCE
+  #define _BSD_SOURCE
+#endif
+
+#ifndef _POSIX_C_SOURCE
+  #define _POSIX_C_SOURCE 200112L
+#endif
+
 // q_shared.h -- included first by ALL program modules.
 // A user mod should never modify this file
 

Modified: trunk/code/qcommon/vm_x86_64_assembler.c
===================================================================
--- trunk/code/qcommon/vm_x86_64_assembler.c	2011-02-06 20:10:43 UTC (rev 1864)
+++ trunk/code/qcommon/vm_x86_64_assembler.c	2011-02-06 20:26:18 UTC (rev 1865)
@@ -241,15 +241,12 @@
 {
 	struct hashentry* h;
 	unsigned i = hashkey(label, -1U);
-	int labellen;
 	
 	i %= sizeof(labelhash)/sizeof(labelhash[0]);
 	h = malloc(sizeof(struct hashentry));
 	
-	labellen = strlen(label) + 1;
-	h->label = malloc(labellen);
-	memcpy(h->label, label, labellen);
-	
+	h->label = strdup(label);
+
 	h->address = address;
 	h->next = labelhash[i];
 	labelhash[i] = h;



More information about the quake3-commits mailing list