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 | |
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')
-rw-r--r-- | os/WaitFor.c | 6 | ||||
-rw-r--r-- | os/access.c | 28 | ||||
-rw-r--r-- | os/connection.c | 20 | ||||
-rw-r--r-- | os/io.c | 48 | ||||
-rw-r--r-- | os/log.c | 6 | ||||
-rw-r--r-- | os/mitauth.c | 14 | ||||
-rw-r--r-- | os/rpcauth.c | 6 | ||||
-rw-r--r-- | os/utils.c | 16 | ||||
-rw-r--r-- | os/xdmauth.c | 44 | ||||
-rw-r--r-- | os/xdmcp.c | 14 | ||||
-rw-r--r-- | os/xprintf.c | 2 | ||||
-rw-r--r-- | os/xsha1.c | 20 |
12 files changed, 112 insertions, 112 deletions
diff --git a/os/WaitFor.c b/os/WaitFor.c index dfe85e515..e66300490 100644 --- a/os/WaitFor.c +++ b/os/WaitFor.c @@ -431,7 +431,7 @@ TimerSet(OsTimerPtr timer, int flags, CARD32 millis, if (!timer) { - timer = xalloc(sizeof(struct _OsTimerRec)); + timer = malloc(sizeof(struct _OsTimerRec)); if (!timer) return NULL; } @@ -516,7 +516,7 @@ TimerFree(OsTimerPtr timer) if (!timer) return; TimerCancel(timer); - xfree(timer); + free(timer); } void @@ -536,7 +536,7 @@ TimerInit(void) while ((timer = timers)) { timers = timer->next; - xfree(timer); + free(timer); } } diff --git a/os/access.c b/os/access.c index d057e0425..a39366e61 100644 --- a/os/access.c +++ b/os/access.c @@ -238,12 +238,12 @@ typedef struct _host { int requested; } HOST; -#define MakeHost(h,l) (h)=xalloc(sizeof *(h)+(l));\ +#define MakeHost(h,l) (h)=malloc(sizeof *(h)+(l));\ if (h) { \ (h)->addr=(unsigned char *) ((h) + 1);\ (h)->requested = FALSE; \ } -#define FreeHost(h) xfree(h) +#define FreeHost(h) free(h) static HOST *selfhosts = NULL; static HOST *validhosts = NULL; static int AccessEnabled = DEFAULT_ACCESS_CONTROL; @@ -587,7 +587,7 @@ DefineSelf (int fd) Error ("Getting interface count"); if (len < (ifn.lifn_count * sizeof(struct lifreq))) { len = ifn.lifn_count * sizeof(struct lifreq); - bufptr = xalloc(len); + bufptr = malloc(len); } #endif @@ -1131,12 +1131,12 @@ Bool LocalClient(ClientPtr client) &alen, (pointer *)&addr); if (family == -1) { - xfree (from); + free(from); return FALSE; } if (family == FamilyLocal) { - xfree (from); + free(from); return TRUE; } for (host = selfhosts; host; host = host->next) @@ -1144,7 +1144,7 @@ Bool LocalClient(ClientPtr client) if (addrEqual (family, addr, alen, host)) return TRUE; } - xfree (from); + free(from); } return FALSE; } @@ -1214,7 +1214,7 @@ GetLocalClientCreds(ClientPtr client, LocalClientCredRec **lccp) } #endif - *lccp = Xcalloc(sizeof(LocalClientCredRec)); + *lccp = calloc(1, sizeof(LocalClientCredRec)); if (*lccp == NULL) return -1; lcc = *lccp; @@ -1250,7 +1250,7 @@ GetLocalClientCreds(ClientPtr client, LocalClientCredRec **lccp) #endif lcc->nSuppGids = ucred_getgroups(peercred, &gids); if (lcc->nSuppGids > 0) { - lcc->pSuppGids = Xcalloc((lcc->nSuppGids) * sizeof(int)); + lcc->pSuppGids = calloc(lcc->nSuppGids, sizeof(int)); if (lcc->pSuppGids == NULL) { lcc->nSuppGids = 0; } else { @@ -1287,9 +1287,9 @@ FreeLocalClientCreds(LocalClientCredRec *lcc) { if (lcc != NULL) { if (lcc->nSuppGids > 0) { - Xfree(lcc->pSuppGids); + free(lcc->pSuppGids); } - Xfree(lcc); + free(lcc); } } @@ -1484,7 +1484,7 @@ GetHosts ( } if (n) { - *data = ptr = xalloc (n); + *data = ptr = malloc(n); if (!ptr) { return(BadAlloc); @@ -1743,7 +1743,7 @@ siTypeAdd(const char *typeName, siAddrMatchFunc addrMatch, } } - s = xalloc(sizeof(struct siType)); + s = malloc(sizeof(struct siType)); if (s == NULL) return BadAlloc; @@ -2085,7 +2085,7 @@ static Bool siLocalCredGetId(const char *addr, int len, siLocalCredPrivPtr lcPriv, int *id) { Bool parsedOK = FALSE; - char *addrbuf = xalloc(len + 1); + char *addrbuf = malloc(len + 1); if (addrbuf == NULL) { return FALSE; @@ -2119,7 +2119,7 @@ siLocalCredGetId(const char *addr, int len, siLocalCredPrivPtr lcPriv, int *id) } } - xfree(addrbuf); + free(addrbuf); return parsedOK; } diff --git a/os/connection.c b/os/connection.c index 61ba72a80..bbcfa51f6 100644 --- a/os/connection.c +++ b/os/connection.c @@ -226,7 +226,7 @@ void SetConnectionTranslation(int conn, int client) } node = &((*node)->next); } - *node = xalloc(sizeof(struct _ct_node)); + *node = malloc(sizeof(struct _ct_node)); (*node)->next = NULL; (*node)->key = conn; (*node)->value = client; @@ -244,7 +244,7 @@ void ClearConnectionTranslation(void) { struct _ct_node *temp = node; node = node->next; - xfree(temp); + free(temp); } } } @@ -397,7 +397,7 @@ CreateWellKnownSockets(void) } else { - ListenTransFds = xalloc (ListenTransCount * sizeof (int)); + ListenTransFds = malloc(ListenTransCount * sizeof (int)); for (i = 0; i < ListenTransCount; i++) { @@ -679,7 +679,7 @@ ClientAuthorized(ClientPtr client, proto_n, auth_proto, auth_id); } - xfree (from); + free(from); } if (auth_id == (XID) ~0L) { @@ -701,7 +701,7 @@ ClientAuthorized(ClientPtr client, AuthAudit(client, TRUE, (struct sockaddr *) from, fromlen, proto_n, auth_proto, auth_id); - xfree (from); + free(from); } } priv->auth_id = auth_id; @@ -737,7 +737,7 @@ AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time) #endif ) return NullClient; - oc = xalloc(sizeof(OsCommRec)); + oc = malloc(sizeof(OsCommRec)); if (!oc) return NullClient; oc->trans_conn = trans_conn; @@ -748,7 +748,7 @@ AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time) oc->conn_time = conn_time; if (!(client = NextAvailableClient((pointer)oc))) { - xfree (oc); + free(oc); return NullClient; } #if !defined(WIN32) @@ -1040,7 +1040,7 @@ CloseDownConnection(ClientPtr client) #endif CloseDownFileDescriptor(oc); FreeOsBuffers(oc); - xfree(client->osPrivate); + free(client->osPrivate); client->osPrivate = (pointer)NULL; if (auditTrailLevel > 1) AuditF("client %d disconnected\n", client->index); @@ -1276,8 +1276,8 @@ void ListenOnOpenFD(int fd, int noxauth) { ciptr->flags = ciptr->flags | TRANS_NOXAUTH; /* Allocate space to store it */ - ListenTransFds = (int *) xrealloc(ListenTransFds, (ListenTransCount + 1) * sizeof (int)); - ListenTransConns = (XtransConnInfo *) xrealloc(ListenTransConns, (ListenTransCount + 1) * sizeof (XtransConnInfo)); + ListenTransFds = (int *) realloc(ListenTransFds, (ListenTransCount + 1) * sizeof (int)); + ListenTransConns = (XtransConnInfo *) realloc(ListenTransConns, (ListenTransCount + 1) * sizeof (XtransConnInfo)); /* Store it */ ListenTransConns[ListenTransCount] = ciptr; @@ -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); } } @@ -170,7 +170,7 @@ LogInit(const char *fname, const char *backup) char *logFileName = NULL; if (fname && *fname) { - /* xalloc() can't be used yet. */ + /* malloc() can't be used yet. */ logFileName = malloc(strlen(fname) + strlen(display) + 1); if (!logFileName) FatalError("Cannot allocate space for the log file name\n"); @@ -217,7 +217,7 @@ LogInit(const char *fname, const char *backup) * needed. */ if (saveBuffer && bufferSize > 0) { - free(saveBuffer); /* Must be free(), not xfree() */ + free(saveBuffer); /* Must be free(), not free() */ saveBuffer = NULL; bufferSize = 0; } @@ -297,7 +297,7 @@ LogVWrite(int verb, const char *f, va_list args) } else if (needBuffer) { /* * Note, this code is used before OsInit() has been called, so - * xalloc() and friends can't be used. + * malloc() and friends can't be used. */ if (len > bufferUnused) { bufferSize += 1024; diff --git a/os/mitauth.c b/os/mitauth.c index 1a26dcea4..4b8f6e978 100644 --- a/os/mitauth.c +++ b/os/mitauth.c @@ -55,12 +55,12 @@ MitAddCookie ( { struct auth *new; - new = xalloc (sizeof (struct auth)); + new = malloc(sizeof (struct auth)); if (!new) return 0; - new->data = xalloc ((unsigned) data_length); + new->data = malloc((unsigned) data_length); if (!new->data) { - xfree(new); + free(new); return 0; } new->next = mit_auth; @@ -96,8 +96,8 @@ MitResetCookie (void) for (auth = mit_auth; auth; auth=next) { next = auth->next; - xfree (auth->data); - xfree (auth); + free(auth->data); + free(auth); } mit_auth = 0; return 0; @@ -152,8 +152,8 @@ MitRemoveCookie ( prev->next = auth->next; else mit_auth = auth->next; - xfree (auth->data); - xfree (auth); + free(auth->data); + free(auth); return 1; } } diff --git a/os/rpcauth.c b/os/rpcauth.c index ec7c01f9b..ad6ebf986 100644 --- a/os/rpcauth.c +++ b/os/rpcauth.c @@ -66,7 +66,7 @@ authdes_ezdecode(const char *inmsg, int len) XDR xdr; SVCXPRT xprt; - temp_inmsg = xalloc(len); + temp_inmsg = malloc(len); memmove(temp_inmsg, inmsg, len); memset((char *)&msg, 0, sizeof(msg)); @@ -79,7 +79,7 @@ authdes_ezdecode(const char *inmsg, int len) why = AUTH_FAILED; xdrmem_create(&xdr, temp_inmsg, len, XDR_DECODE); - if ((r.rq_clntcred = xalloc(MAX_AUTH_BYTES)) == NULL) + if ((r.rq_clntcred = malloc(MAX_AUTH_BYTES)) == NULL) goto bad1; r.rq_xprt = &xprt; @@ -106,7 +106,7 @@ authdes_ezdecode(const char *inmsg, int len) return (((struct authdes_cred *) r.rq_clntcred)->adc_fullname.name); bad2: - xfree(r.rq_clntcred); + free(r.rq_clntcred); bad1: return ((char *)0); /* ((struct authdes_cred *) NULL); */ } diff --git a/os/utils.c b/os/utils.c index 3dffbd822..c89da9490 100644 --- a/os/utils.c +++ b/os/utils.c @@ -995,7 +995,7 @@ set_font_authorizations(char **authorizations, int *authlen, pointer client) #endif len = strlen(hnameptr) + 1; - result = xalloc(len + sizeof(AUTHORIZATION_NAME) + 4); + result = malloc(len + sizeof(AUTHORIZATION_NAME) + 4); p = result; *p++ = sizeof(AUTHORIZATION_NAME) >> 8; @@ -1373,11 +1373,11 @@ Popen(char *command, char *type) if ((*type != 'r' && *type != 'w') || type[1]) return NULL; - if ((cur = xalloc(sizeof(struct pid))) == NULL) + if ((cur = malloc(sizeof(struct pid))) == NULL) return NULL; if (pipe(pdes) < 0) { - xfree(cur); + free(cur); return NULL; } @@ -1392,7 +1392,7 @@ Popen(char *command, char *type) case -1: /* error */ close(pdes[0]); close(pdes[1]); - xfree(cur); + free(cur); if (OsSignal(SIGALRM, old_alarm) == SIG_ERR) perror("signal"); return NULL; @@ -1459,11 +1459,11 @@ Fopen(char *file, char *type) if ((*type != 'r' && *type != 'w') || type[1]) return NULL; - if ((cur = xalloc(sizeof(struct pid))) == NULL) + if ((cur = malloc(sizeof(struct pid))) == NULL) return NULL; if (pipe(pdes) < 0) { - xfree(cur); + free(cur); return NULL; } @@ -1471,7 +1471,7 @@ Fopen(char *file, char *type) case -1: /* error */ close(pdes[0]); close(pdes[1]); - xfree(cur); + free(cur); return NULL; case 0: /* child */ if (setgid(getgid()) == -1) @@ -1565,7 +1565,7 @@ Pclose(pointer iop) pidlist = cur->next; else last->next = cur->next; - xfree(cur); + free(cur); /* allow EINTR again */ OsReleaseSignals (); diff --git a/os/xdmauth.c b/os/xdmauth.c index 7fab73111..31c1b4c41 100644 --- a/os/xdmauth.c +++ b/os/xdmauth.c @@ -239,7 +239,7 @@ XdmClientAuthTimeout (long now) prev->next = next; else xdmClients = next; - xfree (client); + free(client); } else prev = client; @@ -259,20 +259,20 @@ XdmAuthorizationValidate (unsigned char *plain, int length, *reason = "Bad XDM authorization key length"; return NULL; } - client = xalloc (sizeof (XdmClientAuthRec)); + client = malloc(sizeof (XdmClientAuthRec)); if (!client) return NULL; XdmClientAuthDecode (plain, client); if (!XdmcpCompareKeys (&client->rho, rho)) { - xfree (client); + free(client); if (reason) *reason = "Invalid XDM-AUTHORIZATION-1 key (failed key comparison)"; return NULL; } for (i = 18; i < 24; i++) if (plain[i] != 0) { - xfree (client); + free(client); if (reason) *reason = "Invalid XDM-AUTHORIZATION-1 key (failed NULL check)"; return NULL; @@ -287,15 +287,15 @@ XdmAuthorizationValidate (unsigned char *plain, int length, #if defined(TCPCONN) || defined(STREAMSCONN) if (family == FamilyInternet && memcmp((char *)addr, client->client, 4) != 0) { - xfree (client); - xfree (addr); + free(client); + free(addr); if (reason) *reason = "Invalid XDM-AUTHORIZATION-1 key (failed address comparison)"; return NULL; } #endif - xfree (addr); + free(addr); } } now = time(0); @@ -308,7 +308,7 @@ XdmAuthorizationValidate (unsigned char *plain, int length, XdmClientAuthTimeout (now); if (abs (client->time - now) > TwentyMinutes) { - xfree (client); + free(client); if (reason) *reason = "Excessive XDM-AUTHORIZATION-1 time offset"; return NULL; @@ -317,7 +317,7 @@ XdmAuthorizationValidate (unsigned char *plain, int length, { if (XdmClientAuthCompare (existing, client)) { - xfree (client); + free(client); if (reason) *reason = "XDM authorization key matches an existing client!"; return NULL; @@ -363,7 +363,7 @@ XdmAddCookie (unsigned short data_length, const char *data, XID id) /* the first octet of the key must be zero */ if (key_bits[0] != '\0') return 0; - new = xalloc (sizeof (XdmAuthorizationRec)); + new = malloc(sizeof (XdmAuthorizationRec)); if (!new) return 0; new->next = xdmAuth; @@ -385,7 +385,7 @@ XdmCheckCookie (unsigned short cookie_length, const char *cookie, /* Auth packets must be a multiple of 8 bytes long */ if (cookie_length & 7) return (XID) -1; - plain = xalloc (cookie_length); + plain = malloc(cookie_length); if (!plain) return (XID) -1; for (auth = xdmAuth; auth; auth=auth->next) { @@ -394,11 +394,11 @@ XdmCheckCookie (unsigned short cookie_length, const char *cookie, { client->next = xdmClients; xdmClients = client; - xfree (plain); + free(plain); return auth->id; } } - xfree (plain); + free(plain); return (XID) -1; } @@ -411,13 +411,13 @@ XdmResetCookie (void) for (auth = xdmAuth; auth; auth=next_auth) { next_auth = auth->next; - xfree (auth); + free(auth); } xdmAuth = 0; for (client = xdmClients; client; client=next_client) { next_client = client->next; - xfree (client); + free(client); } xdmClients = (XdmClientAuthPtr) 0; return 1; @@ -430,21 +430,21 @@ XdmToID (unsigned short cookie_length, char *cookie) XdmClientAuthPtr client; unsigned char *plain; - plain = xalloc (cookie_length); + plain = malloc(cookie_length); if (!plain) return (XID) -1; for (auth = xdmAuth; auth; auth=auth->next) { XdmcpUnwrap ((unsigned char *)cookie, (unsigned char *)&auth->key, plain, cookie_length); if ((client = XdmAuthorizationValidate (plain, cookie_length, &auth->rho, NULL, NULL)) != NULL) { - xfree (client); - xfree (cookie); - xfree (plain); + free(client); + free(cookie); + free(plain); return auth->id; } } - xfree (cookie); - xfree (plain); + free(cookie); + free(plain); return (XID) -1; } @@ -489,7 +489,7 @@ XdmRemoveCookie (unsigned short data_length, const char *data) XdmcpCompareKeys (key_bits, &auth->key)) { xdmAuth = auth->next; - xfree (auth); + free(auth); return 1; } } diff --git a/os/xdmcp.c b/os/xdmcp.c index cae7d40ae..38b2197a1 100644 --- a/os/xdmcp.c +++ b/os/xdmcp.c @@ -391,7 +391,7 @@ XdmcpRegisterAuthentication ( AuthenticationNames.length + 1) && XdmcpReallocARRAYofARRAY8 (&AuthenticationDatas, AuthenticationDatas.length + 1) && - (newFuncs = xalloc ((AuthenticationNames.length + 1) * sizeof (AuthenticationFuncsRec))))) + (newFuncs = malloc((AuthenticationNames.length + 1) * sizeof (AuthenticationFuncsRec))))) { XdmcpDisposeARRAY8 (&AuthenticationName); XdmcpDisposeARRAY8 (&AuthenticationData); @@ -402,7 +402,7 @@ XdmcpRegisterAuthentication ( newFuncs[AuthenticationNames.length-1].Validator = Validator; newFuncs[AuthenticationNames.length-1].Generator = Generator; newFuncs[AuthenticationNames.length-1].AddAuth = AddAuth; - xfree (AuthenticationFuncsList); + free(AuthenticationFuncsList); AuthenticationFuncsList = newFuncs; AuthenticationNames.data[AuthenticationNames.length-1] = AuthenticationName; AuthenticationDatas.data[AuthenticationDatas.length-1] = AuthenticationData; @@ -492,18 +492,18 @@ XdmcpRegisterConnection ( } if (ConnectionAddresses.length + 1 == 256) return; - newAddress = xalloc (addrlen * sizeof (CARD8)); + newAddress = malloc(addrlen * sizeof (CARD8)); if (!newAddress) return; if (!XdmcpReallocARRAY16 (&ConnectionTypes, ConnectionTypes.length + 1)) { - xfree (newAddress); + free(newAddress); return; } if (!XdmcpReallocARRAYofARRAY8 (&ConnectionAddresses, ConnectionAddresses.length + 1)) { - xfree (newAddress); + free(newAddress); return; } ConnectionTypes.data[ConnectionTypes.length - 1] = (CARD16) type; @@ -533,12 +533,12 @@ XdmcpRegisterAuthorization (const char *name, int namelen) ARRAY8 authName; int i; - authName.data = xalloc (namelen * sizeof (CARD8)); + authName.data = malloc(namelen * sizeof (CARD8)); if (!authName.data) return; if (!XdmcpReallocARRAYofARRAY8 (&AuthorizationNames, AuthorizationNames.length +1)) { - xfree (authName.data); + free(authName.data); return; } for (i = 0; i < namelen; i++) diff --git a/os/xprintf.c b/os/xprintf.c index 07eaa1f58..3fe19b36f 100644 --- a/os/xprintf.c +++ b/os/xprintf.c @@ -54,7 +54,7 @@ Xvprintf(const char *format, va_list va) size = vsnprintf(NULL, 0, format, va2); va_end(va2); - ret = (char *)Xalloc(size + 1); + ret = (char *)malloc(size + 1); if (ret == NULL) return NULL; diff --git a/os/xsha1.c b/os/xsha1.c index 355862fb1..5ea71da46 100644 --- a/os/xsha1.c +++ b/os/xsha1.c @@ -12,7 +12,7 @@ void *x_sha1_init(void) { - SHA1_CTX *ctx = xalloc(sizeof(*ctx)); + SHA1_CTX *ctx = malloc(sizeof(*ctx)); if (!ctx) return NULL; SHA1Init(ctx); @@ -30,7 +30,7 @@ int x_sha1_final(void *ctx, unsigned char result[20]) { SHA1_CTX *sha1_ctx = ctx; SHA1Final(result, sha1_ctx); - xfree(sha1_ctx); + free(sha1_ctx); return 1; } @@ -40,7 +40,7 @@ int x_sha1_final(void *ctx, unsigned char result[20]) void *x_sha1_init(void) { - CC_SHA1_CTX *ctx = xalloc(sizeof(*ctx)); + CC_SHA1_CTX *ctx = malloc(sizeof(*ctx)); if (!ctx) return NULL; CC_SHA1_Init(ctx); @@ -58,7 +58,7 @@ int x_sha1_final(void *ctx, unsigned char result[20]) { CC_SHA1_CTX *sha1_ctx = ctx; CC_SHA1_Final(result, sha1_ctx); - xfree(sha1_ctx); + free(sha1_ctx); return 1; } @@ -107,7 +107,7 @@ int x_sha1_final(void *ctx, unsigned char result[20]) void *x_sha1_init(void) { - sha1_ctx *ctx = xalloc(sizeof(*ctx)); + sha1_ctx *ctx = malloc(sizeof(*ctx)); if(!ctx) return NULL; sha1_begin(ctx); @@ -123,7 +123,7 @@ int x_sha1_update(void *ctx, void *data, int size) int x_sha1_final(void *ctx, unsigned char result[20]) { sha1_end(result, ctx); - xfree(ctx); + free(ctx); return 1; } @@ -135,12 +135,12 @@ int x_sha1_final(void *ctx, unsigned char result[20]) void *x_sha1_init(void) { int ret; - SHA_CTX *ctx = xalloc(sizeof(*ctx)); + SHA_CTX *ctx = malloc(sizeof(*ctx)); if (!ctx) return NULL; ret = SHA1_Init(ctx); if (!ret) { - xfree(ctx); + free(ctx); return NULL; } return ctx; @@ -152,7 +152,7 @@ int x_sha1_update(void *ctx, void *data, int size) SHA_CTX *sha_ctx = ctx; ret = SHA1_Update(sha_ctx, data, size); if (!ret) - xfree(sha_ctx); + free(sha_ctx); return ret; } @@ -161,7 +161,7 @@ int x_sha1_final(void *ctx, unsigned char result[20]) int ret; SHA_CTX *sha_ctx = ctx; ret = SHA1_Final(result, sha_ctx); - xfree(sha_ctx); + free(sha_ctx); return ret; } |