libfreerdp-utils: replace all calls to deprecated function xzalloc

This commit is contained in:
Marc-André Moreau 2012-11-21 19:22:41 -05:00
parent 4e8ac78836
commit b2c3ca8cc4
23 changed files with 171 additions and 64 deletions

View File

@ -220,7 +220,8 @@ void test_ntlm_compute_ntlm_v2_response(void)
ntlm_set_username(ntlm, username);
ntlm_set_domain(ntlm, domain);
ntlm->av_pairs->Timestamp.value = xzalloc(8);
ntlm->av_pairs->Timestamp.value = malloc(8);
memset(ntlm->av_pairs->Timestamp.value, 0, 8);
ntlm->av_pairs->Timestamp.length = 8;
memcpy(ntlm->timestamp, timestamp, 8);

View File

@ -26,6 +26,8 @@
#include <stdio.h>
#include <string.h>
#include <winpr/crt.h>
#include <openssl/pem.h>
#include <openssl/rsa.h>
@ -221,7 +223,8 @@ rdpX509CertChain* certificate_new_x509_certificate_chain(UINT32 count)
x509_cert_chain = (rdpX509CertChain*) malloc(sizeof(rdpX509CertChain));
x509_cert_chain->count = count;
x509_cert_chain->array = (rdpCertBlob*) xzalloc(sizeof(rdpCertBlob) * count);
x509_cert_chain->array = (rdpCertBlob*) malloc(sizeof(rdpCertBlob) * count);
ZeroMemory(x509_cert_chain->array, sizeof(rdpCertBlob) * count);
return x509_cert_chain;
}
@ -499,7 +502,8 @@ rdpRsaKey* key_new(const char* keyfile)
RSA* rsa;
rdpRsaKey* key;
key = (rdpRsaKey*) xzalloc(sizeof(rdpRsaKey));
key = (rdpRsaKey*) malloc(sizeof(rdpRsaKey));
ZeroMemory(key, sizeof(rdpRsaKey));
if (key == NULL)
return NULL;
@ -591,7 +595,8 @@ rdpCertificate* certificate_new()
{
rdpCertificate* certificate;
certificate = (rdpCertificate*) xzalloc(sizeof(rdpCertificate));
certificate = (rdpCertificate*) malloc(sizeof(rdpCertificate));
ZeroMemory(certificate, sizeof(rdpCertificate));
if (certificate != NULL)
{

View File

@ -29,6 +29,8 @@
#include "connection.h"
#include "extension.h"
#include <winpr/crt.h>
#include <freerdp/freerdp.h>
#include <freerdp/errorcodes.h>
#include <freerdp/utils/memory.h>
@ -233,7 +235,9 @@ void freerdp_context_new(freerdp* instance)
instance->update = rdp->update;
instance->settings = rdp->settings;
instance->context = (rdpContext*) xzalloc(instance->context_size);
instance->context = (rdpContext*) malloc(instance->context_size);
ZeroMemory(instance->context, instance->context_size);
instance->context->graphics = graphics_new(instance->context);
instance->context->instance = instance;
instance->context->rdp = rdp;
@ -285,7 +289,8 @@ freerdp* freerdp_new()
{
freerdp* instance;
instance = (freerdp*) xzalloc(sizeof(freerdp));
instance = (freerdp*) malloc(sizeof(freerdp));
ZeroMemory(instance, sizeof(freerdp));
if (instance != NULL)
{

View File

@ -21,6 +21,8 @@
#include "config.h"
#endif
#include <winpr/crt.h>
#include <freerdp/utils/memory.h>
#include <freerdp/graphics.h>
@ -201,23 +203,28 @@ rdpGraphics* graphics_new(rdpContext* context)
{
rdpGraphics* graphics;
graphics = (rdpGraphics*) xzalloc(sizeof(rdpGraphics));
graphics = (rdpGraphics*) malloc(sizeof(rdpGraphics));
if (graphics != NULL)
{
ZeroMemory(graphics, sizeof(rdpGraphics));
graphics->context = context;
graphics->Bitmap_Prototype = (rdpBitmap*) xzalloc(sizeof(rdpBitmap));
graphics->Bitmap_Prototype = (rdpBitmap*) malloc(sizeof(rdpBitmap));
ZeroMemory(graphics->Bitmap_Prototype, sizeof(rdpBitmap));
graphics->Bitmap_Prototype->size = sizeof(rdpBitmap);
graphics->Bitmap_Prototype->New = Bitmap_New;
graphics->Bitmap_Prototype->Free = Bitmap_Free;
graphics->Pointer_Prototype = (rdpPointer*) xzalloc(sizeof(rdpPointer));
graphics->Pointer_Prototype = (rdpPointer*) malloc(sizeof(rdpPointer));
ZeroMemory(graphics->Pointer_Prototype, sizeof(rdpPointer));
graphics->Pointer_Prototype->size = sizeof(rdpPointer);
graphics->Pointer_Prototype->New = Pointer_New;
graphics->Pointer_Prototype->Free = Pointer_Free;
graphics->Glyph_Prototype = (rdpGlyph*) xzalloc(sizeof(rdpGlyph));
graphics->Glyph_Prototype = (rdpGlyph*) malloc(sizeof(rdpGlyph));
ZeroMemory(graphics->Glyph_Prototype, sizeof(rdpGlyph));
graphics->Glyph_Prototype->size = sizeof(rdpGlyph);
graphics->Glyph_Prototype->New = Glyph_New;
graphics->Glyph_Prototype->Free = Glyph_Free;

View File

@ -21,6 +21,8 @@
#include "config.h"
#endif
#include <winpr/crt.h>
#include <freerdp/input.h>
#include "input.h"
@ -423,11 +425,11 @@ rdpInput* input_new(rdpRdp* rdp)
{
rdpInput* input;
input = (rdpInput*) xzalloc(sizeof(rdpInput));
input = (rdpInput*) malloc(sizeof(rdpInput));
if (input != NULL)
{
ZeroMemory(input, sizeof(rdpInput));
}
return input;

View File

@ -21,6 +21,8 @@
#include "config.h"
#endif
#include <winpr/crt.h>
#include "redirection.h"
#include "certificate.h"
@ -899,10 +901,12 @@ rdpLicense* license_new(rdpRdp* rdp)
{
rdpLicense* license;
license = (rdpLicense*) xzalloc(sizeof(rdpLicense));
license = (rdpLicense*) malloc(sizeof(rdpLicense));
if (license != NULL)
{
ZeroMemory(license, sizeof(rdpLicense));
license->rdp = rdp;
license->state = LICENSE_STATE_AWAIT;
//license->certificate = certificate_new(rdp);

View File

@ -21,6 +21,8 @@
#include "config.h"
#endif
#include <winpr/crt.h>
#include "gcc.h"
#include "mcs.h"
@ -814,10 +816,12 @@ rdpMcs* mcs_new(rdpTransport* transport)
{
rdpMcs* mcs;
mcs = (rdpMcs*) xzalloc(sizeof(rdpMcs));
mcs = (rdpMcs*) malloc(sizeof(rdpMcs));
if (mcs != NULL)
{
ZeroMemory(mcs, sizeof(rdpMcs));
mcs->transport = transport;
mcs_init_domain_parameters(&mcs->targetParameters, 34, 2, 0, 0xFFFF);
mcs_init_domain_parameters(&mcs->minimumParameters, 1, 1, 1, 0x420);

View File

@ -21,7 +21,10 @@
#include "config.h"
#endif
#include <winpr/crt.h>
#include "certificate.h"
#include <freerdp/utils/tcp.h>
#include "peer.h"
@ -364,7 +367,9 @@ void freerdp_peer_context_new(freerdp_peer* client)
client->update = rdp->update;
client->settings = rdp->settings;
client->context = (rdpContext*) xzalloc(client->context_size);
client->context = (rdpContext*) malloc(client->context_size);
ZeroMemory(client->context, client->context_size);
client->context->rdp = rdp;
client->context->peer = client;

View File

@ -21,6 +21,8 @@
#include "config.h"
#endif
#include <winpr/crt.h>
#include "rdp.h"
#include "info.h"
@ -914,10 +916,12 @@ rdpRdp* rdp_new(freerdp* instance)
{
rdpRdp* rdp;
rdp = (rdpRdp*) xzalloc(sizeof(rdpRdp));
rdp = (rdpRdp*) malloc(sizeof(rdpRdp));
if (rdp != NULL)
{
ZeroMemory(rdp, sizeof(rdpRdp));
rdp->instance = instance;
rdp->settings = freerdp_settings_new((void*) instance);

View File

@ -21,6 +21,8 @@
#include "config.h"
#endif
#include <winpr/crt.h>
#include "connection.h"
#include "redirection.h"
@ -147,7 +149,8 @@ BOOL rdp_recv_server_redirection_pdu(rdpRdp* rdp, STREAM* s)
stream_read_UINT32(s, redirection->targetNetAddressesCount);
count = redirection->targetNetAddressesCount;
redirection->targetNetAddresses = (rdpString*) xzalloc(count * sizeof(rdpString));
redirection->targetNetAddresses = (rdpString*) malloc(count * sizeof(rdpString));
ZeroMemory(redirection->targetNetAddresses, count * sizeof(rdpString));
for (i = 0; i < (int) count; i++)
{
@ -182,11 +185,11 @@ rdpRedirection* redirection_new()
{
rdpRedirection* redirection;
redirection = (rdpRedirection*) xzalloc(sizeof(rdpRedirection));
redirection = (rdpRedirection*) malloc(sizeof(rdpRedirection));
if (redirection != NULL)
{
ZeroMemory(redirection, sizeof(rdpRedirection));
}
return redirection;

View File

@ -244,10 +244,12 @@ rdpTcp* tcp_new(rdpSettings* settings)
{
rdpTcp* tcp;
tcp = (rdpTcp*) xzalloc(sizeof(rdpTcp));
tcp = (rdpTcp*) malloc(sizeof(rdpTcp));
if (tcp != NULL)
{
ZeroMemory(tcp, sizeof(rdpTcp));
tcp->sockfd = -1;
tcp->settings = settings;
}

View File

@ -21,6 +21,8 @@
#include "config.h"
#endif
#include <winpr/crt.h>
#include "update.h"
#include "surface.h"
@ -622,20 +624,32 @@ rdpUpdate* update_new(rdpRdp* rdp)
{
rdpUpdate* update;
update = (rdpUpdate*) xzalloc(sizeof(rdpUpdate));
update = (rdpUpdate*) malloc(sizeof(rdpUpdate));
if (update != NULL)
{
OFFSCREEN_DELETE_LIST* deleteList;
update->bitmap_update.count = 64;
update->bitmap_update.rectangles = (BITMAP_DATA*) xzalloc(sizeof(BITMAP_DATA) * update->bitmap_update.count);
ZeroMemory(update, sizeof(rdpUpdate));
update->pointer = xnew(rdpPointerUpdate);
update->primary = xnew(rdpPrimaryUpdate);
update->secondary = xnew(rdpSecondaryUpdate);
update->altsec = xnew(rdpAltSecUpdate);
update->window = xnew(rdpWindowUpdate);
update->bitmap_update.count = 64;
update->bitmap_update.rectangles = (BITMAP_DATA*) malloc(sizeof(BITMAP_DATA) * update->bitmap_update.count);
ZeroMemory(update->bitmap_update.rectangles, sizeof(BITMAP_DATA) * update->bitmap_update.count);
update->pointer = (rdpPointerUpdate*) malloc(sizeof(rdpPointerUpdate));
ZeroMemory(update->pointer, sizeof(rdpPointerUpdate));
update->primary = (rdpPrimaryUpdate*) malloc(sizeof(rdpPrimaryUpdate));
ZeroMemory(update->primary, sizeof(rdpPrimaryUpdate));
update->secondary = (rdpSecondaryUpdate*) malloc(sizeof(rdpSecondaryUpdate));
ZeroMemory(update->secondary, sizeof(rdpSecondaryUpdate));
update->altsec = (rdpAltSecUpdate*) malloc(sizeof(rdpAltSecUpdate));
ZeroMemory(update->altsec, sizeof(rdpAltSecUpdate));
update->window = (rdpWindowUpdate*) malloc(sizeof(rdpWindowUpdate));
ZeroMemory(update->window, sizeof(rdpWindowUpdate));
deleteList = &(update->altsec->create_offscreen_bitmap.deleteList);
deleteList->sIndices = 64;
@ -653,6 +667,7 @@ void update_free(rdpUpdate* update)
if (update != NULL)
{
OFFSCREEN_DELETE_LIST* deleteList;
deleteList = &(update->altsec->create_offscreen_bitmap.deleteList);
free(deleteList->indices);

View File

@ -22,6 +22,8 @@
#include "config.h"
#endif
#include <winpr/crt.h>
#include <freerdp/utils/rail.h>
#include <freerdp/utils/memory.h>
@ -179,7 +181,9 @@ void update_read_window_state_order(STREAM* s, WINDOW_ORDER_INFO* orderInfo, WIN
void update_read_window_icon_order(STREAM* s, WINDOW_ORDER_INFO* orderInfo, WINDOW_ICON_ORDER* window_icon)
{
window_icon->iconInfo = (ICON_INFO*) xzalloc(sizeof(ICON_INFO));
window_icon->iconInfo = (ICON_INFO*) malloc(sizeof(ICON_INFO));
ZeroMemory(window_icon->iconInfo, sizeof(ICON_INFO));
update_read_icon_info(s, window_icon->iconInfo); /* iconInfo (ICON_INFO) */
}

View File

@ -215,10 +215,12 @@ rdpCertificateData* certificate_data_new(char* hostname, char* fingerprint)
{
rdpCertificateData* certdata;
certdata = (rdpCertificateData*) xzalloc(sizeof(rdpCertificateData));
certdata = (rdpCertificateData*) malloc(sizeof(rdpCertificateData));
if (certdata != NULL)
{
ZeroMemory(certdata, sizeof(rdpCertificateData));
certdata->hostname = _strdup(hostname);
certdata->fingerprint = _strdup(fingerprint);
}
@ -240,10 +242,12 @@ rdpCertificateStore* certificate_store_new(rdpSettings* settings)
{
rdpCertificateStore* certificate_store;
certificate_store = (rdpCertificateStore*) xzalloc(sizeof(rdpCertificateStore));
certificate_store = (rdpCertificateStore*) malloc(sizeof(rdpCertificateStore));
if (certificate_store != NULL)
{
ZeroMemory(certificate_store, sizeof(rdpCertificateStore));
certificate_store->settings = settings;
certificate_store_init(certificate_store);
}

View File

@ -21,6 +21,8 @@
#include "config.h"
#endif
#include <winpr/crt.h>
#include <freerdp/crypto/crypto.h>
CryptoSha1 crypto_sha1_init(void)
@ -318,7 +320,9 @@ char* crypto_cert_fingerprint(X509* xcert)
X509_digest(xcert, EVP_sha1(), fp, &fp_len);
fp_buffer = (char*) xzalloc(3 * fp_len);
fp_buffer = (char*) malloc(3 * fp_len);
ZeroMemory(fp_buffer, 3 * fp_len);
p = fp_buffer;
for (i = 0; i < (int) (fp_len - 1); i++)
@ -339,16 +343,17 @@ char* crypto_print_name(X509_NAME* name)
if (X509_NAME_print_ex(outBIO, name, 0, XN_FLAG_ONELINE) > 0)
{
unsigned long size = BIO_number_written(outBIO);
buffer = xzalloc(size + 1);
buffer = malloc(size + 1);
ZeroMemory(buffer, size + 1);
memset(buffer, 0, size + 1);
BIO_read(outBIO, buffer, size);
}
BIO_free(outBIO);
return buffer;
}
char* crypto_cert_subject(X509* xcert)
{
return crypto_print_name(X509_get_subject_name(xcert));

View File

@ -21,6 +21,8 @@
#include "config.h"
#endif
#include <winpr/crt.h>
#include <freerdp/utils/stream.h>
#include <freerdp/utils/memory.h>
@ -616,10 +618,12 @@ rdpTls* tls_new(rdpSettings* settings)
{
rdpTls* tls;
tls = (rdpTls*) xzalloc(sizeof(rdpTls));
tls = (rdpTls*) malloc(sizeof(rdpTls));
if (tls != NULL)
{
ZeroMemory(tls, sizeof(rdpTls));
SSL_load_error_strings();
SSL_library_init();

View File

@ -25,6 +25,8 @@
#include <string.h>
#include <stdlib.h>
#include <winpr/crt.h>
#include <freerdp/api.h>
#include <freerdp/freerdp.h>
#include <freerdp/constants.h>
@ -704,7 +706,8 @@ void gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits_co
surface_bits_command->width, surface_bits_command->height,
surface_bits_command->bitmapDataLength);
tile_bitmap = (char*) xzalloc(32);
tile_bitmap = (char*) malloc(32);
ZeroMemory(tile_bitmap, 32);
if (surface_bits_command->codecID == CODEC_ID_REMOTEFX)
{
@ -880,7 +883,8 @@ int gdi_init(freerdp* instance, UINT32 flags, BYTE* buffer)
rdpGdi* gdi;
rdpCache* cache;
gdi = (rdpGdi*) xzalloc(sizeof(rdpGdi));
gdi = (rdpGdi*) malloc(sizeof(rdpGdi));
ZeroMemory(gdi, sizeof(rdpGdi));
instance->context->gdi = gdi;
cache = instance->context->cache;

View File

@ -21,6 +21,8 @@
#include "config.h"
#endif
#include <winpr/crt.h>
#include <freerdp/utils/stream.h>
#include <freerdp/utils/memory.h>
#include <freerdp/utils/hexdump.h>
@ -76,21 +78,25 @@ rdpIconCache* icon_cache_new(rdpRail* rail)
{
rdpIconCache* cache;
cache = (rdpIconCache*) xzalloc(sizeof(rdpIconCache));
cache = (rdpIconCache*) malloc(sizeof(rdpIconCache));
if (cache != NULL)
{
int i;
ZeroMemory(cache, sizeof(rdpIconCache));
cache->rail = rail;
cache->numCaches = (BYTE) rail->settings->RemoteAppNumIconCacheEntries;
cache->numCacheEntries = rail->settings->RemoteAppNumIconCacheEntries;
cache->caches = xzalloc(cache->numCaches * sizeof(WINDOW_ICON_CACHE));
cache->caches = malloc(cache->numCaches * sizeof(WINDOW_ICON_CACHE));
ZeroMemory(cache->caches, cache->numCaches * sizeof(WINDOW_ICON_CACHE));
for (i = 0; i < cache->numCaches; i++)
{
cache->caches[i].entries = xzalloc(cache->numCacheEntries * sizeof(rdpIconCache));
cache->caches[i].entries = malloc(cache->numCacheEntries * sizeof(rdpIconCache));
ZeroMemory(cache->caches[i].entries, cache->numCacheEntries * sizeof(rdpIconCache));
}
}

View File

@ -21,6 +21,8 @@
#include "config.h"
#endif
#include <winpr/crt.h>
#include <freerdp/utils/stream.h>
#include <freerdp/utils/memory.h>
@ -62,7 +64,9 @@ static void rail_WindowIcon(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, W
if (!window)
return ;
icon = (rdpIcon*) xzalloc(sizeof(rdpIcon));
icon = (rdpIcon*) malloc(sizeof(rdpIcon));
ZeroMemory(icon, sizeof(rdpIcon));
icon->entry = window_icon->iconInfo;
icon->big = (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_ICON_BIG) ? TRUE : FALSE;
@ -141,14 +145,18 @@ rdpRail* rail_new(rdpSettings* settings)
{
rdpRail* rail;
rail = (rdpRail*) xzalloc(sizeof(rdpRail));
rail = (rdpRail*) malloc(sizeof(rdpRail));
if (rail != NULL)
{
ZeroMemory(rail, sizeof(rdpRail));
rail->settings = settings;
rail->cache = icon_cache_new(rail);
rail->list = window_list_new(rail);
rail->clrconv = (CLRCONV*) xzalloc(sizeof(CLRCONV));
rail->clrconv = (CLRCONV*) malloc(sizeof(CLRCONV));
ZeroMemory(rail->clrconv, sizeof(CLRCONV));
}
return rail;

View File

@ -21,6 +21,8 @@
#include "config.h"
#endif
#include <winpr/crt.h>
#include <freerdp/utils/stream.h>
#include <freerdp/utils/memory.h>
@ -111,11 +113,13 @@ void window_list_create(rdpWindowList* list, WINDOW_ORDER_INFO* orderInfo, WINDO
return;
}
window = (rdpWindow*) xzalloc(sizeof(rdpWindow));
window = (rdpWindow*) malloc(sizeof(rdpWindow));
if (window == NULL)
return;
ZeroMemory(window, sizeof(rdpWindow));
window->windowId = orderInfo->windowId;
if (list->head == NULL)
@ -207,10 +211,12 @@ rdpWindowList* window_list_new(rdpRail* rail)
{
rdpWindowList* list;
list = (rdpWindowList*) xzalloc(sizeof(rdpWindowList));
list = (rdpWindowList*) malloc(sizeof(rdpWindowList));
if (list != NULL)
{
ZeroMemory(list, sizeof(rdpWindowList));
list->head = NULL;
list->tail = NULL;
list->rail = rail;

View File

@ -25,6 +25,8 @@
#include <stdlib.h>
#include <string.h>
#include <winpr/crt.h>
#ifndef _WIN32
#include <sys/time.h>
#else
@ -90,14 +92,18 @@ void pcap_add_record(rdpPcap* pcap, void* data, UINT32 length)
if (pcap->tail == NULL)
{
pcap->tail = (pcap_record*) xzalloc(sizeof(pcap_record));
pcap->tail = (pcap_record*) malloc(sizeof(pcap_record));
ZeroMemory(pcap->tail, sizeof(pcap_record));
pcap->head = pcap->tail;
pcap->record = pcap->head;
record = pcap->tail;
}
else
{
record = (pcap_record*) xzalloc(sizeof(pcap_record));
record = (pcap_record*) malloc(sizeof(pcap_record));
ZeroMemory(record, sizeof(pcap_record));
pcap->tail->next = record;
pcap->tail = record;
}
@ -154,17 +160,20 @@ rdpPcap* pcap_open(char* name, BOOL write)
{
rdpPcap* pcap;
FILE *pcap_fp = fopen(name, write ? "w+" : "r");
FILE* pcap_fp = fopen(name, write ? "w+" : "r");
if (pcap_fp == NULL)
{
perror("opening pcap dump");
return NULL;
}
pcap = (rdpPcap*) xzalloc(sizeof(rdpPcap));
pcap = (rdpPcap*) malloc(sizeof(rdpPcap));
if (pcap != NULL)
{
ZeroMemory(pcap, sizeof(rdpPcap));
pcap->name = name;
pcap->write = write;
pcap->record_count = 0;

View File

@ -25,6 +25,8 @@
#include <stdlib.h>
#include <string.h>
#include <winpr/crt.h>
#include <freerdp/utils/memory.h>
#include <freerdp/utils/stream.h>
@ -56,7 +58,8 @@ STREAM* stream_new(int size)
if (size != 0)
{
size = size > 0 ? size : 0x400;
stream->data = (BYTE*) xzalloc(size);
stream->data = (BYTE*) malloc(size);
ZeroMemory(stream->data, size);
stream->p = stream->data;
stream->size = size;
}

View File

@ -48,8 +48,7 @@ struct wait_obj
int attached;
};
struct wait_obj*
wait_obj_new(void)
struct wait_obj* wait_obj_new(void)
{
struct wait_obj* obj;
@ -61,6 +60,7 @@ wait_obj_new(void)
#else
obj->pipe_fd[0] = -1;
obj->pipe_fd[1] = -1;
if (pipe(obj->pipe_fd) < 0)
{
printf("wait_obj_new: pipe failed\n");
@ -89,8 +89,7 @@ struct wait_obj* wait_obj_new_with_fd(void* fd)
return obj;
}
void
wait_obj_free(struct wait_obj* obj)
void wait_obj_free(struct wait_obj* obj)
{
if (obj)
{
@ -121,8 +120,7 @@ wait_obj_free(struct wait_obj* obj)
}
}
int
wait_obj_is_set(struct wait_obj* obj)
int wait_obj_is_set(struct wait_obj* obj)
{
#ifdef _WIN32
return (WaitForSingleObject(obj->event, 0) == WAIT_OBJECT_0);
@ -139,8 +137,7 @@ wait_obj_is_set(struct wait_obj* obj)
#endif
}
void
wait_obj_set(struct wait_obj* obj)
void wait_obj_set(struct wait_obj* obj)
{
#ifdef _WIN32
SetEvent(obj->event);
@ -155,8 +152,7 @@ wait_obj_set(struct wait_obj* obj)
#endif
}
void
wait_obj_clear(struct wait_obj* obj)
void wait_obj_clear(struct wait_obj* obj)
{
#ifdef _WIN32
ResetEvent(obj->event);
@ -172,8 +168,7 @@ wait_obj_clear(struct wait_obj* obj)
#endif
}
int
wait_obj_select(struct wait_obj** listobj, int numobj, int timeout)
int wait_obj_select(struct wait_obj** listobj, int numobj, int timeout)
{
int index;
int status;
@ -207,9 +202,11 @@ wait_obj_select(struct wait_obj** listobj, int numobj, int timeout)
}
status = select(max + 1, &fds, 0, 0, ptime);
#else
HANDLE *hnds;
HANDLE* hnds;
hnds = (HANDLE*) malloc(sizeof(HANDLE) * (numobj + 1));
ZeroMemory(hnds, sizeof(HANDLE) * (numobj + 1));
hnds = (HANDLE *) xzalloc(sizeof(HANDLE) * (numobj + 1));
for (index = 0; index < numobj; index++)
{
hnds[index] = listobj[index]->event;