summaryrefslogtreecommitdiff
path: root/hw/xfree86/os-support
diff options
context:
space:
mode:
authorMikhail Gusarov <dottedmag@dottedmag.net>2010-05-06 01:44:06 +0700
committerMikhail Gusarov <dottedmag@dottedmag.net>2010-05-13 00:22:37 +0700
commit3f3ff971ecff9936cebafc813af9193b97bba89c (patch)
treefdbbad794a42488b7ffe41eed7aba4e498335f55 /hw/xfree86/os-support
parent96c7ab27c383ec767f62a7a11e5fd76f86363fbc (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 'hw/xfree86/os-support')
-rw-r--r--hw/xfree86/os-support/bsd/i386_video.c12
-rw-r--r--hw/xfree86/os-support/bus/Sbus.c12
-rw-r--r--hw/xfree86/os-support/linux/int10/linux.c18
-rw-r--r--hw/xfree86/os-support/linux/lnx_agp.c2
-rw-r--r--hw/xfree86/os-support/linux/lnx_video.c10
-rw-r--r--hw/xfree86/os-support/shared/posix_tty.c12
-rw-r--r--hw/xfree86/os-support/shared/vidmem.c4
-rw-r--r--hw/xfree86/os-support/solaris/sun_agp.c2
8 files changed, 36 insertions, 36 deletions
diff --git a/hw/xfree86/os-support/bsd/i386_video.c b/hw/xfree86/os-support/bsd/i386_video.c
index 10db9c7b8..44abb9d55 100644
--- a/hw/xfree86/os-support/bsd/i386_video.c
+++ b/hw/xfree86/os-support/bsd/i386_video.c
@@ -529,7 +529,7 @@ getAllRanges(int *nmr)
mro.mo_arg[0] = *nmr;
mro.mo_desc = mrd;
if (ioctl(devMemFd, MEMRANGE_GET, &mro)) {
- xfree(mrd);
+ free(mrd);
return NULL;
}
return mrd;
@@ -576,7 +576,7 @@ cleanMTRR()
#ifdef DEBUG
sleep(10);
#endif
- xfree(mrd);
+ free(mrd);
return TRUE;
}
@@ -594,7 +594,7 @@ freeRangeList(RangePtr range)
while (range) {
rp = range;
range = rp->next;
- xfree(rp);
+ free(rp);
}
}
@@ -679,7 +679,7 @@ findRanges(unsigned long base, unsigned long size, RangePtr *ucp, RangePtr *wcp)
*p = rp;
}
}
- xfree(mrd);
+ free(mrd);
}
/*
@@ -886,7 +886,7 @@ NetBSDsetWC(int screenNum, unsigned long base, unsigned long size, Bool enable,
n = 1;
if (i386_set_mtrr(mtrrp, &n) < 0) {
- xfree(mtrrp);
+ free(mtrrp);
return NULL;
}
return mtrrp;
@@ -903,6 +903,6 @@ NetBSDundoWC(int screenNum, pointer list)
n = 1;
mtrrp->flags &= ~MTRR_VALID;
i386_set_mtrr(mtrrp, &n);
- xfree(mtrrp);
+ free(mtrrp);
}
#endif
diff --git a/hw/xfree86/os-support/bus/Sbus.c b/hw/xfree86/os-support/bus/Sbus.c
index 0b6205f0b..9ccc2898f 100644
--- a/hw/xfree86/os-support/bus/Sbus.c
+++ b/hw/xfree86/os-support/bus/Sbus.c
@@ -192,7 +192,7 @@ sparcPromClose(void)
promFd = -1;
}
if (promOpio) {
- xfree(promOpio);
+ free(promOpio);
promOpio = NULL;
}
promOpenCount = 0;
@@ -208,7 +208,7 @@ sparcPromInit(void)
promFd = open("/dev/openprom", O_RDONLY, 0);
if (promFd == -1)
return -1;
- promOpio = (struct openpromio *)xalloc(4096);
+ promOpio = (struct openpromio *)malloc(4096);
if (!promOpio) {
sparcPromClose();
return -1;
@@ -515,11 +515,11 @@ sparcPromNode2Pathname(sbusPromNodePtr pnode)
char *ret;
if (!pnode->node) return NULL;
- ret = xalloc(4096);
+ ret = malloc(4096);
if (!ret) return NULL;
if (promWalkNode2Pathname(ret, promRootNode, promGetChild(promRootNode), pnode->node, 0))
return ret;
- xfree(ret);
+ free(ret);
return NULL;
}
@@ -585,7 +585,7 @@ sparcPromPathname2Node(const char *pathName)
char *name, *regstr, *p;
i = strlen(pathName);
- name = xalloc(i + 2);
+ name = malloc(i + 2);
if (! name) return 0;
strcpy (name, pathName);
name [i + 1] = 0;
@@ -605,7 +605,7 @@ sparcPromPathname2Node(const char *pathName)
return 0;
promGetSibling(0);
i = promWalkPathname2Node(name + 1, regstr, promRootNode, 0);
- xfree(name);
+ free(name);
return i;
}
diff --git a/hw/xfree86/os-support/linux/int10/linux.c b/hw/xfree86/os-support/linux/int10/linux.c
index 0cf3507c3..2965b3756 100644
--- a/hw/xfree86/os-support/linux/int10/linux.c
+++ b/hw/xfree86/os-support/linux/int10/linux.c
@@ -100,7 +100,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
options = xf86HandleInt10Options(xf86Screens[screen],entityIndex);
if (int10skip(options)) {
- xfree(options);
+ free(options);
return NULL;
}
@@ -290,7 +290,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
dprint(0xc0000, 0x20);
#endif
- xfree(options);
+ free(options);
return pInt;
error3:
@@ -308,11 +308,11 @@ error2:
error1:
if (vMem)
munmap(vMem, SYS_BIOS - V_BIOS);
- xfree(((linuxInt10Priv*)pInt->private)->alloc);
- xfree(pInt->private);
+ free(((linuxInt10Priv*)pInt->private)->alloc);
+ free(pInt->private);
error0:
- xfree(options);
- xfree(pInt);
+ free(options);
+ free(pInt);
return NULL;
}
@@ -399,9 +399,9 @@ xf86FreeInt10(xf86Int10InfoPtr pInt)
shmctl(((linuxInt10Priv*)pInt->private)->lowMem, IPC_RMID, NULL);
if (((linuxInt10Priv*)pInt->private)->highMem >= 0)
shmctl(((linuxInt10Priv*)pInt->private)->highMem, IPC_RMID, NULL);
- xfree(((linuxInt10Priv*)pInt->private)->alloc);
- xfree(pInt->private);
- xfree(pInt);
+ free(((linuxInt10Priv*)pInt->private)->alloc);
+ free(pInt->private);
+ free(pInt);
}
void *
diff --git a/hw/xfree86/os-support/linux/lnx_agp.c b/hw/xfree86/os-support/linux/lnx_agp.c
index 61437406d..44db8662d 100644
--- a/hw/xfree86/os-support/linux/lnx_agp.c
+++ b/hw/xfree86/os-support/linux/lnx_agp.c
@@ -132,7 +132,7 @@ xf86GetAGPInfo(int screenNum)
return NULL;
- if ((info = xcalloc(sizeof(AgpInfo), 1)) == NULL) {
+ if ((info = calloc(sizeof(AgpInfo), 1)) == NULL) {
xf86DrvMsg(screenNum, X_ERROR,
"xf86GetAGPInfo: Failed to allocate AgpInfo\n");
return NULL;
diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c
index 26a17425a..bdd2639ba 100644
--- a/hw/xfree86/os-support/linux/lnx_video.c
+++ b/hw/xfree86/os-support/linux/lnx_video.c
@@ -182,7 +182,7 @@ mtrr_cull_wc_region(int screenNum, unsigned long base, unsigned long size,
/* Found an overlapping region. Delete it. */
- wcr = xalloc(sizeof(*wcr));
+ wcr = malloc(sizeof(*wcr));
if (!wcr)
return NULL;
wcr->sentry.base = gent.base;
@@ -203,7 +203,7 @@ mtrr_cull_wc_region(int screenNum, unsigned long base, unsigned long size,
wcreturn = wcr;
gent.regnum--;
} else {
- xfree(wcr);
+ free(wcr);
xf86DrvMsgVerb(screenNum, X_WARNING, 0,
"Failed to remove MMIO "
"write-combining range (0x%lx,0x%lx)\n",
@@ -263,7 +263,7 @@ mtrr_add_wc_region(int screenNum, unsigned long base, unsigned long size,
if (!mtrr_open(from == X_CONFIG ? 0 : 2))
return wcreturn;
- *wcr = curwcr = xalloc(sizeof(**wcr));
+ *wcr = curwcr = malloc(sizeof(**wcr));
if (!curwcr)
return wcreturn;
@@ -313,7 +313,7 @@ mtrr_add_wc_region(int screenNum, unsigned long base, unsigned long size,
}
else {
*wcr = curwcr->next;
- xfree(curwcr);
+ free(curwcr);
/* Don't complain about the VGA region: MTRR fixed
regions aren't currently supported, but might be in
@@ -339,7 +339,7 @@ mtrr_undo_wc_region(int screenNum, struct mtrr_wc_region *wcr)
ioctl(mtrr_fd, MTRRIOC_DEL_ENTRY, &p->sentry);
prev = p;
p = p->next;
- xfree(prev);
+ free(prev);
}
}
}
diff --git a/hw/xfree86/os-support/shared/posix_tty.c b/hw/xfree86/os-support/shared/posix_tty.c
index da57939cf..2e22bc3ff 100644
--- a/hw/xfree86/os-support/shared/posix_tty.c
+++ b/hw/xfree86/os-support/shared/posix_tty.c
@@ -131,14 +131,14 @@ xf86OpenSerial (pointer options)
xf86Msg (X_ERROR,
"xf86OpenSerial: Cannot open device %s\n\t%s.\n",
dev, strerror (errno));
- xfree(dev);
+ free(dev);
return (-1);
}
if (!isatty (fd))
{
/* Allow non-tty devices to be opened. */
- xfree(dev);
+ free(dev);
return (fd);
}
@@ -161,7 +161,7 @@ xf86OpenSerial (pointer options)
if (xf86SetSerial (fd, options) == -1)
{
SYSCALL (close (fd));
- xfree(dev);
+ free(dev);
return (-1);
}
@@ -169,7 +169,7 @@ xf86OpenSerial (pointer options)
if (i == -1)
{
SYSCALL (close (fd));
- xfree(dev);
+ free(dev);
return (-1);
}
i &= ~O_NONBLOCK;
@@ -177,10 +177,10 @@ xf86OpenSerial (pointer options)
if (i == -1)
{
SYSCALL (close (fd));
- xfree(dev);
+ free(dev);
return (-1);
}
- xfree(dev);
+ free(dev);
return (fd);
}
diff --git a/hw/xfree86/os-support/shared/vidmem.c b/hw/xfree86/os-support/shared/vidmem.c
index 803ce09bd..89db4cc9d 100644
--- a/hw/xfree86/os-support/shared/vidmem.c
+++ b/hw/xfree86/os-support/shared/vidmem.c
@@ -128,7 +128,7 @@ removeMapping(VidMapPtr vp, MappingPtr mp)
for (i = 0; i < vp->numMappings; i++) {
if (vp->mappings[i] == mp) {
found = 1;
- xfree(vp->mappings[i]);
+ free(vp->mappings[i]);
} else if (found) {
vp->mappings[i - 1] = vp->mappings[i];
}
@@ -156,7 +156,7 @@ checkMtrrOption(VidMapPtr vp)
options);
if (xf86GetOptValBool(options, OPTION_MTRR, &vp->mtrrEnabled))
vp->mtrrFrom = X_CONFIG;
- xfree(options);
+ free(options);
vp->mtrrOptChecked = TRUE;
}
}
diff --git a/hw/xfree86/os-support/solaris/sun_agp.c b/hw/xfree86/os-support/solaris/sun_agp.c
index e6a55a48b..ccecd112d 100644
--- a/hw/xfree86/os-support/solaris/sun_agp.c
+++ b/hw/xfree86/os-support/solaris/sun_agp.c
@@ -115,7 +115,7 @@ xf86GetAGPInfo(int screenNum)
if (!GARTInit(screenNum))
return NULL;
- if ((info = xcalloc(sizeof(AgpInfo), 1)) == NULL) {
+ if ((info = calloc(sizeof(AgpInfo), 1)) == NULL) {
xf86DrvMsg(screenNum, X_ERROR,
"xf86GetAGPInfo: Failed to allocate AgpInfo\n");
return NULL;