use calloc instead of malloc/memset 0; bug 163472; r=Roland.Mainz@informatik.med

.uni-giessen.de, sr=darin
This commit is contained in:
brade%netscape.com 2002-08-21 13:14:32 +00:00
Родитель b6193d64e3
Коммит f90dfe3d0d
1 изменённых файлов: 4 добавлений и 8 удалений

Просмотреть файл

@ -160,10 +160,8 @@ nsSocketTransportService::Init(void)
// Create FDSET list used by PR_Poll(...)
//
if (!mSelectFDSet) {
mSelectFDSet = (PRPollDesc*)PR_Malloc(sizeof(PRPollDesc)*MAX_OPEN_CONNECTIONS);
if (mSelectFDSet) {
memset(mSelectFDSet, 0, sizeof(PRPollDesc)*MAX_OPEN_CONNECTIONS);
} else {
mSelectFDSet = (PRPollDesc*)PR_Calloc(MAX_OPEN_CONNECTIONS, sizeof(PRPollDesc));
if (!mSelectFDSet) {
rv = NS_ERROR_OUT_OF_MEMORY;
}
}
@ -173,10 +171,8 @@ nsSocketTransportService::Init(void)
// nsSocketTransport corresponding to each PRFileDesc* in the mSelectFDSet
//
if (NS_SUCCEEDED(rv) && !mActiveTransportList) {
mActiveTransportList = (nsSocketTransport**)PR_Malloc(sizeof(nsSocketTransport*)*MAX_OPEN_CONNECTIONS);
if (mActiveTransportList) {
memset(mActiveTransportList, 0, sizeof(nsSocketTransport*)*MAX_OPEN_CONNECTIONS);
} else {
mActiveTransportList = (nsSocketTransport**)PR_Calloc(MAX_OPEN_CONNECTIONS, sizeof(nsSocketTransport*));
if (!mActiveTransportList) {
rv = NS_ERROR_OUT_OF_MEMORY;
}
}