summaryrefslogtreecommitdiff
path: root/Xext
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2017-10-24 14:33:19 -0400
committerAdam Jackson <ajax@redhat.com>2017-11-14 16:02:49 -0500
commiteafcd009f1fe3e554219a428237ef1c71d1ba506 (patch)
tree2dac5e6bb7071dc771d1ea01431c5461b4df2e2f /Xext
parent68556d74b49e99d3490166c446079f7d5de26ca4 (diff)
xres: Return the atom naming the type, not its internal type number
Signed-off-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'Xext')
-rw-r--r--Xext/xres.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/Xext/xres.c b/Xext/xres.c
index 02421588a..7a7aabc9b 100644
--- a/Xext/xres.c
+++ b/Xext/xres.c
@@ -274,6 +274,24 @@ ResFindAllRes(void *value, XID id, RESTYPE type, void *cdata)
counts[(type & TypeMask) - 1]++;
}
+static CARD32
+resourceTypeAtom(int i)
+{
+ CARD32 ret;
+
+ const char *name = LookupResourceName(i);
+ if (strcmp(name, XREGISTRY_UNKNOWN))
+ ret = MakeAtom(name, strlen(name), TRUE);
+ else {
+ char buf[40];
+
+ snprintf(buf, sizeof(buf), "Unregistered resource %i", i + 1);
+ ret = MakeAtom(buf, strlen(buf), TRUE);
+ }
+
+ return ret;
+}
+
static int
ProcXResQueryClientResources(ClientPtr client)
{
@@ -318,22 +336,12 @@ ProcXResQueryClientResources(ClientPtr client)
if (num_types) {
xXResType scratch;
- const char *name;
for (i = 0; i < lastResourceType; i++) {
if (!counts[i])
continue;
- name = LookupResourceName(i + 1);
- if (strcmp(name, XREGISTRY_UNKNOWN))
- scratch.resource_type = MakeAtom(name, strlen(name), TRUE);
- else {
- char buf[40];
-
- snprintf(buf, sizeof(buf), "Unregistered resource %i", i + 1);
- scratch.resource_type = MakeAtom(buf, strlen(buf), TRUE);
- }
-
+ scratch.resource_type = resourceTypeAtom(i + 1);
scratch.count = counts[i];
if (client->swapped) {
@@ -693,7 +701,7 @@ AddSubResourceSizeSpec(void *value,
sizeFunc(value, id, &size);
crossRef->spec.resource = id;
- crossRef->spec.type = type;
+ crossRef->spec.type = resourceTypeAtom(type);
crossRef->bytes = size.resourceSize;
crossRef->refCount = size.refCnt;
crossRef->useCount = 1;
@@ -766,7 +774,7 @@ AddResourceSizeValue(void *ptr, XID id, RESTYPE type, void *cdata)
sizeFunc(ptr, id, &size);
value->size.spec.resource = id;
- value->size.spec.type = type;
+ value->size.spec.type = resourceTypeAtom(type);
value->size.bytes = size.resourceSize;
value->size.refCount = size.refCnt;
value->size.useCount = 1;