[PATCH] dix: log privates information only when debugging is on

Tiago Vignatti tiago.vignatti at nokia.com
Tue Jun 29 06:04:19 PDT 2010


Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
---
Alternatively we can send this information to the log file. But spits on
stdout by default doesn't seems a good idea, specially when we want to shut up
server's output.

 dix/privates.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/dix/privates.c b/dix/privates.c
index ec818d4..6fb8ad1 100644
--- a/dix/privates.c
+++ b/dix/privates.c
@@ -411,6 +411,7 @@ dixLookupPrivateOffset(RESTYPE type)
     return -1;
 }
 
+#ifdef DEBUG
 static const char *key_names[PRIVATE_LAST] = {
     /* XSELinux uses the same private keys for numerous objects */
     [PRIVATE_XSELINUX] = "XSELINUX",
@@ -440,6 +441,7 @@ static const char *key_names[PRIVATE_LAST] = {
     [PRIVATE_GLYPHSET] = "GLYPHSET",
     [PRIVATE_PICTURE] = "PICTURE",
 };
+#endif
 
 void
 dixPrivateUsage(void)
@@ -451,7 +453,7 @@ dixPrivateUsage(void)
 
     for (t = PRIVATE_XSELINUX + 1; t < PRIVATE_LAST; t++) {
 	if (keys[t].offset) {
-	    ErrorF("%s: %d objects of %d bytes = %d total bytes %d private allocs\n",
+	    DebugF("%s: %d objects of %d bytes = %d total bytes %d private allocs\n",
 		   key_names[t], keys[t].created, keys[t].offset, keys[t].created * keys[t].offset,
 		   keys[t].allocated);
 	    bytes += keys[t].created * keys[t].offset;
@@ -459,7 +461,7 @@ dixPrivateUsage(void)
 	    alloc += keys[t].allocated;
 	}
     }
-    ErrorF("TOTAL: %d objects, %d bytes, %d allocs\n",
+    DebugF("TOTAL: %d objects, %d bytes, %d allocs\n",
 	   objects, bytes, alloc);
 }
 
@@ -481,7 +483,7 @@ dixResetPrivates(void)
 		free(key);
 	}
 	if (keys[t].created) {
-	    ErrorF("%d %ss still allocated at reset\n",
+	    DebugF("%d %ss still allocated at reset\n",
 		   keys[t].created, key_names[t]);
 	    dixPrivateUsage();
 	}
-- 
1.7.1.226.g770c5



More information about the xorg-devel mailing list