Commit bcca3199 authored by Ulrich Sibiller's avatar Ulrich Sibiller

Split.c: scope improvements/code simplification

parent 53b3d4df
...@@ -71,13 +71,11 @@ DrawablePtr nxagentSplitDrawable(DrawablePtr pDrawable) ...@@ -71,13 +71,11 @@ DrawablePtr nxagentSplitDrawable(DrawablePtr pDrawable)
void nxagentInitSplitResources(void) void nxagentInitSplitResources(void)
{ {
int resource;
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentInitSplitResources: Initializing the split resources.\n"); fprintf(stderr, "nxagentInitSplitResources: Initializing the split resources.\n");
#endif #endif
for (resource = 0; resource < NXNumberOfResources; resource++) for (int resource = 0; resource < NXNumberOfResources; resource++)
{ {
SplitResourcePtr pResource = &nxagentSplitResources[resource]; SplitResourcePtr pResource = &nxagentSplitResources[resource];
...@@ -95,8 +93,6 @@ SplitResourcePtr nxagentAllocSplitResource(void) ...@@ -95,8 +93,6 @@ SplitResourcePtr nxagentAllocSplitResource(void)
{ {
int resource; int resource;
SplitResourcePtr pResource;
for (;;) for (;;)
{ {
resource = NXAllocSplit(nxagentDisplay, NXAnyResource); resource = NXAllocSplit(nxagentDisplay, NXAnyResource);
...@@ -122,7 +118,7 @@ FIXME: Must deal with the case all resources are exausted. ...@@ -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 || if (pResource -> pending != 0 || pResource -> split != NXNoResource ||
pResource -> unpack != NXNoResource || pResource -> drawable != NULL || pResource -> unpack != NXNoResource || pResource -> drawable != NULL ||
...@@ -215,13 +211,11 @@ FIXME: This must be implemented. ...@@ -215,13 +211,11 @@ FIXME: This must be implemented.
void nxagentReleaseAllSplits(void) void nxagentReleaseAllSplits(void)
{ {
int resource;
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentReleaseAllSplits: Going to release all the split resources.\n"); fprintf(stderr, "nxagentReleaseAllSplits: Going to release all the split resources.\n");
#endif #endif
for (resource = 0; resource < NXNumberOfResources; resource++) for (int resource = 0; resource < NXNumberOfResources; resource++)
{ {
SplitResourcePtr pResource = &nxagentSplitResources[resource]; SplitResourcePtr pResource = &nxagentSplitResources[resource];
...@@ -327,11 +321,9 @@ static void nxagentCheckResource(SplitResourcePtr pResource, int resource) ...@@ -327,11 +321,9 @@ static void nxagentCheckResource(SplitResourcePtr pResource, int resource)
int nxagentCreateSplit(DrawablePtr pDrawable, GCPtr *pGC) int nxagentCreateSplit(DrawablePtr pDrawable, GCPtr *pGC)
{ {
SplitResourcePtr pResource;
pDrawable = nxagentSplitDrawable(pDrawable); pDrawable = nxagentSplitDrawable(pDrawable);
pResource = nxagentAllocSplitResource(); SplitResourcePtr pResource = nxagentAllocSplitResource();
if (pDrawable -> type == DRAWABLE_PIXMAP) if (pDrawable -> type == DRAWABLE_PIXMAP)
{ {
...@@ -402,11 +394,9 @@ FIXME: What do we do here? ...@@ -402,11 +394,9 @@ FIXME: What do we do here?
void nxagentRegionSplit(DrawablePtr pDrawable, RegionPtr pRegion) void nxagentRegionSplit(DrawablePtr pDrawable, RegionPtr pRegion)
{ {
SplitResourcePtr pResource;
pDrawable = nxagentSplitDrawable(pDrawable); pDrawable = nxagentSplitDrawable(pDrawable);
pResource = nxagentSplitResource(pDrawable); SplitResourcePtr pResource = nxagentSplitResource(pDrawable);
#ifdef TEST #ifdef TEST
...@@ -445,11 +435,9 @@ void nxagentRegionSplit(DrawablePtr pDrawable, RegionPtr pRegion) ...@@ -445,11 +435,9 @@ void nxagentRegionSplit(DrawablePtr pDrawable, RegionPtr pRegion)
void nxagentReleaseSplit(DrawablePtr pDrawable) void nxagentReleaseSplit(DrawablePtr pDrawable)
{ {
SplitResourcePtr pResource;
pDrawable = nxagentSplitDrawable(pDrawable); pDrawable = nxagentSplitDrawable(pDrawable);
pResource = nxagentSplitResource(pDrawable); SplitResourcePtr pResource = nxagentSplitResource(pDrawable);
if (pResource == NULL) if (pResource == NULL)
{ {
...@@ -551,11 +539,9 @@ void nxagentReleaseSplit(DrawablePtr pDrawable) ...@@ -551,11 +539,9 @@ void nxagentReleaseSplit(DrawablePtr pDrawable)
void nxagentValidateSplit(DrawablePtr pDrawable, RegionPtr pRegion) void nxagentValidateSplit(DrawablePtr pDrawable, RegionPtr pRegion)
{ {
SplitResourcePtr pResource;
pDrawable = nxagentSplitDrawable(pDrawable); pDrawable = nxagentSplitDrawable(pDrawable);
pResource = nxagentSplitResource(pDrawable); SplitResourcePtr pResource = nxagentSplitResource(pDrawable);
if (pResource == NULL) if (pResource == NULL)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment