[PATCH:libXt] Remove non-USE_SNPRINTF case from src/Error.c

Alan Coopersmith alan.coopersmith at oracle.com
Sun Dec 5 00:24:31 PST 2010


unifdef -DUSE_SNPRINTF src/Error.c
Plus manual removal of old #ifdef notyet section that said not enough
platforms had snprintf support yet.   Welcome to the new millenium!

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 src/Error.c |   18 ++----------------
 1 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/src/Error.c b/src/Error.c
index 1112ef9..fc9b11a 100644
--- a/src/Error.c
+++ b/src/Error.c
@@ -233,11 +233,6 @@ static void DefaultMsg (
     void (*fn)(_Xconst _XtString))
 {
 #define BIGBUF 1024
-#ifdef notyet /* older versions don't, might want to wait until more do */
-#if defined(__linux__)  || defined(CSRG_BASED) /* everyone else needs to get with the program */
-#define USE_SNPRINTF
-#endif
-#endif
     char buffer[BIGBUF];
     char* message;
     XtGetErrorDatabaseText(name,type,class,defaultp, buffer, BIGBUF);
@@ -302,18 +297,9 @@ program as a non-root user or by removing the suid bit on the executable.");
 	 * to be a performance issue.
 	 */
 	if ((message = __XtMalloc (BIGBUF))) {
-#ifndef USE_SNPRINTF
-	    message[BIGBUF-1] = 0;
-	    (void) sprintf (message, buffer,
-#else
 	    (void) snprintf (message, BIGBUF, buffer,
-#endif
-			    par[0], par[1], par[2], par[3], par[4],
-			    par[5], par[6], par[7], par[8], par[9]);
-#ifndef USE_SNPRINTF
-	    if (message[BIGBUF-1] != '\0')
-		XtWarning ("Possible heap corruption in Xt{Error,Warning}MsgHandler");
-#endif
+			     par[0], par[1], par[2], par[3], par[4],
+			     par[5], par[6], par[7], par[8], par[9]);
 	    (*fn)(message);
 	    XtFree(message);
 	} else {
-- 
1.7.3.2



More information about the xorg-devel mailing list