diff options
author | Mikhail Gusarov <dottedmag@dottedmag.net> | 2010-05-06 01:44:06 +0700 |
---|---|---|
committer | Mikhail Gusarov <dottedmag@dottedmag.net> | 2010-05-13 00:22:37 +0700 |
commit | 3f3ff971ecff9936cebafc813af9193b97bba89c (patch) | |
tree | fdbbad794a42488b7ffe41eed7aba4e498335f55 /os/io.c | |
parent | 96c7ab27c383ec767f62a7a11e5fd76f86363fbc (diff) |
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 <dottedmag@dottedmag.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'os/io.c')
-rw-r--r-- | os/io.c | 48 |
1 files changed, 24 insertions, 24 deletions
@@ -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); } } |