Alexandre Julliard : iphlpapi: Remove the no longer needed getNumUdpEntries function.

Alexandre Julliard julliard at winehq.org
Mon Mar 2 09:01:54 CST 2009


Module: wine
Branch: master
Commit: 3573c6497076e35d7a5111e4136156ae26a1ae89
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=3573c6497076e35d7a5111e4136156ae26a1ae89

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Mar  2 12:54:16 2009 +0100

iphlpapi: Remove the no longer needed getNumUdpEntries function.

---

 dlls/iphlpapi/ipstats.c |   16 +++++++---------
 dlls/iphlpapi/ipstats.h |    3 ---
 2 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/dlls/iphlpapi/ipstats.c b/dlls/iphlpapi/ipstats.c
index 5ce373f..103ef45 100644
--- a/dlls/iphlpapi/ipstats.c
+++ b/dlls/iphlpapi/ipstats.c
@@ -793,6 +793,7 @@ DWORD getUDPStats(MIB_UDPSTATS *stats)
   int mib[] = {CTL_NET, PF_INET, IPPROTO_UDP, UDPCTL_STATS};
 #define MIB_LEN (sizeof(mib) / sizeof(mib[0]))
   struct udpstat udp_stat;
+  MIB_UDPTABLE *udp_table;
   size_t needed;
   if (!stats)
       return ERROR_INVALID_PARAMETER;
@@ -809,7 +810,12 @@ DWORD getUDPStats(MIB_UDPSTATS *stats)
   stats->dwOutDatagrams = udp_stat.udps_opackets;
   stats->dwNoPorts = udp_stat.udps_noport;
   stats->dwInErrors = udp_stat.udps_hdrops + udp_stat.udps_badsum + udp_stat.udps_fullsock + udp_stat.udps_badlen;
-  stats->dwNumAddrs = getNumUdpEntries();
+  if (!AllocateAndGetUdpTableFromStack( &udp_table, FALSE, GetProcessHeap(), 0 ))
+  {
+      stats->dwNumAddrs = udp_table->dwNumEntries;
+      HeapFree( GetProcessHeap(), 0, udp_table );
+  }
+  else stats->dwNumAddrs = 0;
 
   return NO_ERROR;
 #else
@@ -1453,14 +1459,6 @@ done:
     return ret;
 }
 
-DWORD getNumUdpEntries(void)
-{
-#if defined(HAVE_SYS_SYSCTL_H) && defined(HAVE_NETINET_IN_PCB_H)
-   return getNumWithOneHeader ("net.inet.udp.pcblist");
-#else
-  return getNumWithOneHeader("/proc/net/udp");
-#endif
-}
 
 static MIB_UDPTABLE *append_udp_row( HANDLE heap, DWORD flags, MIB_UDPTABLE *table,
                                      DWORD *count, const MIB_UDPROW *row )
diff --git a/dlls/iphlpapi/ipstats.h b/dlls/iphlpapi/ipstats.h
index 88c4839..2c82981 100644
--- a/dlls/iphlpapi/ipstats.h
+++ b/dlls/iphlpapi/ipstats.h
@@ -55,9 +55,6 @@ DWORD getUDPStats(MIB_UDPSTATS *stats);
 /* Returns the number of entries in the route table. */
 DWORD getNumRoutes(void);
 
-/* Returns the number of entries in the UDP state table. */
-DWORD getNumUdpEntries(void);
-
 /* Returns the number of entries in the TCP state table. */
 DWORD getNumTcpEntries(void);
 




More information about the wine-cvs mailing list