]> git.lyx.org Git - features.git/commitdiff
Do not initialize a var to a val that's never used
authorScott Kostyshak <skostysh@lyx.org>
Sat, 19 Dec 2015 02:58:22 +0000 (21:58 -0500)
committerScott Kostyshak <skostysh@lyx.org>
Sun, 3 Jan 2016 16:57:19 +0000 (11:57 -0500)
By initializing 'to' to a value, the code made it seem like that
value mattered. But the value is overwritten in getWord().

Further, now if 'to' is used before it is initialized, there might
be a useful compiler warning that could point to a bug.

src/Text.cpp

index 80babde39a58a65b8361faab62e329891f5c9f1e..fe59cb3f7108170c3ded2b0cc5d0c8ece3c37f2c 100644 (file)
@@ -1266,7 +1266,7 @@ void Text::selectWord(Cursor & cur, word_location loc)
 {
        LBUFERR(this == cur.text());
        CursorSlice from = cur.top();
-       CursorSlice to = cur.top();
+       CursorSlice to;
        getWord(from, to, loc);
        if (cur.top() != from)
                setCursor(cur, from.pit(), from.pos());