Download raw body.
tog: unconditionally set x/y in view_get_split()
On 22-06-30 09:05am, Omar Polo wrote: > Mark Jamsek <mark@jamsek.com> wrote: > > Suggested by op on irc. > > > > I noticed this when cooking the diff. We initialise begin_{x,y} in all > > the callers so only conditionally set x/y pointers in view_get_split(). > > > > But for robustness, we should initialise here too. > > yep! what i was thinking is that maybe in the future someone calls > view_get_split without knowing that only one of the pointers is written > to and if they don't initialize the values to something sensible before > it'll be fun :) It's definitely the correct thing to do and I'm questioning why I didn't just do it originally. I checked all the callers and decided not to. But we'll be calling this a lot more as we expand hsplits to more child views and then add key maps, so it's bound to have happened eventually! I've probably chased down as many bugs from uninitialised vars as OB1s :) > > diff 9b058f456d15d60a89334ce3e7f0a7c22e182c55 /Users/mark/Library/Mobile Documents/com~apple~CloudDocs/src/got-current > > blob - 6a0c6dbff39ee1a8db173cbc3fa1fbf0918eecab > > file + tog/tog.c > > --- tog/tog.c > > +++ tog/tog.c > > @@ -2858,6 +2858,9 @@ view_get_split(struct tog_view *view, int *y, int *x) > > { > > char *mode; > > > > + *x = 0; > > + *y = 0; > > + > > mode = getenv("TOG_VIEW_SPLIT_MODE"); > > > > if (!mode || mode[0] != 'h') { > > -- Mark Jamsek <fnc.bsdbox.org> GPG: F2FF 13DE 6A06 C471 CA80 E6E2 2930 DC66 86EE CF68
tog: unconditionally set x/y in view_get_split()