summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <michael.drake@codethink.co.uk>2021-07-09 19:23:03 +0100
committerMichael Drake <michael.drake@codethink.co.uk>2021-07-09 19:23:03 +0100
commitade633dd4a93360cb25fbabc05c749a45950b8b9 (patch)
tree5d85b8aca3ba8b21afb21f0dfbc32996e1914882
parent631f016a9ccff344f4dcb0b57e8ef1cf275e175c (diff)
downloadlibdom-master.tar.gz
libdom-master.tar.bz2
DOM Walker: Rename client private word parameter.HEADmaster
-rw-r--r--examples/dom-structure-dump.c4
-rw-r--r--include/dom/walk.h8
-rw-r--r--src/utils/walk.c12
3 files changed, 12 insertions, 12 deletions
diff --git a/examples/dom-structure-dump.c b/examples/dom-structure-dump.c
index 2cdc7c5..189292d 100644
--- a/examples/dom-structure-dump.c
+++ b/examples/dom-structure-dump.c
@@ -259,9 +259,9 @@ enum dom_walk_cmd dump_dom_structure__cb(
enum dom_walk_stage stage,
dom_node_type type,
dom_node *node,
- void *ctx)
+ void *pw)
{
- int *depth = ctx;
+ int *depth = pw;
switch (type) {
case DOM_ELEMENT_NODE:
diff --git a/include/dom/walk.h b/include/dom/walk.h
index 0cd3fd0..5de3546 100644
--- a/include/dom/walk.h
+++ b/include/dom/walk.h
@@ -37,14 +37,14 @@ enum dom_walk_cmd {
* \param[in] stage Whether the \ref node is being entered or left.
* \param[in] node The node being walked. Client must take ref itself.
* \param[in] type The node type.
- * \param[in] ctx Client private data.
+ * \param[in] pw Client private data.
* \return Tree walking client command.
*/
typedef enum dom_walk_cmd (*dom_walk_cb)(
enum dom_walk_stage stage,
dom_node_type type,
dom_node *node,
- void *ctx);
+ void *pw);
/**
@@ -53,13 +53,13 @@ typedef enum dom_walk_cmd (*dom_walk_cb)(
* \param[in] mask Mask of stages to enable callback for.
* \param[in] cb The client callback function.
* \param[in] root Node to start walk from.
- * \param[in] ctx The client's private data.
+ * \param[in] pw The client's private data.
* \return false for early termination of walk, true otherwise.
*/
dom_exception libdom_treewalk(
enum dom_walk_enable mask,
dom_walk_cb cb,
dom_node *root,
- void *ctx);
+ void *pw);
#endif
diff --git a/src/utils/walk.c b/src/utils/walk.c
index 20314f3..f103908 100644
--- a/src/utils/walk.c
+++ b/src/utils/walk.c
@@ -19,7 +19,7 @@
* \param[in] stage Whether the \ref node is being entered or left.
* \param[in] node The node being walked.
* \param[in] cb The client callback function.
- * \param[in] ctx The client's private data.
+ * \param[in] pw The client's private data.
* \param[out] cmd_out Walk instruction from client.
* \return false for early termination of walk, true otherwise.
*/
@@ -28,7 +28,7 @@ static inline dom_exception dom_walk__cb(
enum dom_walk_stage stage,
dom_node *node,
dom_walk_cb cb,
- void *ctx,
+ void *pw,
enum dom_walk_cmd *cmd_out)
{
if ((1 << stage) & mask) {
@@ -40,7 +40,7 @@ static inline dom_exception dom_walk__cb(
return exc;
}
- *cmd_out = cb(stage, type, node, ctx);
+ *cmd_out = cb(stage, type, node, pw);
}
return DOM_NO_ERR;
@@ -51,7 +51,7 @@ dom_exception libdom_treewalk(
enum dom_walk_enable mask,
dom_walk_cb cb,
dom_node *root,
- void *ctx)
+ void *pw)
{
dom_node *node;
dom_exception exc;
@@ -77,7 +77,7 @@ dom_exception libdom_treewalk(
/* No children; siblings & ancestor's siblings */
while (node != root) {
exc = dom_walk__cb(mask, DOM_WALK_STAGE_LEAVE,
- node, cb, ctx, &cmd);
+ node, cb, pw, &cmd);
if (exc != DOM_NO_ERR ||
cmd == DOM_WALK_CMD_ABORT) {
dom_node_unref(node);
@@ -118,7 +118,7 @@ dom_exception libdom_treewalk(
assert(node != root);
exc = dom_walk__cb(mask, DOM_WALK_STAGE_ENTER, node,
- cb, ctx, &cmd);
+ cb, pw, &cmd);
if (exc != DOM_NO_ERR) {
return exc;
}