From 18a5a77bacd76d5720b783af93fe6704d215dc78 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 2 Mar 2009 12:54:35 +0100 Subject: [PATCH] iphlpapi: Remove the no longer needed getNumTcpEntries function. --- dlls/iphlpapi/ipstats.c | 16 ++++++---------- dlls/iphlpapi/ipstats.h | 3 --- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/dlls/iphlpapi/ipstats.c b/dlls/iphlpapi/ipstats.c index 103ef454d84..c7c08fdc880 100644 --- a/dlls/iphlpapi/ipstats.c +++ b/dlls/iphlpapi/ipstats.c @@ -693,6 +693,7 @@ DWORD getTCPStats(MIB_TCPSTATS *stats) #else FILE *fp; + MIB_TCPTABLE *tcp_table; if (!stats) return ERROR_INVALID_PARAMETER; @@ -772,7 +773,11 @@ DWORD getTCPStats(MIB_TCPSTATS *stats) stats->dwOutRsts = strtoul(ptr, &endPtr, 10); ptr = endPtr; } - stats->dwNumConns = getNumTcpEntries(); + if (!AllocateAndGetTcpTableFromStack( &tcp_table, FALSE, GetProcessHeap(), 0 )) + { + stats->dwNumConns = tcp_table->dwNumEntries; + HeapFree( GetProcessHeap(), 0, tcp_table ); + } } } fclose(fp); @@ -1565,15 +1570,6 @@ DWORD WINAPI AllocateAndGetUdpTableFromStack(PMIB_UDPTABLE *ppUdpTable, BOOL bOr } -DWORD getNumTcpEntries(void) -{ -#if defined(HAVE_SYS_SYSCTL_H) && defined(HAVE_NETINET_IN_PCB_H) - return getNumWithOneHeader ("net.inet.tcp.pcblist"); -#else - return getNumWithOneHeader ("/proc/net/tcp"); -#endif -} - static MIB_TCPTABLE *append_tcp_row( HANDLE heap, DWORD flags, MIB_TCPTABLE *table, DWORD *count, const MIB_TCPROW *row ) { diff --git a/dlls/iphlpapi/ipstats.h b/dlls/iphlpapi/ipstats.h index 2c829819861..871fcec26ae 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 TCP state table. */ -DWORD getNumTcpEntries(void); - DWORD WINAPI AllocateAndGetUdpTableFromStack(PMIB_UDPTABLE *ppUdpTable, BOOL bOrder, HANDLE heap, DWORD flags); DWORD WINAPI AllocateAndGetTcpTableFromStack(PMIB_TCPTABLE *ppTcpTable, BOOL bOrder, HANDLE heap, DWORD flags); DWORD WINAPI AllocateAndGetIpNetTableFromStack(PMIB_IPNETTABLE *ppIpNetTable, BOOL bOrder, HANDLE heap, DWORD flags);