On Tue 16.Mar'10 at 16:12:37 +0100, Carlos R. Mafra wrote:
> On Tue 16.Mar'10 at 16:04:00 +0100, Tamas TEVESZ wrote:
> > On Tue, 16 Mar 2010, Carlos R. Mafra wrote:

> >  > I think the first one can be fixed by making wstrdup() use 'const char 
> > *' in its 
> >  > definition (which I think makes sense). 
> > 
> > indeed it does, but then it will probably trigger another avalanche of 
> > qualifier mismatches :)
> 
> I don't have the time right now, but as wstrdup() has already bothered me
> while I was writing wmgenmenu for not having a const qualifier, I will
> convert it and try to address the fallout.

Ok, I tried it right now instead of drinking coffee, and there seems
to be no fallout from the patch below (which addresses the warning
in WMMkDirHier()).

>From 713727e7e876c399bae3fd6fedaa923a13ec9e5b Mon Sep 17 00:00:00 2001
From: Carlos R. Mafra <[email protected]>
Date: Tue, 16 Mar 2010 16:27:43 +0100
Subject: [PATCH] Constify the argument of wstrdup()

---
 WINGs/WINGs/WUtil.h |    2 +-
 WINGs/string.c      |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/WINGs/WINGs/WUtil.h b/WINGs/WINGs/WUtil.h
index dbf7074..347e70e 100644
--- a/WINGs/WINGs/WUtil.h
+++ b/WINGs/WINGs/WUtil.h
@@ -245,7 +245,7 @@ void wfree(void *ptr);
 void wrelease(void *ptr);
 void* wretain(void *ptr);
 
-char* wstrdup(char *str);
+char *wstrdup(const char *str);
 char* wstrndup(char *str, size_t len);
 
 /* Concatenate str1 with str2 and return that in a newly malloc'ed string.
diff --git a/WINGs/string.c b/WINGs/string.c
index 70277c8..956ad3a 100644
--- a/WINGs/string.c
+++ b/WINGs/string.c
@@ -163,7 +163,7 @@ char *wtrimspace(char *s)
        return c;
 }
 
-char *wstrdup(char *str)
+char *wstrdup(const char *str)
 {
        assert(str != NULL);
 
-- 
1.7.0.2.182.ge007


-- 
To unsubscribe, send mail to [email protected].

Reply via email to