[v2] xkbtext: fix copy-paste error

Submitted by Konstantin Kharlamov on March 24, 2019, 10:20 p.m.

Details

Message ID 20190324222015.776-1-Hi-Angel@yandex.ru
State New
Headers show
Series "Fix some of LGTM warnings" ( rev: 2 ) in X.org

Not browsing as part of any series.

Commit Message

Konstantin Kharlamov March 24, 2019, 10:20 p.m.
As can be seen in diff, nOut is always 0 here. The code was likely
copy-pasted from comparisons further below.

Fixes LGTM warning "Comparison is always false because nOut <= 0."

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
---

v2: Walter Harms: simplify the code even further by passing the string
to TryCopyStr()

 xkb/xkbtext.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/xkb/xkbtext.c b/xkb/xkbtext.c
index d2a2567fc..5a2bc5a94 100644
--- a/xkb/xkbtext.c
+++ b/xkb/xkbtext.c
@@ -966,8 +966,7 @@  CopySetLockControlsArgs(XkbDescPtr xkb, XkbAction *action, char *buf, int *sz)
         int nOut = 0;
 
         if (tmp & XkbRepeatKeysMask) {
-            snprintf(tbuf, sizeof(tbuf), "%sRepeatKeys", (nOut > 0 ? "+" : ""));
-            TryCopyStr(buf, tbuf, sz);
+            TryCopyStr(buf, "RepeatKeys", sz);
             nOut++;
         }
         if (tmp & XkbSlowKeysMask) {