[PATCH:twm] Add some const.

Thomas Klausner wiz at NetBSD.org
Wed Sep 23 01:58:32 PDT 2015


From: Christos Zoulas <christos at NetBSD.org>

Signed-off-by: Thomas Klausner <wiz at NetBSD.org>
---
 src/util.c | 4 ++--
 src/util.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/util.c b/src/util.c
index 4b94051..5e8f0db 100644
--- a/src/util.c
+++ b/src/util.c
@@ -256,11 +256,11 @@ Zoom(Window wf, Window wt)
  *  \param name  the filename to expand
  */
 char *
-ExpandFilename(char *name)
+ExpandFilename(const char *name)
 {
     char *newname;
 
-    if (name[0] != '~') return name;
+    if (name[0] != '~') return strdup(name);
 
     newname = malloc (HomeLen + strlen(name) + 2);
     if (!newname) {
diff --git a/src/util.h b/src/util.h
index 7f4527c..4b2d3a8 100644
--- a/src/util.h
+++ b/src/util.h
@@ -64,7 +64,7 @@ in this Software without prior written authorization from The Open Group.
 extern void MoveOutline ( Window root, int x, int y, int width, int height,
 			  int bw, int th );
 extern void Zoom ( Window wf, Window wt );
-extern char * ExpandFilename ( char *name );
+extern char * ExpandFilename ( const char *name );
 extern void GetUnknownIcon ( const char *name );
 extern Pixmap FindBitmap ( const char *name, unsigned int *widthp,
 			   unsigned int *heightp );
-- 
2.5.2



More information about the xorg-devel mailing list