summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-07-11 16:08:41 -0700
committerKeith Packard <keithp@keithp.com>2013-10-31 16:58:16 -0700
commit26f013ba45b08a02bb028a461af68288a86fadb1 (patch)
tree28640fb1c8d5b4aa2ab9e02c7f2e5f8cb852ba30 /dix
parentd25c217964eb1fe54c3a54bca4cac7f47b4b9fdf (diff)
Add a RegionDuplicate function
This allocates a new region structure and copies a source region into it in a single API rather than forcing the caller to do both steps themselves. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'dix')
-rw-r--r--dix/region.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/dix/region.c b/dix/region.c
index 737d2a861..15f3d01a5 100644
--- a/dix/region.c
+++ b/dix/region.c
@@ -255,6 +255,21 @@ RegionDestroy(RegionPtr pReg)
free(pReg);
}
+RegionPtr
+RegionDuplicate(RegionPtr pOld)
+{
+ RegionPtr pNew;
+
+ pNew = RegionCreate(&pOld->extents, 0);
+ if (!pNew)
+ return NULL;
+ if (!RegionCopy(pNew, pOld)) {
+ RegionDestroy(pNew);
+ return NULL;
+ }
+ return pNew;
+}
+
void
RegionPrint(RegionPtr rgn)
{