Message9946
Until now I actually did not look into the detailes of PyDequeue and just wrote traverseprocs to catch all non-static fields somehow.
However. Since it appears to be a doubly linked, circular list-structure, simply watching out for header is probably more efficient than using general purpose reflection-based traversal. I would add some improvement to your variant though. The iteration should be done in a non-recursive way to avoid bothering Java's stack unnecessarily:
@Override
public int traverse(Visitproc visit, Object arg) {
if (header == null) {
return 0;
}
int retVal = 0;
if (header.data != null) {
retVal = visit.visit(header.data, arg);
if (retVal != 0) {
return retVal;
}
}
Node tmp = header.right;
while (tmp != header) {
if (tmp.data != null) {
retVal = visit.visit(tmp.data, arg);
if (retVal != 0) {
return retVal;
}
}
tmp = tmp.right;
}
return retVal;
}
This seems to work, but I'd appreciate if you could review this iteration to make sure I did not mess up anything. |
|
Date |
User |
Action |
Args |
2015-04-24 00:26:18 | stefan.richthofer | set | messageid: <1429835178.22.0.271369277052.issue2337@psf.upfronthosting.co.za> |
2015-04-24 00:26:18 | stefan.richthofer | set | recipients:
+ stefan.richthofer, jmadden |
2015-04-24 00:26:18 | stefan.richthofer | link | issue2337 messages |
2015-04-24 00:26:17 | stefan.richthofer | create | |
|