Author: mladen.turk(a)jboss.com
Date: 2007-10-01 06:24:15 -0400 (Mon, 01 Oct 2007)
New Revision: 1070
Modified:
trunk/sight/native/os/windows/console.c
trunk/sight/native/os/windows/netadapter.c
trunk/sight/native/os/windows/tcpstat.c
trunk/sight/native/os/windows/udpstat.c
trunk/sight/native/os/windows/wmi.cpp
Log:
Use sight wrappers for malloc/calloc
Modified: trunk/sight/native/os/windows/console.c
===================================================================
--- trunk/sight/native/os/windows/console.c 2007-10-01 09:27:34 UTC (rev 1069)
+++ trunk/sight/native/os/windows/console.c 2007-10-01 10:24:15 UTC (rev 1070)
@@ -253,11 +253,12 @@
if (!con) {
return NULL;
}
- if (!(wBuf = calloc(1, MAX_CONSOLE_SIZE * sizeof(jchar)))) {
- throwAprMemoryException(_E, THROW_FMARK,
- apr_get_os_error());
+ if (!(wBuf = (jchar *)sight_calloc(_E,
+ MAX_CONSOLE_SIZE * sizeof(jchar),
+ THROW_FMARK))) {
return NULL;
}
+
if (!ReadConsoleW(con->hConI,
wBuf,
MAX_CONSOLE_SIZE,
Modified: trunk/sight/native/os/windows/netadapter.c
===================================================================
--- trunk/sight/native/os/windows/netadapter.c 2007-10-01 09:27:34 UTC (rev 1069)
+++ trunk/sight/native/os/windows/netadapter.c 2007-10-01 10:24:15 UTC (rev 1070)
@@ -270,9 +270,8 @@
ULONG outBufLen = 0;
UNREFERENCED_O;
- if (!(e = (net_adapter_enum_t *)calloc(1, sizeof(net_adapter_enum_t)))) {
- throwAprMemoryException(_E, THROW_FMARK,
- apr_get_os_error());
+ if (!(e = (net_adapter_enum_t *)sight_calloc(_E, sizeof(net_adapter_enum_t),
+ THROW_FMARK))) {
return 0;
}
@@ -283,10 +282,7 @@
throwAprException(_E, APR_FROM_OS_ERROR(rc));
goto cleanup;
}
- e->pInfo = (PIP_ADAPTER_INFO)malloc(outBufLen);
- if (!e->pInfo) {
- throwAprMemoryException(_E, THROW_FMARK,
- apr_get_os_error());
+ if (!(e->pInfo = (PIP_ADAPTER_INFO)sight_malloc(_E, outBufLen, THROW_FMARK))) {
goto cleanup;
}
// Make a second call to GetAdapters Addresses to get the
@@ -372,7 +368,7 @@
}
else if (!e->pCurrent->IfIndex) {
sprintf(buf, "net%d", e->devCounters[5]++);
- SET_IFIELD_S(0000, thiz, buf);
+ SET_IFIELD_S(0000, thiz, buf);
}
else
SET_IFIELD_S(0000, thiz, e->pCurrent->AdapterName);
Modified: trunk/sight/native/os/windows/tcpstat.c
===================================================================
--- trunk/sight/native/os/windows/tcpstat.c 2007-10-01 09:27:34 UTC (rev 1069)
+++ trunk/sight/native/os/windows/tcpstat.c 2007-10-01 10:24:15 UTC (rev 1070)
@@ -241,9 +241,9 @@
type = 0;
}
- if (!(e = (tcpconn_enum_t *)calloc(1, sizeof(tcpconn_enum_t)))) {
- throwAprMemoryException(_E, THROW_FMARK,
- apr_get_os_error());
+
+ if (!(e = (tcpconn_enum_t *)sight_calloc(_E, sizeof(tcpconn_enum_t),
+ THROW_FMARK))) {
return 0;
}
e->type = type;
@@ -380,7 +380,7 @@
strcpy(las, inet_ntoa(ial));
strcpy(ras, inet_ntoa(iar));
lp = ntohs((unsigned short)(0x0000FFFF &
e->p4->table[index].dwLocalPort));
- rp = ntohs((unsigned short)(0x0000FFFF &
e->p4->table[index].dwRemotePort));
+ rp = ntohs((unsigned short)(0x0000FFFF &
e->p4->table[index].dwRemotePort));
state = e->p4->table[index].dwState;
pid = e->p4->table[index].dwOwningPid;
cts = litime_to_ms(&(e->p4->table[index].liCreateTimestamp));
Modified: trunk/sight/native/os/windows/udpstat.c
===================================================================
--- trunk/sight/native/os/windows/udpstat.c 2007-10-01 09:27:34 UTC (rev 1069)
+++ trunk/sight/native/os/windows/udpstat.c 2007-10-01 10:24:15 UTC (rev 1070)
@@ -170,9 +170,8 @@
type = 0;
}
- if (!(e = (udpconn_enum_t *)calloc(1, sizeof(udpconn_enum_t)))) {
- throwAprMemoryException(_E, THROW_FMARK,
- apr_get_os_error());
+ if (!(e = (udpconn_enum_t *)sight_calloc(_E, sizeof(udpconn_enum_t),
+ THROW_FMARK))) {
return 0;
}
e->type = type;
Modified: trunk/sight/native/os/windows/wmi.cpp
===================================================================
--- trunk/sight/native/os/windows/wmi.cpp 2007-10-01 09:27:34 UTC (rev 1069)
+++ trunk/sight/native/os/windows/wmi.cpp 2007-10-01 10:24:15 UTC (rev 1070)
@@ -99,10 +99,8 @@
cosec_inited = 1;
}
- wd = (wmi_data_t *)calloc(1, sizeof(wmi_data_t));
- if (!wd) {
- throwAprMemoryException(_E, THROW_FMARK,
- apr_get_os_error());
+ if (!(wd = (wmi_data_t *)sight_calloc(_E, sizeof(wmi_data_t),
+ THROW_FMARK))) {
return NULL;
}
hres = CoCreateInstance(