From e667b9054308dd2033d3771a0656dd485286e855 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 10 Aug 2013 22:18:00 -0700 Subject: Fix const handling in XSetLocaleModifiers Instead of reusing the input parameter to store the output, make a result variable instead, so that there's less const confusion. Fixes gcc warnings: lcWrap.c: In function 'XSetLocaleModifiers': lcWrap.c:87:18: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual] lcWrap.c:91:25: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual] lcWrap.c:93:12: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual] Signed-off-by: Alan Coopersmith Backported-to-NX-by: Ulrich Sibiller --- nx-X11/lib/X11/lcWrap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'nx-X11/lib/X11/lcWrap.c') diff --git a/nx-X11/lib/X11/lcWrap.c b/nx-X11/lib/X11/lcWrap.c index 47581f8f8..358748fdc 100644 --- a/nx-X11/lib/X11/lcWrap.c +++ b/nx-X11/lib/X11/lcWrap.c @@ -77,20 +77,20 @@ XSetLocaleModifiers( { XLCd lcd = _XlcCurrentLC(); char *user_mods; + char *mapped_mods; if (!lcd) return (char *) NULL; if (!modifiers) return lcd->core->modifiers; user_mods = getenv("XMODIFIERS"); - modifiers = (*lcd->methods->map_modifiers) (lcd, - user_mods, (char *)modifiers); - if (modifiers) { + mapped_mods = (*lcd->methods->map_modifiers) (lcd, user_mods, modifiers); + if (mapped_mods) { if (lcd->core->modifiers) Xfree(lcd->core->modifiers); - lcd->core->modifiers = (char *)modifiers; + lcd->core->modifiers = mapped_mods; } - return (char *)modifiers; + return mapped_mods; } Bool -- cgit v1.2.3 From c161df4fee61819a28089682963cc2e721ca22c8 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 10 Aug 2013 23:51:08 -0700 Subject: Remove even more casts of return values from Xmalloc/Xrealloc Signed-off-by: Alan Coopersmith Backported-to-NX-by: Ulrich Sibiller --- nx-X11/lib/X11/lcWrap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'nx-X11/lib/X11/lcWrap.c') diff --git a/nx-X11/lib/X11/lcWrap.c b/nx-X11/lib/X11/lcWrap.c index 358748fdc..b71de7abb 100644 --- a/nx-X11/lib/X11/lcWrap.c +++ b/nx-X11/lib/X11/lcWrap.c @@ -218,7 +218,7 @@ _XlcAddLoader( _XlcRemoveLoader(proc); /* remove old loader, if exist */ - loader = (XlcLoaderList) Xmalloc(sizeof(XlcLoaderListRec)); + loader = Xmalloc(sizeof(XlcLoaderListRec)); if (loader == NULL) return False; @@ -293,7 +293,7 @@ _XOpenLC( for (loader = loader_list; loader; loader = loader->next) { lcd = (*loader->proc)(name); if (lcd) { - cur = (XLCdList) Xmalloc (sizeof(XLCdListRec)); + cur = Xmalloc (sizeof(XLCdListRec)); if (cur) { cur->lcd = lcd; cur->ref_count = 1; @@ -565,7 +565,7 @@ _XlcVaToArgList( { XlcArgList args; - *args_ret = args = (XlcArgList) Xmalloc(sizeof(XlcArg) * count); + *args_ret = args = Xmalloc(sizeof(XlcArg) * count); if (args == (XlcArgList) NULL) return; -- cgit v1.2.3 From a98260726b8f878e72223899e21ad87882389e2d Mon Sep 17 00:00:00 2001 From: walter harms Date: Sat, 7 Jun 2014 15:17:27 +0200 Subject: libX11: rm redundante NULL checks This patch removes the last remaining NULL checks for Xfree() Signed-off-by: Harms Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer Backported-to-NX-by: Ulrich Sibiller --- nx-X11/lib/X11/lcWrap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'nx-X11/lib/X11/lcWrap.c') diff --git a/nx-X11/lib/X11/lcWrap.c b/nx-X11/lib/X11/lcWrap.c index b71de7abb..067c501ba 100644 --- a/nx-X11/lib/X11/lcWrap.c +++ b/nx-X11/lib/X11/lcWrap.c @@ -86,8 +86,7 @@ XSetLocaleModifiers( user_mods = getenv("XMODIFIERS"); mapped_mods = (*lcd->methods->map_modifiers) (lcd, user_mods, modifiers); if (mapped_mods) { - if (lcd->core->modifiers) - Xfree(lcd->core->modifiers); + Xfree(lcd->core->modifiers); lcd->core->modifiers = mapped_mods; } return mapped_mods; -- cgit v1.2.3