summaryrefslogtreecommitdiffstats
path: root/tree.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-01-06 20:03:25 -0800
committerKaz Kylheku <kaz@kylheku.com>2022-01-06 20:03:25 -0800
commit07a0d613fceaf12fd7bf2f900223ac925908c76e (patch)
tree7d8ded9098d1e715af35b5cc8b6e7ea97097f543 /tree.c
parent5983e14cf97bd1302151ffc3dbc53451acdc87e9 (diff)
downloadtxr-07a0d613fceaf12fd7bf2f900223ac925908c76e.tar.gz
txr-07a0d613fceaf12fd7bf2f900223ac925908c76e.tar.bz2
txr-07a0d613fceaf12fd7bf2f900223ac925908c76e.zip
Casts have crept into the code not wrapped by macros.
It is against TXR coding conventions to use the C cast notation. The usage creeps into the code. To find instances of this, we must compile using GNU g++, and add -Wold-style-cast via EXTRA_FLAGS. * eval.c (prof_call): Use macro instead of cast. * ffi.c (pad_retval, ffi_varray_alloc, make_ffi_type_union, carray_dup, carray_replace, uint_carray, int_carray, put_carray, fill_carray): Likewise. * itypes.c (c_i64, c_u64): Likewise. * lib.c (cyr, chk_xalloc, spilt_str_keep, vector, cobj_register): Likewise. * linenoise.c (record_undo): Likewise. Also, drop one superfluous cast: wstrdup_fn returns wchar_t *. (flash, edit_insert, edit_insert_str): Use macro instead of cast. * mpi/mpi.c (s_mp_ispow2d): Likewise. * parser.c (lino_getch): Likewise. * rand.c (make_random_state, random_buf): Likewise. * stream.c (generic_get_line, do_parse_mode): Likewise. * struct.c (get_duplicate_supers, call_initfun_chain, call_postinitfun_chain): Likewise. * sysif.c (c_time): Likewise. * tree.c (tr_insert): Likewise.
Diffstat (limited to 'tree.c')
-rw-r--r--tree.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tree.c b/tree.c
index 0c803d8e..6450d6e9 100644
--- a/tree.c
+++ b/tree.c
@@ -381,7 +381,7 @@ static void tr_insert(val tree, struct tree *tr, struct tree_iter *ti,
set(mkloc(subtree->tn.left, subtree), node);
if (++tr->size > tr->max_size)
tr->max_size = tr->size;
- if (subtree->tn.right == nil && (((ucnum) 1) << dep) > tr->size) {
+ if (subtree->tn.right == nil && (convert(ucnum, 1) << dep) > tr->size) {
set(mkloc(ti->path[ti->depth++], ti->self), subtree);
tr_find_rebuild_scapegoat(tree, tr, ti, node, 1);
}
@@ -412,7 +412,7 @@ static void tr_insert(val tree, struct tree *tr, struct tree_iter *ti,
set(mkloc(subtree->tn.right, subtree), node);
if (++tr->size > tr->max_size)
tr->max_size = tr->size;
- if (subtree->tn.left == nil && (((ucnum) 1) << dep) > tr->size) {
+ if (subtree->tn.left == nil && (convert(ucnum, 1) << dep) > tr->size) {
set(mkloc(ti->path[ti->depth++], ti->self), subtree);
tr_find_rebuild_scapegoat(tree, tr, ti, node, 1);
}