From 3f3ff971ecff9936cebafc813af9193b97bba89c Mon Sep 17 00:00:00 2001 From: Mikhail Gusarov Date: Thu, 6 May 2010 01:44:06 +0700 Subject: Replace X-allocation functions with their C89 counterparts The only remaining X-functions used in server are XNF*, the rest is converted to plain alloc/calloc/realloc/free/strdup. X* functions are still exported from server and x* macros are still defined in header file, so both ABI and API are not affected by this change. Signed-off-by: Mikhail Gusarov Reviewed-by: Peter Hutterer --- os/io.c | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'os/io.c') diff --git a/os/io.c b/os/io.c index 64b64ae75..833510239 100644 --- a/os/io.c +++ b/os/io.c @@ -215,8 +215,8 @@ ReadRequestFromClient(ClientPtr client) register ConnectionInputPtr aci = AvailableInput->input; if (aci->size > BUFWATERMARK) { - xfree(aci->buffer); - xfree(aci); + free(aci->buffer); + free(aci); } else { @@ -310,7 +310,7 @@ ReadRequestFromClient(ClientPtr client) /* make buffer bigger to accomodate request */ char *ibuf; - ibuf = (char *)xrealloc(oci->buffer, needed); + ibuf = (char *)realloc(oci->buffer, needed); if (!ibuf) { YieldControlDeath(); @@ -360,7 +360,7 @@ ReadRequestFromClient(ClientPtr client) { char *ibuf; - ibuf = (char *)xrealloc(oci->buffer, BUFSIZE); + ibuf = (char *)realloc(oci->buffer, BUFSIZE); if (ibuf) { oci->size = BUFSIZE; @@ -479,8 +479,8 @@ InsertFakeRequest(ClientPtr client, char *data, int count) ConnectionInputPtr aci = AvailableInput->input; if (aci->size > BUFWATERMARK) { - xfree(aci->buffer); - xfree(aci); + free(aci->buffer); + free(aci); } else { @@ -506,7 +506,7 @@ InsertFakeRequest(ClientPtr client, char *data, int count) { char *ibuf; - ibuf = (char *)xrealloc(oci->buffer, gotnow + count); + ibuf = (char *)realloc(oci->buffer, gotnow + count); if (!ibuf) return(FALSE); oci->size = gotnow + count; @@ -937,7 +937,7 @@ FlushClient(ClientPtr who, OsCommPtr oc, const void *__extraBuf, int extraCount) { unsigned char *obuf; - obuf = (unsigned char *)xrealloc(oco->buf, + obuf = (unsigned char *)realloc(oco->buf, notWritten + BUFSIZE); if (!obuf) { @@ -994,8 +994,8 @@ FlushClient(ClientPtr who, OsCommPtr oc, const void *__extraBuf, int extraCount) } if (oco->size > BUFWATERMARK) { - xfree(oco->buf); - xfree(oco); + free(oco->buf); + free(oco); } else { @@ -1011,13 +1011,13 @@ AllocateInputBuffer(void) { ConnectionInputPtr oci; - oci = xalloc(sizeof(ConnectionInput)); + oci = malloc(sizeof(ConnectionInput)); if (!oci) return NULL; - oci->buffer = xalloc(BUFSIZE); + oci->buffer = malloc(BUFSIZE); if (!oci->buffer) { - xfree(oci); + free(oci); return NULL; } oci->size = BUFSIZE; @@ -1032,13 +1032,13 @@ AllocateOutputBuffer(void) { ConnectionOutputPtr oco; - oco = xalloc(sizeof(ConnectionOutput)); + oco = malloc(sizeof(ConnectionOutput)); if (!oco) return NULL; - oco->buf = xcalloc(1, BUFSIZE); + oco->buf = calloc(1, BUFSIZE); if (!oco->buf) { - xfree(oco); + free(oco); return NULL; } oco->size = BUFSIZE; @@ -1058,8 +1058,8 @@ FreeOsBuffers(OsCommPtr oc) { if (FreeInputs) { - xfree(oci->buffer); - xfree(oci); + free(oci->buffer); + free(oci); } else { @@ -1074,8 +1074,8 @@ FreeOsBuffers(OsCommPtr oc) { if (FreeOutputs) { - xfree(oco->buf); - xfree(oco); + free(oco->buf); + free(oco); } else { @@ -1095,13 +1095,13 @@ ResetOsBuffers(void) while ((oci = FreeInputs)) { FreeInputs = oci->next; - xfree(oci->buffer); - xfree(oci); + free(oci->buffer); + free(oci); } while ((oco = FreeOutputs)) { FreeOutputs = oco->next; - xfree(oco->buf); - xfree(oco); + free(oco->buf); + free(oco); } } -- cgit v1.2.3