aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2024-11-08 09:17:50 +0200
committerEli Zaretskii2024-11-08 09:17:50 +0200
commite8b8a1121a8d1826f0ff8874e38594bfaedddfac (patch)
tree183360dd0f069eee23b0fe0ba4f6f9479614d703
parentef440f59a170c3c69948fca863f368e397d503b4 (diff)
downloademacs-e8b8a1121a8d1826f0ff8874e38594bfaedddfac.tar.gz
emacs-e8b8a1121a8d1826f0ff8874e38594bfaedddfac.zip
; Fix quoting style in comments in itree.[ch] files
* src/itree.c: * src/itree.h: Fix quoting style in comments.
-rw-r--r--src/itree.c52
-rw-r--r--src/itree.h18
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)
378 node->right->offset += node->offset; 378 node->right->offset += node->offset;
379 node->offset = 0; 379 node->offset = 0;
380 } 380 }
381 /* The only thing that matters about `otick` is whether it's equal to 381 /* The only thing that matters about 'otick' is whether it's equal to
382 that of the tree. We could also "blindly" inherit from parent->otick, 382 that of the tree. We could also "blindly" inherit from parent->otick,
383 but we need to tree's `otick` anyway for when there's no parent. */ 383 but we need to tree's 'otick' anyway for when there's no parent. */
384 if (node->parent == NULL || node->parent->otick == otick) 384 if (node->parent == NULL || node->parent->otick == otick)
385 node->otick = otick; 385 node->otick = otick;
386} 386}
@@ -683,7 +683,7 @@ itree_insert_node (struct itree_tree *tree, struct itree_node *node)
683 struct itree_node *parent = NULL; 683 struct itree_node *parent = NULL;
684 struct itree_node *child = tree->root; 684 struct itree_node *child = tree->root;
685 uintmax_t otick = tree->otick; 685 uintmax_t otick = tree->otick;
686 /* It's the responsibility of the caller to set `otick` on the node, 686 /* It's the responsibility of the caller to set 'otick' on the node,
687 to "confirm" that the begin/end fields are up to date. */ 687 to "confirm" that the begin/end fields are up to date. */
688 eassert (node->otick == otick); 688 eassert (node->otick == otick);
689 689
@@ -913,8 +913,8 @@ itree_total_offset (struct itree_node *node)
913 link the tree root. 913 link the tree root.
914 914
915 Warning: DEST is left unmodified. SOURCE's child links are 915 Warning: DEST is left unmodified. SOURCE's child links are
916 unchanged. Caller is responsible for recalculation of `limit`. 916 unchanged. Caller is responsible for recalculation of 'limit'.
917 Requires both nodes to be using the same effective `offset`. */ 917 Requires both nodes to be using the same effective 'offset'. */
918static void 918static void
919itree_replace_child (struct itree_tree *tree, 919itree_replace_child (struct itree_tree *tree,
920 struct itree_node *source, 920 struct itree_node *source,
@@ -939,8 +939,8 @@ itree_replace_child (struct itree_tree *tree,
939 parent, left and right in surrounding nodes to point to SOURCE. 939 parent, left and right in surrounding nodes to point to SOURCE.
940 940
941 Warning: DEST is left unmodified. Caller is responsible for 941 Warning: DEST is left unmodified. Caller is responsible for
942 recalculation of `limit`. Requires both nodes to be using the same 942 recalculation of 'limit'. Requires both nodes to be using the same
943 effective `offset`. */ 943 effective 'offset'. */
944static void 944static void
945itree_transplant (struct itree_tree *tree, 945itree_transplant (struct itree_tree *tree,
946 struct itree_node *source, 946 struct itree_node *source,
@@ -964,38 +964,38 @@ itree_remove (struct itree_tree *tree, struct itree_node *node)
964 eassert (itree_contains (tree, node)); 964 eassert (itree_contains (tree, node));
965 eassert (check_tree (tree, true)); /* FIXME: Too expensive. */ 965 eassert (check_tree (tree, true)); /* FIXME: Too expensive. */
966 966
967 /* Find `splice`, the leaf node to splice out of the tree. When 967 /* Find 'splice', the leaf node to splice out of the tree. When
968 `node` has at most one child this is `node` itself. Otherwise, 968 'node' has at most one child this is 'node' itself. Otherwise,
969 it is the in order successor of `node`. */ 969 it is the in order successor of 'node'. */
970 itree_inherit_offset (tree->otick, node); 970 itree_inherit_offset (tree->otick, node);
971 struct itree_node *splice 971 struct itree_node *splice
972 = (node->left == NULL || node->right == NULL) 972 = (node->left == NULL || node->right == NULL)
973 ? node 973 ? node
974 : itree_subtree_min (tree->otick, node->right); 974 : itree_subtree_min (tree->otick, node->right);
975 975
976 /* Find `subtree`, the only child of `splice` (may be NULL). Note: 976 /* Find 'subtree', the only child of 'splice' (may be NULL). Note:
977 `subtree` will not be modified other than changing its parent to 977 'subtree' will not be modified other than changing its parent to
978 `splice`. */ 978 'splice'. */
979 eassert (splice->left == NULL || splice->right == NULL); 979 eassert (splice->left == NULL || splice->right == NULL);
980 struct itree_node *subtree 980 struct itree_node *subtree
981 = (splice->left != NULL) ? splice->left : splice->right; 981 = (splice->left != NULL) ? splice->left : splice->right;
982 982
983 /* Save a pointer to the parent of where `subtree` will eventually 983 /* Save a pointer to the parent of where 'subtree' will eventually
984 be in `subtree_parent`. */ 984 be in 'subtree_parent'. */
985 struct itree_node *subtree_parent 985 struct itree_node *subtree_parent
986 = (splice->parent != node) ? splice->parent : splice; 986 = (splice->parent != node) ? splice->parent : splice;
987 987
988 /* If `splice` is black removing it may violate Red-Black 988 /* If 'splice' is black removing it may violate Red-Black
989 invariants, so note this for later. */ 989 invariants, so note this for later. */
990 990
991 /* Replace `splice` with `subtree` under subtree's parent. If 991 /* Replace 'splice' with 'subtree' under subtree's parent. If
992 `splice` is black, this creates a red-red violation, so remember 992 'splice' is black, this creates a red-red violation, so remember
993 this now as the field can be overwritten when splice is 993 this now as the field can be overwritten when splice is
994 transplanted below. */ 994 transplanted below. */
995 itree_replace_child (tree, subtree, splice); 995 itree_replace_child (tree, subtree, splice);
996 bool removed_black = !splice->red; 996 bool removed_black = !splice->red;
997 997
998 /* Replace `node` with `splice` in the tree and propagate limit 998 /* Replace 'node' with 'splice' in the tree and propagate limit
999 upwards, if necessary. Note: Limit propagation can stabilize at 999 upwards, if necessary. Note: Limit propagation can stabilize at
1000 any point, so we must call from bottom to top for every node that 1000 any point, so we must call from bottom to top for every node that
1001 has a new child. */ 1001 has a new child. */
@@ -1054,8 +1054,8 @@ itree_insert_gap (struct itree_tree *tree,
1054 1054
1055 /* Nodes with front_advance starting at pos may mess up the tree 1055 /* Nodes with front_advance starting at pos may mess up the tree
1056 order, so we need to remove them first. This doesn't apply for 1056 order, so we need to remove them first. This doesn't apply for
1057 `before_markers` since in that case, all positions move identically 1057 'before_markers' since in that case, all positions move identically
1058 regardless of `front_advance` or `rear_advance`. */ 1058 regardless of 'front_advance' or 'rear_advance'. */
1059 struct itree_stack *saved = itree_stack_create (0); 1059 struct itree_stack *saved = itree_stack_create (0);
1060 struct itree_node *node = NULL; 1060 struct itree_node *node = NULL;
1061 if (!before_markers) 1061 if (!before_markers)
@@ -1208,7 +1208,7 @@ itree_node_intersects (const struct itree_node *node,
1208 1208
1209 Note that this should return all the nodes that we need to traverse 1209 Note that this should return all the nodes that we need to traverse
1210 in order to traverse the nodes selected by the current narrowing (i.e. 1210 in order to traverse the nodes selected by the current narrowing (i.e.
1211 `ITER->begin..ITER->end`) so it will also return some nodes which aren't in 1211 'ITER->begin..ITER->end') so it will also return some nodes which aren't in
1212 that narrowing simply because they may have children which are. 1212 that narrowing simply because they may have children which are.
1213 1213
1214 The code itself is very unsatisfactory because the code of each one 1214 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,
1221 struct itree_iterator *iter) 1221 struct itree_iterator *iter)
1222{ 1222{
1223 /* FIXME: Like in the previous version of the iterator, we 1223 /* FIXME: Like in the previous version of the iterator, we
1224 prune based on `limit` only when moving to a left child, 1224 prune based on 'limit' only when moving to a left child,
1225 but `limit` can also get smaller when moving to a right child 1225 but 'limit' can also get smaller when moving to a right child
1226 It's actually fairly common, so maybe it would be worthwhile 1226 It's actually fairly common, so maybe it would be worthwhile
1227 to prune a bit more aggressively here. */ 1227 to prune a bit more aggressively here. */
1228 struct itree_node *next; 1228 struct itree_node *next;
@@ -1387,10 +1387,10 @@ itree_iterator_start (struct itree_iterator *iter,
1387 iter->end = end; 1387 iter->end = end;
1388 iter->otick = tree->otick; 1388 iter->otick = tree->otick;
1389 iter->order = order; 1389 iter->order = order;
1390 /* Beware: the `node` field always holds "the next" node to consider. 1390 /* Beware: the 'node' field always holds "the next" node to consider.
1391 so it's always "one node ahead" of what the iterator loop sees. 1391 so it's always "one node ahead" of what the iterator loop sees.
1392 In most respects this makes no difference, but we depend on this 1392 In most respects this makes no difference, but we depend on this
1393 detail in `delete_all_overlays` where this allows us to modify 1393 detail in 'delete_all_overlays' where this allows us to modify
1394 the current node knowing that the iterator will not need it to 1394 the current node knowing that the iterator will not need it to
1395 find the next. */ 1395 find the next. */
1396 iter->node = itree_iterator_first_node (tree, iter); 1396 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
41struct itree_node 41struct itree_node
42{ 42{
43 /* The normal parent, left and right links found in binary trees. 43 /* The normal parent, left and right links found in binary trees.
44 See also `red`, below, which completes the Red-Black tree 44 See also 'red', below, which completes the Red-Black tree
45 representation. */ 45 representation. */
46 struct itree_node *parent; 46 struct itree_node *parent;
47 struct itree_node *left; 47 struct itree_node *left;
@@ -147,13 +147,13 @@ struct itree_iterator
147 struct itree_node *node; 147 struct itree_node *node;
148 ptrdiff_t begin; 148 ptrdiff_t begin;
149 ptrdiff_t end; 149 ptrdiff_t end;
150 uintmax_t otick; /* A copy of the tree's `otick`. */ 150 uintmax_t otick; /* A copy of the tree's 'otick'. */
151 enum itree_order order; 151 enum itree_order order;
152 }; 152 };
153 153
154/* Iterate over the intervals between BEG and END in the tree T. 154/* Iterate over the intervals between BEG and END in the tree T.
155 N will hold successive nodes. ORDER can be one of : `ASCENDING`, 155 N will hold successive nodes. ORDER can be one of : 'ASCENDING',
156 `DESCENDING`, `POST_ORDER`, or `PRE_ORDER`. 156 'DESCENDING', 'POST_ORDER', or 'PRE_ORDER'.
157 It should be used as: 157 It should be used as:
158 158
159 ITREE_FOREACH (n, t, beg, end, order) 159 ITREE_FOREACH (n, t, beg, end, order)
@@ -167,12 +167,12 @@ struct itree_iterator
167 - Don't modify the tree during the iteration. 167 - Don't modify the tree during the iteration.
168 */ 168 */
169#define ITREE_FOREACH(n, t, beg, end, order) \ 169#define ITREE_FOREACH(n, t, beg, end, order) \
170 /* FIXME: We'd want to declare `n` right here, but I can't figure out 170 /* FIXME: We'd want to declare 'n' right here, but I can't figure out
171 how to make that work here: the `for` syntax only allows a single 171 how to make that work here: the 'for' syntax only allows a single
172 clause for the var declarations where we need 2 different types. 172 clause for the var declarations where we need 2 different types.
173 We could use the `struct {foo x; bar y; } p;` trick to declare two 173 We could use the 'struct {foo x; bar y; } p;' trick to declare two
174 vars `p.x` and `p.y` of unrelated types, but then none of the names 174 vars 'p.x' and 'p.y' of unrelated types, but then none of the names
175 of the vars matches the `n` we receive :-(. */ \ 175 of the vars matches the 'n' we receive :-(. */ \
176 if (!t) \ 176 if (!t) \
177 { } \ 177 { } \
178 else \ 178 else \