Skip to content

Commit c0d76b0

Browse files
Merge pull request #47 from r-lib/clang-tidy
Fixes from clang-tidy for bit.c
2 parents 6ad9669 + d08453d commit c0d76b0

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/bit.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
#include <R.h>
1111
#include <Rdefines.h>
1212
#include <Rinternals.h>
13+
#include <R_ext/Arith.h>
14+
#include <R_ext/Error.h>
15+
#include <R_ext/RS.h>
16+
#include <stdlib.h>
1317

1418
#include "merge.h"
1519
#include "sort.h"
@@ -39,9 +43,9 @@ static bitint *mask0, *mask1;
3943

4044
static void bit_init(int bits){
4145
if (bits != BITS)
42-
error("R .BITS and C BITS are not in sync");
46+
Rf_error("R .BITS and C BITS are not in sync"); // # nocov
4347
if (bits-1 != LASTBIT)
44-
error("R .BITS and C LASTBIT are not in sync");
48+
Rf_error("R .BITS and C LASTBIT are not in sync"); // # nocov
4549
mask0 = calloc(BITS, sizeof(bitint));
4650
mask1 = calloc(BITS, sizeof(bitint));
4751
bitint b = 1;
@@ -677,8 +681,6 @@ static void bit_replace_but_sorted(bitint *b, int nb, int *i, int ni, int *l){
677681
b[j] |= mask1[k];
678682
il++;
679683
}
680-
681-
return;
682684
}
683685

684686

@@ -767,8 +769,6 @@ static void bit_replace_but_sorted_recycle(bitint *b, int nb, int *i, int ni, in
767769
if (++il>=nl)
768770
il -= nl; // recycle l
769771
}
770-
771-
return;
772772
}
773773

774774

@@ -841,8 +841,6 @@ static void bit_replace_but_sorted_one(bitint *b, int nb, int *i, int ni, int l)
841841
else
842842
b[j] |= mask1[k];
843843
}
844-
845-
return;
846844
}
847845

848846

@@ -2191,7 +2189,7 @@ SEXP R_bit_reverse(
21912189
int nt = asInteger(tleng);
21922190
UNPROTECT(6);
21932191
if (ns!= nt)
2194-
error("source and target must have same length in R_bit_reverse");
2192+
Rf_error("source and target must have same length in R_bit_reverse");
21952193
bit_reverse(bsource, btarget, ns);
21962194
return(btarget_);
21972195
}

0 commit comments

Comments
 (0)