Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Michael S Newsgroups: comp.lang.c Subject: Re: filling area by color atack safety Date: Wed, 20 Mar 2024 15:44:38 +0200 Organization: A noiseless patient Spider Lines: 51 Message-ID: <20240320154438.000071c5@yahoo.com> References: <20240317182520.00002390@yahoo.com> <20240320011759.00005e2d@yahoo.com> <20240320120604.0000659d@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Injection-Info: dont-email.me; posting-host="92be935da1beff2666dcf9ddcb3e2080"; logging-data="1601670"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19FXn5LtlDZgPi7G6eLpRDYArN3rcg4WMk=" Cancel-Lock: sha1:A17lsh8ZIub5zy3Ius/6wd+hVI0= X-Newsreader: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32) Bytes: 2648 On Wed, 20 Mar 2024 13:44:04 +0100 fir wrote: > Michael S wrote: > > On Wed, 20 Mar 2024 00:30:56 +0100 > > fir wrote: > > > >> Michael S wrote: > >>> On Wed, 20 Mar 2024 00:03:04 +0100 > >>> fir wrote: > >>>> im not quite sure what you do here.. pass the structure? in fact > >>>> the thing you name context you may not pass at all just make is > >>>> standalone static variables becouse they/it is the same for whole > >>>> "branch" (given recursive branch of recolorisation) > >>>> > >>>> something like > >>>> > >>>> int old_color = 0xff0000; > >>>> int new_color = 0x00ff00; > >>>> > >>>> void RecolorizePixelAndAdjacentPixels(int x, int y) > >>>> { > >>>> //... > >>>> } > >>>> > >>>> > >>> > >>> Not thred-safe. > >>> > >> some thread safe as previous, > > > > The same as your previous. > > But I was modifying Malcolm's recursive variant rather than yours. > > Malcolm's was thread-safe. > > > > > > > sure, i dont always read into peoples code.. i just wanted to say it > seems you pass this context structure or pointer to it Yes, pointer. That's the whole point of my modification of Malcolm's code - to copy one pointer instead of 5 variables that are never changed. > down the stack > each call - it is not necessary Not necessary if you don't want it thread-safe. Necessary otherwise.