[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Re[2]: [gnugo-devel] sgf/sgfnode.c possible error
From: |
Paul Pogonyshev |
Subject: |
Re: Re[2]: [gnugo-devel] sgf/sgfnode.c possible error |
Date: |
Thu, 16 Sep 2004 01:38:44 -0200 |
User-agent: |
KMail/1.4.3 |
Dmitri Koulikov wrote:
> Hello Paul Pogonyshev,
>
> Wednesday, September 15, 2004, 6:04:20 PM, you wrote:
>
> PP> A little fix:
>
> PP> if (node->parent && node->parent->child != node) {
> PP> previous = node->parent->child;
> PP> while (previous->next != node)
> PP> previous = previous->next;
> PP> }
> PP> else
> PP> previous = NULL;
>
> That means that 'parent' never shows to the sibling, isn't it?
Right.
> But consider:
>
> sgfStartVariant(SGFNode *node)
> {
> assert(node);
>
> while (node->next)
> node = node->next;
> node->next = sgfNewNode();
> - node->next->parent = node;
> + node->next->parent = node->parent;
>
> return node->next;
> }
Indeed, when you point at the error directly, I can see it.
> SGFNode *
> sgfStartVariantFirst(SGFNode *node)
> {
> SGFNode *old_first_child = node;
> SGFNode *new_first_child = sgfNewNode();
>
> new_first_child->next = old_first_child;
> if (old_first_child->parent)
> new_first_child->parent = old_first_child->parent;
> - old_first_child->parent = new_first_child;
> if (new_first_child->parent)
> new_first_child->parent->child = new_first_child;
>
> return new_first_child;
> }
I also removed `if (old_first_child->parent)' line. The
patch is below, I'll install it in CVS when this message
gets into mailing list's archive.
Actually, it would make sense to assert for `node->parent's
being non-NULL, but since we are going to release 3.6 soon
and I'm not sure that this assertion will not fail (the
code is quite messy), I'm leaving this out.
BTW, you may want to know that we don't generate patches
(differences with +/- lines) by hands, there is a program
for it, called `diff'. Since you use Windows, you may try
either Cygwin (a full-blown emulator of UNIX-like systems)
or WinCVS, a Windows port of CVS + `diff' and `patch' tools
+ GUI for these things.
Thank you for pointing us to this problem.
Paul
--- sgfnode.c 12 Feb 2004 19:34:20 -0200 1.27
+++ sgfnode.c 16 Sep 2004 01:33:28 -0200
@@ -710,7 +710,7 @@ sgfStartVariant(SGFNode *node)
while (node->next)
node = node->next;
node->next = sgfNewNode();
- node->next->parent = node;
+ node->next->parent = node->parent;
return node->next;
}
@@ -727,9 +727,8 @@ sgfStartVariantFirst(SGFNode *node)
SGFNode *new_first_child = sgfNewNode();
new_first_child->next = old_first_child;
- if (old_first_child->parent)
- new_first_child->parent = old_first_child->parent;
- old_first_child->parent = new_first_child;
+ new_first_child->parent = old_first_child->parent;
+
if (new_first_child->parent)
new_first_child->parent->child = new_first_child;
- [gnugo-devel] sgf/sgfnode.c possible error, Dmitri Koulikov, 2004/09/14
- Re: [gnugo-devel] sgf/sgfnode.c possible error, Paul Pogonyshev, 2004/09/15
- Re: [gnugo-devel] sgf/sgfnode.c possible error, Paul Pogonyshev, 2004/09/15
- Message not available
- Re: Re[2]: [gnugo-devel] sgf/sgfnode.c possible error,
Paul Pogonyshev <=
- Re: Re[2]: [gnugo-devel] sgf/sgfnode.c possible error, Paul Pogonyshev, 2004/09/15
- Re[4]: [gnugo-devel] sgf/sgfnode.c possible error, Dmitri Koulikov, 2004/09/16
- Re: Re[4]: [gnugo-devel] sgf/sgfnode.c possible error, Paul Pogonyshev, 2004/09/16
- Re[6]: [gnugo-devel] sgf/sgfnode.c possible error, Dmitri Koulikov, 2004/09/17
- Re: Re[6]: [gnugo-devel] sgf/sgfnode.c possible error, Paul Pogonyshev, 2004/09/17
- [gnugo-devel] sgf/sgfnode.c more inproverment, Dmitri Koulikov, 2004/09/19
- Re: [gnugo-devel] sgf/sgfnode.c more inproverment, Paul Pogonyshev, 2004/09/19
- Re: Re[2]: [gnugo-devel] sgf/sgfnode.c possible error, Arend Bayer, 2004/09/22
- Re: Re[2]: [gnugo-devel] sgf/sgfnode.c possible error, Paul Pogonyshev, 2004/09/22