Now that we don't need to separately strlen the format string, put it
directly into the function call to clear gcc warnings of:
Initialize.c:397: warning: format not a string literal, argument types not 
checked

Signed-off-by: Alan Coopersmith <[email protected]>
---
 src/Initialize.c |   25 ++++++++++---------------
 1 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/src/Initialize.c b/src/Initialize.c
index 2e70e39..87d59e5 100644
--- a/src/Initialize.c
+++ b/src/Initialize.c
@@ -380,7 +380,7 @@ static void CombineAppUserDefaults(
     XrmDatabase *pdb)
 {
     char* filename;
-    char* path;
+    char* path = NULL;
     Boolean deallocate = False;
 
     if (!(path = getenv("XUSERFILESEARCHPATH"))) {
@@ -389,20 +389,14 @@ static void CombineAppUserDefaults(
        char homedir[PATH_MAX];
        GetRootDirName(homedir, PATH_MAX);
        if (!(old_path = getenv("XAPPLRESDIR"))) {
-           char *path_default = 
"%s/%%L/%%N%%C:%s/%%l/%%N%%C:%s/%%N%%C:%s/%%L/%%N:%s/%%l/%%N:%s/%%N";
-           if (!(path =
-                 ALLOCATE_LOCAL(6*strlen(homedir) + strlen(path_default))))
-               _XtAllocError(NULL);
-           sprintf( path, path_default,
-                   homedir, homedir, homedir, homedir, homedir, homedir );
+           XtAsprintf(&path,
+                      
"%s/%%L/%%N%%C:%s/%%l/%%N%%C:%s/%%N%%C:%s/%%L/%%N:%s/%%l/%%N:%s/%%N",
+                      homedir, homedir, homedir, homedir, homedir, homedir );
        } else {
-           char *path_default = 
"%s/%%L/%%N%%C:%s/%%l/%%N%%C:%s/%%N%%C:%s/%%N%%C:%s/%%L/%%N:%s/%%l/%%N:%s/%%N:%s/%%N";
-           if (!(path =
-                 ALLOCATE_LOCAL( 6*strlen(old_path) + 2*strlen(homedir)
-                                + strlen(path_default))))
-               _XtAllocError(NULL);
-           sprintf(path, path_default, old_path, old_path, old_path, homedir,
-                   old_path, old_path, old_path, homedir );
+           XtAsprintf(&path,
+                      
"%s/%%L/%%N%%C:%s/%%l/%%N%%C:%s/%%N%%C:%s/%%N%%C:%s/%%L/%%N:%s/%%l/%%N:%s/%%N:%s/%%N",
+                      old_path, old_path, old_path, homedir,
+                      old_path, old_path, old_path, homedir );
        }
        deallocate = True;
 #endif
@@ -414,7 +408,8 @@ static void CombineAppUserDefaults(
        XtFree(filename);
     }
 
-    if (deallocate) DEALLOCATE_LOCAL(path);
+    if (deallocate)
+       XtFree(path);
 }
 
 static void CombineUserDefaults(
-- 
1.7.3.2

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to