On Sun, Jan 03, 2016 at 11:46:04AM -0500, Richard Heck wrote: > On 01/03/2016 11:18 AM, Scott Kostyshak wrote: > > On Sun, Jan 03, 2016 at 11:01:42AM -0500, Richard Heck wrote: > >> On 01/03/2016 10:59 AM, Scott Kostyshak wrote: > >>> On Sun, Jan 03, 2016 at 02:37:23PM +0100, Jean-Marc Lasgouttes wrote: > >>>> Le 03/01/2016 10:15, Scott Kostyshak a écrit : > >>>>>> Attached patch OK? If so, I would put it in at the beginning of the > >>>>>> 2.3.0 cycle. > >>>>>> From 0edbc7f52f4ecb288389e94f87e7388d5c466166 Mon Sep 17 00:00:00 2001 > >>>>>> From: Scott Kostyshak <skost...@lyx.org> > >>>>>> Date: Fri, 18 Dec 2015 21:58:22 -0500 > >>>>>> Subject: [PATCH] Do not initialize a var to a val that's never used > >>>>>> > >>>>>> 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. > >>>>>> --- > >>>> [...] > >>>>>> @@ -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()); > >>>> The patch is fine, although I am not sure it fixes anything. I dount > >>>> however > >>>> that your comment about to being uninitialized is true, since CursorSlice > >>>> has a default constructor. > >>> Ah right I forgot about that. In this case, I suppose the only benefit > >>> is readability. If Richard gives it a +1, I will put it in. Otherwise I > >>> will forget about it. > >> I don't see any reason not to put it in. And it helps me, at least. > > OK. I will put it in at the beginning of the 2.3 cycle then. > > I'd just do it now. It's the safest possible patch. Doing so avoids a > possible merge conflict somewhere down the way with 2.2.x.
Done at 752c67ad. Scott
signature.asc
Description: PGP signature