mirror of
https://github.com/X11Libre/xserver.git
synced 2026-10-07 23:02:23 +00:00
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>
This commit is contained in:
parent
96c7ab27c3
commit
3f3ff971ec
345 changed files with 3011 additions and 3011 deletions
|
|
@ -461,7 +461,7 @@ BT829Ptr bt829_Detect(I2CBusPtr b, I2CSlaveAddr addr)
|
|||
BT829Ptr bt;
|
||||
I2CByte a;
|
||||
|
||||
bt = xcalloc(1, sizeof(BT829Rec));
|
||||
bt = calloc(1, sizeof(BT829Rec));
|
||||
if(bt == NULL) return NULL;
|
||||
bt->d.DevName = strdup("BT829 video decoder");
|
||||
bt->d.SlaveAddr = addr;
|
||||
|
|
@ -482,7 +482,7 @@ BT829Ptr bt829_Detect(I2CBusPtr b, I2CSlaveAddr addr)
|
|||
bt->id = btread(bt,IDCODE);
|
||||
|
||||
free(bt->d.DevName);
|
||||
bt->d.DevName = xcalloc(200, sizeof(char));
|
||||
bt->d.DevName = calloc(200, sizeof(char));
|
||||
switch(BTVERSION){
|
||||
case BT815:
|
||||
sprintf(bt->d.DevName, "bt815a video decoder, revision %d",bt->id & 0xf);
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ FI1236Ptr Detect_FI1236(I2CBusPtr b, I2CSlaveAddr addr)
|
|||
FI1236Ptr f;
|
||||
I2CByte a;
|
||||
|
||||
f = xcalloc(1,sizeof(FI1236Rec));
|
||||
f = calloc(1,sizeof(FI1236Rec));
|
||||
if(f == NULL) return NULL;
|
||||
f->d.DevName = strdup("FI12xx Tuner");
|
||||
f->d.SlaveAddr = addr;
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ MSP3430Ptr DetectMSP3430(I2CBusPtr b, I2CSlaveAddr addr)
|
|||
CARD8 hardware_version, major_revision, product_code, rom_version;
|
||||
Bool supported;
|
||||
|
||||
m = xcalloc(1,sizeof(MSP3430Rec));
|
||||
m = calloc(1,sizeof(MSP3430Rec));
|
||||
if(m == NULL)return NULL;
|
||||
m->d.DevName = strdup("MSP34xx");
|
||||
m->d.SlaveAddr = addr;
|
||||
|
|
@ -149,8 +149,8 @@ MSP3430Ptr DetectMSP3430(I2CBusPtr b, I2CSlaveAddr addr)
|
|||
|
||||
if(!I2C_WriteRead(&(m->d), NULL, 0, &a, 1))
|
||||
{
|
||||
xfree(m->d.DevName);
|
||||
xfree(m);
|
||||
free(m->d.DevName);
|
||||
free(m);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -235,14 +235,14 @@ MSP3430Ptr DetectMSP3430(I2CBusPtr b, I2CSlaveAddr addr)
|
|||
MSP_getProductName(m->chip_id), supported?"":" (unsupported)", rom_version, m->chip_id);
|
||||
|
||||
if (!supported) {
|
||||
xfree(m->d.DevName);
|
||||
xfree(m);
|
||||
return NULL;
|
||||
}
|
||||
free(m->d.DevName);
|
||||
free(m);
|
||||
return NULL;
|
||||
}
|
||||
if(!I2CDevInit(&(m->d)))
|
||||
{
|
||||
xfree(m->d.DevName);
|
||||
xfree(m);
|
||||
free(m->d.DevName);
|
||||
free(m);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ TDA8425Ptr Detect_tda8425(I2CBusPtr b, I2CSlaveAddr addr, Bool force)
|
|||
{
|
||||
TDA8425Ptr t;
|
||||
|
||||
t = xcalloc(1, sizeof(TDA8425Rec));
|
||||
t = calloc(1, sizeof(TDA8425Rec));
|
||||
if(t == NULL) return NULL;
|
||||
t->d.DevName = "TDA8425 BTSC Stereo Audio Processor";
|
||||
t->d.SlaveAddr = addr;
|
||||
|
|
@ -30,14 +30,14 @@ TDA8425Ptr Detect_tda8425(I2CBusPtr b, I2CSlaveAddr addr, Bool force)
|
|||
|
||||
if(!force && !I2CProbeAddress(b, addr))
|
||||
{
|
||||
xfree(t);
|
||||
free(t);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* set default parameters */
|
||||
if(!I2CDevInit(&(t->d)))
|
||||
{
|
||||
xfree(t);
|
||||
free(t);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ TDA9850Ptr Detect_tda9850(I2CBusPtr b, I2CSlaveAddr addr)
|
|||
TDA9850Ptr t;
|
||||
I2CByte a;
|
||||
|
||||
t = xcalloc(1, sizeof(TDA9850Rec));
|
||||
t = calloc(1, sizeof(TDA9850Rec));
|
||||
if(t == NULL) return NULL;
|
||||
switch(addr)
|
||||
{
|
||||
|
|
@ -39,14 +39,14 @@ TDA9850Ptr Detect_tda9850(I2CBusPtr b, I2CSlaveAddr addr)
|
|||
|
||||
if(!I2C_WriteRead(&(t->d), NULL, 0, &a, 1))
|
||||
{
|
||||
xfree(t);
|
||||
free(t);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* set default parameters */
|
||||
if(!I2CDevInit(&(t->d)))
|
||||
{
|
||||
xfree(t);
|
||||
free(t);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ TDA9885Ptr Detect_tda9885(I2CBusPtr b, I2CSlaveAddr addr)
|
|||
TDA9885Ptr t;
|
||||
I2CByte a;
|
||||
|
||||
t = xcalloc(1, sizeof(TDA9885Rec));
|
||||
t = calloc(1, sizeof(TDA9885Rec));
|
||||
if(t == NULL) return NULL;
|
||||
switch(addr)
|
||||
{
|
||||
|
|
@ -37,14 +37,14 @@ TDA9885Ptr Detect_tda9885(I2CBusPtr b, I2CSlaveAddr addr)
|
|||
|
||||
if(!I2C_WriteRead(&(t->d), NULL, 0, &a, 1))
|
||||
{
|
||||
xfree(t);
|
||||
free(t);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* set default parameters */
|
||||
if(!I2CDevInit(&(t->d)))
|
||||
{
|
||||
xfree(t);
|
||||
free(t);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ UDA1380Ptr Detect_uda1380(I2CBusPtr b, I2CSlaveAddr addr)
|
|||
UDA1380Ptr t;
|
||||
I2CByte a;
|
||||
|
||||
t = xcalloc(1, sizeof(UDA1380Rec));
|
||||
t = calloc(1, sizeof(UDA1380Rec));
|
||||
if(t == NULL) return NULL;
|
||||
switch(addr)
|
||||
{
|
||||
|
|
@ -58,14 +58,14 @@ UDA1380Ptr Detect_uda1380(I2CBusPtr b, I2CSlaveAddr addr)
|
|||
|
||||
if(!I2C_WriteRead(&(t->d), NULL, 0, &a, 1))
|
||||
{
|
||||
xfree(t);
|
||||
free(t);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* set default parameters */
|
||||
if(!I2CDevInit(&(t->d)))
|
||||
{
|
||||
xfree(t);
|
||||
free(t);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -598,7 +598,7 @@ xf86I2CWriteVec(I2CDevPtr d, I2CByte *vec, int nValues)
|
|||
I2CDevPtr
|
||||
xf86CreateI2CDevRec(void)
|
||||
{
|
||||
return xcalloc(1, sizeof(I2CDevRec));
|
||||
return calloc(1, sizeof(I2CDevRec));
|
||||
}
|
||||
|
||||
/* Unlink an I2C device. If you got the I2CDevRec from xf86CreateI2CDevRec
|
||||
|
|
@ -623,7 +623,7 @@ xf86DestroyI2CDevRec(I2CDevPtr d, Bool unalloc)
|
|||
"I2C device \"%s:%s\" removed.\n",
|
||||
d->pI2CBus->BusName, d->DevName);
|
||||
|
||||
if (unalloc) xfree(d);
|
||||
if (unalloc) free(d);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -695,7 +695,7 @@ xf86CreateI2CBusRec(void)
|
|||
{
|
||||
I2CBusPtr b;
|
||||
|
||||
b = (I2CBusPtr) xcalloc(1, sizeof(I2CBusRec));
|
||||
b = (I2CBusPtr) calloc(1, sizeof(I2CBusRec));
|
||||
|
||||
if (b != NULL) {
|
||||
b->scrnIndex = -1;
|
||||
|
|
@ -751,7 +751,7 @@ xf86DestroyI2CBusRec(I2CBusPtr b, Bool unalloc, Bool devs_too)
|
|||
xf86DrvMsg(b->scrnIndex, X_INFO, "I2C bus \"%s\" removed.\n",
|
||||
b->BusName);
|
||||
|
||||
if (unalloc) xfree(b);
|
||||
if (unalloc) free(b);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue