Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.lang.c Subject: Re: Programming exercise/challenge Date: Thu, 07 Jan 2021 01:54:11 -0800 Organization: A noiseless patient Spider Lines: 33 Message-ID: <86a6tlqdh8.fsf@linuxsc.com> References: <86wnxwkyol.fsf@linuxsc.com> <86r1o1hxtn.fsf@linuxsc.com> <20201209030320.4dad4f2c624e613bd47fceed@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="c154dc4d172b443324888acc44505703"; logging-data="9026"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+UXedduJClV0TA8p1RN9E37KRK4kSbg08=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:wsiuDRrPmLiLAaR47pSRgY+tivY= sha1:I+I3mEp33dogz7cBg0/G/62k6Mo= Xref: csiph.com comp.lang.c:158246 Bart writes: > On 09/12/2020 12:21, Bart wrote: >> [...] > > I had to use this program for real today, and that's when I found > out it didn't work! > > This last line should be: > > if (c!='\\' && peekchar=='\"') instring=0; > > otherwise the string continues until the next ' rather than " > character. I made a new version incorporating this change, relative to your version 3 (and am treating it as version 4). This change is an improvement but there are still some important problems. How much other testing have you done? > (I needed to find a function in a file but the name of it was used > myriad times in 1000s of lines of comments. The file was the > 11,500-line sqlite3.h which is probably beyond the capability of > solutions that recurse by character anyway.) Several of the systems I work on have sqlite3.h in /usr/include, slightly smaller than the one you describe but roughly the same size. For a test I made a large file with all the .h files in the /usr/include directory tree, which was then replicated 12 times, resulting in a file of more than one gigabyte. The program I posted (including all the character-level recursive tail calls) processed the gigabyte+ input file with no problem.