chiark / gitweb /
Adopt C99 bool in the tree234 API.
authorSimon Tatham <anakin@pobox.com>
Tue, 13 Nov 2018 21:41:45 +0000 (21:41 +0000)
committerSimon Tatham <anakin@pobox.com>
Tue, 13 Nov 2018 21:48:24 +0000 (21:48 +0000)
The only affected function here is splitpos234, which I don't think
these puzzles are even using at the moment.

devel.but
tree234.c
tree234.h

index 0a0f1cd342050e5f81e2ed60059e45dddf74210e..9f95ad7dd487b5c687649fdfeb7d665cd21564cd 100644 (file)
--- a/devel.but
+++ b/devel.but
@@ -4044,13 +4044,13 @@ Returns the number of elements currently in the tree.
 
 \S{utils-splitpos234} \cw{splitpos234()}
 
-\c tree234 *splitpos234(tree234 *t, int index, int before);
+\c tree234 *splitpos234(tree234 *t, int index, bool before);
 
 Splits the input tree into two pieces at a given position, and
 creates a new tree containing all the elements on one side of that
 position.
 
-If \c{before} is \cw{TRUE}, then all the items at or after position
+If \c{before} is \cw{true}, then all the items at or after position
 \c{index} are left in the input tree, and the items before that
 point are returned in the new tree. Otherwise, the reverse happens:
 all the items at or after \c{index} are moved into the new tree, and
index 4b3151ee2f65c5d3793be15a43623d162511b313..879096b65d8ee452cb056ff131500b95fe5e63e3 100644 (file)
--- a/tree234.c
+++ b/tree234.c
@@ -1376,7 +1376,7 @@ static node234 *split234_internal(tree234 *t, int index) {
     t->root = halves[1];
     return halves[0];
 }
-tree234 *splitpos234(tree234 *t, int index, int before) {
+tree234 *splitpos234(tree234 *t, int index, bool before) {
     tree234 *ret;
     node234 *n;
     int count;
index f75c8f7fb3ff910d0e81740bffb3b891f3ae0a46..33869b5702454900cad32514baeccf8df579b36d 100644 (file)
--- a/tree234.h
+++ b/tree234.h
@@ -28,6 +28,8 @@
 #ifndef TREE234_H
 #define TREE234_H
 
+#include <stdbool.h>
+
 /*
  * This typedef is opaque outside tree234.c itself.
  */
@@ -172,7 +174,7 @@ int count234(tree234 *t);
  * in the tree that satisfy the relation are returned; the
  * remainder are left.
  */
-tree234 *splitpos234(tree234 *t, int index, int before);
+tree234 *splitpos234(tree234 *t, int index, bool before);
 tree234 *split234(tree234 *t, void *e, cmpfn234 cmp, int rel);
 
 /*