pspp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simpler-Proc GUI patch


From: Ben Pfaff
Subject: Re: Simpler-Proc GUI patch
Date: Thu, 24 May 2007 20:37:39 -0700
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

John Darrington <address@hidden> writes:

> Index: src/data/casereader.c
> ===================================================================
> RCS file: /sources/pspp/pspp/src/data/Attic/casereader.c,v
> retrieving revision 1.1.2.8
> diff -b -w -U 3 -r1.1.2.8 casereader.c
> --- src/data/casereader.c     7 May 2007 05:16:08 -0000       1.1.2.8
> +++ src/data/casereader.c     24 May 2007 05:00:51 -0000
> @@ -233,16 +233,19 @@
>  {
>    if (reader->case_cnt == CASENUMBER_MAX) 
>      {
> +      casenumber n_cases = 0;
>        struct casereader *clone;
>        struct ccase c;
>  
> -      reader->case_cnt = 0;
> -
>        clone = casereader_clone (reader);
> +
>        for (; casereader_read (clone, &c); case_destroy (&c)) 
> -        reader->case_cnt++;
> +        n_cases++;
> +
>        casereader_destroy (clone);
> +      return n_cases;
>      }
> +
>    return reader->case_cnt;
>  }

I can see that there was a bug here, now that you draw attention
to it: if casereader_read indirectly reads case_cnt while it is
still changing, then it could cause some confusion.  But one of
the constraints on casereader implementations is that, once the
number of cases is known, it can never change (barring I/O
error).  Thus, I'd change the "return n_cases;" line here to
"reader->case_cnt = n_cases;" so that the case count is cached
for later.  If that introduces a problem, then there's probably
something wrong elsewhere.

I'm happy with the other changes.

Thanks very much for looking at this.  I've had no time for PSPP
in the last week or so, I'm very busy with Pintos stuff.  Maybe
over the weekend I'll get back to PSPP.
-- 
God leaned close as mud as man sat up, looked around, and spoke.  Man blinked.
"What is the purpose of all this?" he asked politely.  "Everything must have a
purpose?" asked God.  "Certainly," said man.  "Then I leave it to you to think
of one for all this," said God.  And He went away.  --Vonnegut, _Cat's Cradle_




reply via email to

[Prev in Thread] Current Thread [Next in Thread]