From 4c8417763f4cb3eec70506a0c86fa540b3fae875 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 8 Nov 2024 09:17:50 +0200 Subject: [PATCH] ; Fix quoting style in comments in itree.[ch] files * src/itree.c: * src/itree.h: Fix quoting style in comments. (cherry picked from commit e8b8a1121a8d1826f0ff8874e38594bfaedddfac) --- src/itree.c | 52 ++++++++++++++++++++++++++-------------------------- src/itree.h | 18 +++++++++--------- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/itree.c b/src/itree.c index 749e65c2eed..f35226ad226 100644 --- a/src/itree.c +++ b/src/itree.c @@ -378,9 +378,9 @@ itree_inherit_offset (uintmax_t otick, struct itree_node *node) node->right->offset += node->offset; node->offset = 0; } - /* The only thing that matters about `otick` is whether it's equal to + /* The only thing that matters about 'otick' is whether it's equal to that of the tree. We could also "blindly" inherit from parent->otick, - but we need to tree's `otick` anyway for when there's no parent. */ + but we need to tree's 'otick' anyway for when there's no parent. */ if (node->parent == NULL || node->parent->otick == otick) node->otick = otick; } @@ -683,7 +683,7 @@ itree_insert_node (struct itree_tree *tree, struct itree_node *node) struct itree_node *parent = NULL; struct itree_node *child = tree->root; uintmax_t otick = tree->otick; - /* It's the responsibility of the caller to set `otick` on the node, + /* It's the responsibility of the caller to set 'otick' on the node, to "confirm" that the begin/end fields are up to date. */ eassert (node->otick == otick); @@ -913,8 +913,8 @@ itree_total_offset (struct itree_node *node) link the tree root. Warning: DEST is left unmodified. SOURCE's child links are - unchanged. Caller is responsible for recalculation of `limit`. - Requires both nodes to be using the same effective `offset`. */ + unchanged. Caller is responsible for recalculation of 'limit'. + Requires both nodes to be using the same effective 'offset'. */ static void itree_replace_child (struct itree_tree *tree, struct itree_node *source, @@ -939,8 +939,8 @@ itree_replace_child (struct itree_tree *tree, parent, left and right in surrounding nodes to point to SOURCE. Warning: DEST is left unmodified. Caller is responsible for - recalculation of `limit`. Requires both nodes to be using the same - effective `offset`. */ + recalculation of 'limit'. Requires both nodes to be using the same + effective 'offset'. */ static void itree_transplant (struct itree_tree *tree, struct itree_node *source, @@ -964,38 +964,38 @@ itree_remove (struct itree_tree *tree, struct itree_node *node) eassert (itree_contains (tree, node)); eassert (check_tree (tree, true)); /* FIXME: Too expensive. */ - /* Find `splice`, the leaf node to splice out of the tree. When - `node` has at most one child this is `node` itself. Otherwise, - it is the in order successor of `node`. */ + /* Find 'splice', the leaf node to splice out of the tree. When + 'node' has at most one child this is 'node' itself. Otherwise, + it is the in order successor of 'node'. */ itree_inherit_offset (tree->otick, node); struct itree_node *splice = (node->left == NULL || node->right == NULL) ? node : itree_subtree_min (tree->otick, node->right); - /* Find `subtree`, the only child of `splice` (may be NULL). Note: - `subtree` will not be modified other than changing its parent to - `splice`. */ + /* Find 'subtree', the only child of 'splice' (may be NULL). Note: + 'subtree' will not be modified other than changing its parent to + 'splice'. */ eassert (splice->left == NULL || splice->right == NULL); struct itree_node *subtree = (splice->left != NULL) ? splice->left : splice->right; - /* Save a pointer to the parent of where `subtree` will eventually - be in `subtree_parent`. */ + /* Save a pointer to the parent of where 'subtree' will eventually + be in 'subtree_parent'. */ struct itree_node *subtree_parent = (splice->parent != node) ? splice->parent : splice; - /* If `splice` is black removing it may violate Red-Black + /* If 'splice' is black removing it may violate Red-Black invariants, so note this for later. */ - /* Replace `splice` with `subtree` under subtree's parent. If - `splice` is black, this creates a red-red violation, so remember + /* Replace 'splice' with 'subtree' under subtree's parent. If + 'splice' is black, this creates a red-red violation, so remember this now as the field can be overwritten when splice is transplanted below. */ itree_replace_child (tree, subtree, splice); bool removed_black = !splice->red; - /* Replace `node` with `splice` in the tree and propagate limit + /* Replace 'node' with 'splice' in the tree and propagate limit upwards, if necessary. Note: Limit propagation can stabilize at any point, so we must call from bottom to top for every node that has a new child. */ @@ -1054,8 +1054,8 @@ itree_insert_gap (struct itree_tree *tree, /* Nodes with front_advance starting at pos may mess up the tree order, so we need to remove them first. This doesn't apply for - `before_markers` since in that case, all positions move identically - regardless of `front_advance` or `rear_advance`. */ + 'before_markers' since in that case, all positions move identically + regardless of 'front_advance' or 'rear_advance'. */ struct itree_stack *saved = itree_stack_create (0); struct itree_node *node = NULL; if (!before_markers) @@ -1208,7 +1208,7 @@ itree_node_intersects (const struct itree_node *node, Note that this should return all the nodes that we need to traverse in order to traverse the nodes selected by the current narrowing (i.e. - `ITER->begin..ITER->end`) so it will also return some nodes which aren't in + 'ITER->begin..ITER->end') so it will also return some nodes which aren't in that narrowing simply because they may have children which are. The code itself is very unsatisfactory because the code of each one @@ -1221,8 +1221,8 @@ itree_iter_next_in_subtree (struct itree_node *node, struct itree_iterator *iter) { /* FIXME: Like in the previous version of the iterator, we - prune based on `limit` only when moving to a left child, - but `limit` can also get smaller when moving to a right child + prune based on 'limit' only when moving to a left child, + but 'limit' can also get smaller when moving to a right child It's actually fairly common, so maybe it would be worthwhile to prune a bit more aggressively here. */ struct itree_node *next; @@ -1387,10 +1387,10 @@ itree_iterator_start (struct itree_iterator *iter, iter->end = end; iter->otick = tree->otick; iter->order = order; - /* Beware: the `node` field always holds "the next" node to consider. + /* Beware: the 'node' field always holds "the next" node to consider. so it's always "one node ahead" of what the iterator loop sees. In most respects this makes no difference, but we depend on this - detail in `delete_all_overlays` where this allows us to modify + detail in 'delete_all_overlays' where this allows us to modify the current node knowing that the iterator will not need it to find the next. */ iter->node = itree_iterator_first_node (tree, iter); diff --git a/src/itree.h b/src/itree.h index f54dbd7f07e..23e1105a05d 100644 --- a/src/itree.h +++ b/src/itree.h @@ -41,7 +41,7 @@ INLINE_HEADER_BEGIN struct itree_node { /* The normal parent, left and right links found in binary trees. - See also `red`, below, which completes the Red-Black tree + See also 'red', below, which completes the Red-Black tree representation. */ struct itree_node *parent; struct itree_node *left; @@ -147,13 +147,13 @@ struct itree_iterator struct itree_node *node; ptrdiff_t begin; ptrdiff_t end; - uintmax_t otick; /* A copy of the tree's `otick`. */ + uintmax_t otick; /* A copy of the tree's 'otick'. */ enum itree_order order; }; /* Iterate over the intervals between BEG and END in the tree T. - N will hold successive nodes. ORDER can be one of : `ASCENDING`, - `DESCENDING`, `POST_ORDER`, or `PRE_ORDER`. + N will hold successive nodes. ORDER can be one of : 'ASCENDING', + 'DESCENDING', 'POST_ORDER', or 'PRE_ORDER'. It should be used as: ITREE_FOREACH (n, t, beg, end, order) @@ -167,12 +167,12 @@ struct itree_iterator - Don't modify the tree during the iteration. */ #define ITREE_FOREACH(n, t, beg, end, order) \ - /* FIXME: We'd want to declare `n` right here, but I can't figure out - how to make that work here: the `for` syntax only allows a single + /* FIXME: We'd want to declare 'n' right here, but I can't figure out + how to make that work here: the 'for' syntax only allows a single clause for the var declarations where we need 2 different types. - We could use the `struct {foo x; bar y; } p;` trick to declare two - vars `p.x` and `p.y` of unrelated types, but then none of the names - of the vars matches the `n` we receive :-(. */ \ + We could use the 'struct {foo x; bar y; } p;' trick to declare two + vars 'p.x' and 'p.y' of unrelated types, but then none of the names + of the vars matches the 'n' we receive :-(. */ \ if (!t) \ { } \ else \ -- 2.39.2