* Walker to find a motion node that matches a particular motionID */
| 2308 | * Walker to find a motion node that matches a particular motionID |
| 2309 | */ |
| 2310 | static bool |
| 2311 | MotionFinderWalker(Plan *node, |
| 2312 | void *context) |
| 2313 | { |
| 2314 | Assert(context); |
| 2315 | MotionFinderContext *ctx = (MotionFinderContext *) context; |
| 2316 | |
| 2317 | |
| 2318 | if (node == NULL) |
| 2319 | return false; |
| 2320 | |
| 2321 | if (IsA(node, Motion)) |
| 2322 | { |
| 2323 | Motion *m = (Motion *) node; |
| 2324 | if (m->motionID == ctx->motionId) |
| 2325 | { |
| 2326 | ctx->motion = m; |
| 2327 | return true; /* found our node; no more visit */ |
| 2328 | } |
| 2329 | } |
| 2330 | |
| 2331 | /* Continue walking */ |
| 2332 | return plan_tree_walker((Node*)node, MotionFinderWalker, ctx, true); |
| 2333 | } |
| 2334 | |
| 2335 | /* |
| 2336 | * Given the Plan and a Slice index, find the motion node that is the root of the slice's subtree. |
no test coverage detected