diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2019-10-31 00:32:12 +0100 |
---|---|---|
committer | Ulrich Sibiller <uli42@gmx.de> | 2020-01-05 22:38:50 +0100 |
commit | bcca31996c07ee57d7507009b94e8d9c40a37a99 (patch) | |
tree | ba6813e014537ac0c8aab0d762ca8b300b6d35ad | |
parent | 53b3d4df3abdbc036ff07e253739822118e239a5 (diff) | |
download | nx-libs-bcca31996c07ee57d7507009b94e8d9c40a37a99.tar.gz nx-libs-bcca31996c07ee57d7507009b94e8d9c40a37a99.tar.bz2 nx-libs-bcca31996c07ee57d7507009b94e8d9c40a37a99.zip |
Split.c: scope improvements/code simplification
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Split.c | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Split.c b/nx-X11/programs/Xserver/hw/nxagent/Split.c index f2005e9d5..4dac8f5b2 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Split.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Split.c @@ -71,13 +71,11 @@ DrawablePtr nxagentSplitDrawable(DrawablePtr pDrawable) void nxagentInitSplitResources(void) { - int resource; - #ifdef TEST fprintf(stderr, "nxagentInitSplitResources: Initializing the split resources.\n"); #endif - for (resource = 0; resource < NXNumberOfResources; resource++) + for (int resource = 0; resource < NXNumberOfResources; resource++) { SplitResourcePtr pResource = &nxagentSplitResources[resource]; @@ -95,8 +93,6 @@ SplitResourcePtr nxagentAllocSplitResource(void) { int resource; - SplitResourcePtr pResource; - for (;;) { resource = NXAllocSplit(nxagentDisplay, NXAnyResource); @@ -122,7 +118,7 @@ FIXME: Must deal with the case all resources are exausted. } } - pResource = &nxagentSplitResources[resource]; + SplitResourcePtr pResource = &nxagentSplitResources[resource]; if (pResource -> pending != 0 || pResource -> split != NXNoResource || pResource -> unpack != NXNoResource || pResource -> drawable != NULL || @@ -215,13 +211,11 @@ FIXME: This must be implemented. void nxagentReleaseAllSplits(void) { - int resource; - #ifdef TEST fprintf(stderr, "nxagentReleaseAllSplits: Going to release all the split resources.\n"); #endif - for (resource = 0; resource < NXNumberOfResources; resource++) + for (int resource = 0; resource < NXNumberOfResources; resource++) { SplitResourcePtr pResource = &nxagentSplitResources[resource]; @@ -327,11 +321,9 @@ static void nxagentCheckResource(SplitResourcePtr pResource, int resource) int nxagentCreateSplit(DrawablePtr pDrawable, GCPtr *pGC) { - SplitResourcePtr pResource; - pDrawable = nxagentSplitDrawable(pDrawable); - pResource = nxagentAllocSplitResource(); + SplitResourcePtr pResource = nxagentAllocSplitResource(); if (pDrawable -> type == DRAWABLE_PIXMAP) { @@ -402,11 +394,9 @@ FIXME: What do we do here? void nxagentRegionSplit(DrawablePtr pDrawable, RegionPtr pRegion) { - SplitResourcePtr pResource; - pDrawable = nxagentSplitDrawable(pDrawable); - pResource = nxagentSplitResource(pDrawable); + SplitResourcePtr pResource = nxagentSplitResource(pDrawable); #ifdef TEST @@ -445,11 +435,9 @@ void nxagentRegionSplit(DrawablePtr pDrawable, RegionPtr pRegion) void nxagentReleaseSplit(DrawablePtr pDrawable) { - SplitResourcePtr pResource; - pDrawable = nxagentSplitDrawable(pDrawable); - pResource = nxagentSplitResource(pDrawable); + SplitResourcePtr pResource = nxagentSplitResource(pDrawable); if (pResource == NULL) { @@ -551,11 +539,9 @@ void nxagentReleaseSplit(DrawablePtr pDrawable) void nxagentValidateSplit(DrawablePtr pDrawable, RegionPtr pRegion) { - SplitResourcePtr pResource; - pDrawable = nxagentSplitDrawable(pDrawable); - pResource = nxagentSplitResource(pDrawable); + SplitResourcePtr pResource = nxagentSplitResource(pDrawable); if (pResource == NULL) { |