harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r574370 - /harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c
Date Mon, 10 Sep 2007 20:57:21 GMT
Author: hindessm
Date: Mon Sep 10 13:57:20 2007
New Revision: 574370

URL: http://svn.apache.org/viewvc?rev=574370&view=rev
Log:
Applying corresponding changes to those recently applied to
OSNetworkSystemLinux.c.

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c?rev=574370&r1=574369&r2=574370&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c
Mon Sep 10 13:57:20 2007
@@ -214,6 +214,7 @@
  */
 JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_isReachableByICMPImpl
   (JNIEnv * env, jobject clz, jobject address,jobject localaddr, jint ttl, jint timeout){
+  PORT_ACCESS_FROM_ENV (env);
   struct sockaddr_in dest,source,local;
   struct ICMPHeader* send_buf = 0;
   struct IPHeader* recv_buf = 0;
@@ -262,9 +263,12 @@
   }
   
   // set basic send and recv buf
-  send_buf = (struct ICMPHeader*)malloc(sizeof(char)*ICMP_SIZE);
-  recv_buf = (struct IPHeader*)malloc(sizeof(char)*PACKET_SIZE);
-  if (NULL == send_buf || NULL == recv_buf){
+  send_buf = (struct ICMPHeader*)hymem_allocate_memory(sizeof(char)*ICMP_SIZE);
+  if (NULL == send_buf) {
+	  goto cleanup;
+  }
+  recv_buf = (struct IPHeader*)hymem_allocate_memory(sizeof(char)*PACKET_SIZE);
+  if (NULL == recv_buf){
 	  goto cleanup;
   }
   set_icmp_packet(send_buf, ICMP_SIZE);
@@ -273,7 +277,7 @@
             (struct sockaddr*)&dest, sizeof(dest))){
 	  goto cleanup;
   }
-  fdset_read = (fd_set *)malloc(sizeof (struct fd_set));
+  fdset_read = (fd_set *)hymem_allocate_memory(sizeof (struct fd_set));
   if (NULL == fdset_read){
   	  goto cleanup;
   }
@@ -304,9 +308,9 @@
   }
   ret = REACHABLE;
 cleanup:
-  free(fdset_read);
-  free(send_buf);
-  free(recv_buf);
+  hymem_allocate_memory(fdset_read);
+  hymem_allocate_memory(send_buf);
+  hymem_allocate_memory(recv_buf);
   WSACleanup();	 
   return ret;
 }
@@ -314,7 +318,7 @@
 // typical ip checksum
 unsigned short ip_checksum(unsigned short * buffer, int size)
 {
-	register unsigned short * buf = buffer;
+    register unsigned short * buf = buffer;
     register int bufleft = size;
     register unsigned long sum = 0;
     



Mime
View raw message