[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: src/data/procedure.c:808
From: |
Ben Pfaff |
Subject: |
Re: src/data/procedure.c:808 |
Date: |
Fri, 20 Oct 2006 20:43:15 -0700 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) |
John Darrington <address@hidden> writes:
> Isn't the right hand side of this statement redundant ?
>
> ok = trns_chain_destroy (ds->temporary_trns_chain) && ok;
I don't think so. If `ok' was false before this, then it is
false afterward. If trns_chain_destroy fails here, then `ok' is
false afterward. Otherwise, `ok' is true afterward.
The order of the && operands can't be reversed, because that
would keep trns_chain_destroy from being called if `ok' was
already false.
It could be rewritten as:
if (!trns_chain_destroy (ds->temporary_trns_chain))
ok = false;
If you find that easier to read, I wouldn't object. It is more
straightforward to read. I used this idiom a few other places in
that file (search for `&&'), so you might want to update those
too, if you decide to change this one.
> Also, I wonder about the next two lines:
>
> ds->permanent_trns_chain = ds->cur_trns_chain = trns_chain_create ();
> ds->temporary_trns_chain = NULL;
>
> Why assign ds->permanent_trns_chain to something, and then to
> immediately to something else?
I don't think I understand the question.
ds->permanent_trns_chain is only assigned to once in those lines.
--
Ben Pfaff
email: address@hidden
web: http://benpfaff.org