Skip to content

Commit

Permalink
v0.2.15 maint release
Browse files Browse the repository at this point in the history
Fix #109, Fix #111,  plus new CRAN warnings
  • Loading branch information
brodieG committed Jan 7, 2023
2 parents dd98644 + 21abad4 commit 0a9075d
Show file tree
Hide file tree
Showing 63 changed files with 502 additions and 221 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ jobs:
steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@master
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}

- uses: r-lib/actions/setup-pandoc@master
- uses: r-lib/actions/setup-pandoc@v2

- name: Query dependencies
run: |
Expand Down
7 changes: 3 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ Title: Trust, but Verify
Description: Declarative template-based framework for verifying that objects
meet structural requirements, and auto-composing error messages when they do
not.
Version: 0.2.14
Version: 0.2.15
Authors@R: c(
person("Brodie", "Gaslam", email="[email protected]",
role=c("aut", "cre")),
person(family="Paxdiablo", role="cph", comment="Hash
table implementation in src/pfhash.h"),
person(family="R Core Team",
email="[email protected]", role="cph",
comment="Used/adapted several code snippets from R sources, see src/misc-alike.c and src/valname.c"
))
comment="Used/adapted several code snippets from R sources, see src/r-copied.c"))
Depends:
R (>= 3.2.0)
License: GPL (>=2)
Expand All @@ -27,5 +26,5 @@ Suggests:
knitr,
rmarkdown,
unitizer
RoxygenNote: 7.2.0
RoxygenNote: 7.2.3
Roxygen: list(markdown = TRUE, load = "installed")
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 0.2.15

* [#109](https://github.com/brodieG/vetr/issues/109) allow for substituted
arguments to contain objects (e.g. as might happen when a function is invoked
with `do.call`).
* Address fun(void) declarations.
* Swap `snprintf` for `sprintf` (and fix off by one allocations).

## 0.2.14

* [#106](https://github.com/brodieG/vetr/issues/106) force promises prior to
Expand Down
2 changes: 1 addition & 1 deletion R/abstract.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 Brodie Gaslam
# Copyright (C) 2023 Brodie Gaslam
#
# This file is part of "vetr - Trust, but Verify"
#
Expand Down
2 changes: 1 addition & 1 deletion R/alike.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 Brodie Gaslam
# Copyright (C) 2023 Brodie Gaslam
#
# This file is part of "vetr - Trust, but Verify"
#
Expand Down
2 changes: 1 addition & 1 deletion R/benchmark.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 Brodie Gaslam
# Copyright (C) 2023 Brodie Gaslam
#
# This file is part of "vetr - Trust, but Verify"
#
Expand Down
2 changes: 1 addition & 1 deletion R/cstringr.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 Brodie Gaslam
# Copyright (C) 2023 Brodie Gaslam
#
# This file is part of "vetr - Trust, but Verify"
#
Expand Down
2 changes: 1 addition & 1 deletion R/helper.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 Brodie Gaslam
# Copyright (C) 2023 Brodie Gaslam
#
# This file is part of "vetr - Trust, but Verify"
#
Expand Down
2 changes: 1 addition & 1 deletion R/misc.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 Brodie Gaslam
# Copyright (C) 2023 Brodie Gaslam
#
# This file is part of "vetr - Trust, but Verify"
#
Expand Down
2 changes: 1 addition & 1 deletion R/settings.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 Brodie Gaslam
# Copyright (C) 2023 Brodie Gaslam
#
# This file is part of "vetr - Trust, but Verify"
#
Expand Down
2 changes: 1 addition & 1 deletion R/system.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 Brodie Gaslam
# Copyright (C) 2023 Brodie Gaslam
#
# This file is part of "vetr - Trust, but Verify"
#
Expand Down
2 changes: 1 addition & 1 deletion R/templates.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 Brodie Gaslam
# Copyright (C) 2023 Brodie Gaslam
#
# This file is part of "vetr - Trust, but Verify"
#
Expand Down
2 changes: 1 addition & 1 deletion R/type.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 Brodie Gaslam
# Copyright (C) 2023 Brodie Gaslam
#
# This file is part of "vetr - Trust, but Verify"
#
Expand Down
2 changes: 1 addition & 1 deletion R/validate.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 Brodie Gaslam
# Copyright (C) 2023 Brodie Gaslam
#
# This file is part of "vetr - Trust, but Verify"
#
Expand Down
2 changes: 1 addition & 1 deletion R/validators.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 Brodie Gaslam
# Copyright (C) 2023 Brodie Gaslam
#
# This file is part of "vetr - Trust, but Verify"
#
Expand Down
2 changes: 1 addition & 1 deletion R/vetr-package.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022 Brodie Gaslam
# Copyright (C) 2023 Brodie Gaslam
#
# This file is part of "vetr - Trust, but Verify"
#
Expand Down
6 changes: 3 additions & 3 deletions src/alike.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2022 Brodie Gaslam
Copyright (C) 2023 Brodie Gaslam
This file is part of "vetr - Trust, but Verify"
Expand Down Expand Up @@ -50,7 +50,7 @@ SEXP ALIKEC_res_strings_to_SEXP(struct ALIKEC_res_strings strings) {
* One question here is whether we should create this object once and then
* re-use it unless an actual error occurs to avoid the R_alloc calls.
*/
struct ALIKEC_res_strings ALIKEC_res_strings_init() {
struct ALIKEC_res_strings ALIKEC_res_strings_init(void) {
struct ALIKEC_res_strings res;

res.target = (const char **) R_alloc(5, sizeof(const char *));
Expand All @@ -74,7 +74,7 @@ struct ALIKEC_res_strings ALIKEC_res_strings_init() {

return res;
}
struct ALIKEC_res ALIKEC_res_init() {
struct ALIKEC_res ALIKEC_res_init(void) {
return (struct ALIKEC_res) {
.success=1,
.dat=(struct ALIKEC_res_dat) {
Expand Down
6 changes: 3 additions & 3 deletions src/alike.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2022 Brodie Gaslam
Copyright (C) 2023 Brodie Gaslam
This file is part of "vetr - Trust, but Verify"
Expand Down Expand Up @@ -186,7 +186,7 @@ Go to <https://www.r-project.org/Licenses/GPL-2> for a copy of the license.

void psh(const char * lab);
SEXP ALIKEC_rec_ind_as_lang(struct ALIKEC_rec_track rec);
struct ALIKEC_rec_track ALIKEC_rec_track_init();
struct ALIKEC_rec_track ALIKEC_rec_track_init(void);
struct ALIKEC_rec_track ALIKEC_rec_ind_chr(
struct ALIKEC_rec_track res, const char * ind
);
Expand Down Expand Up @@ -222,7 +222,7 @@ Go to <https://www.r-project.org/Licenses/GPL-2> for a copy of the license.
SEXP ALIKEC_match_call(SEXP call, SEXP match_call, SEXP env);
SEXP ALIKEC_findFun(SEXP symbol, SEXP rho);
SEXP ALIKEC_findFun_ext(SEXP symbol, SEXP rho);
struct ALIKEC_res ALIKEC_res_init();
struct ALIKEC_res ALIKEC_res_init(void);
SEXP ALIKEC_res_as_strsxp(
struct ALIKEC_res res, SEXP call, struct VALC_settings set
);
Expand Down
2 changes: 1 addition & 1 deletion src/all-bw.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ static int scalar_na(SEXP x) {
/*
* helper fun to throw error
*/
static void include_end_err() {
static void include_end_err(void) {
const char * valid_ends =
"\"[]\", \"[)\", \"(]\", \"()\"";
error(
Expand Down
4 changes: 2 additions & 2 deletions src/assumptions.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2020 Brodie Gaslam
Copyright (C) 2023 Brodie Gaslam
This file is part of "vetr - Trust, but Verify"
Expand Down Expand Up @@ -30,7 +30,7 @@ Go to <https://www.r-project.org/Licenses/GPL-2> for a copy of the license.
*/
// nocov start by definition none of the errors should be thrown, so no sense in
// covering this
SEXP VALC_check_assumptions() {
SEXP VALC_check_assumptions(void) {
const char * err_base = "Failed system assumption: %s%s";
if(sizeof(R_len_t) < sizeof(int))
warningcall(R_NilValue, err_base, "R_len_t is not gte to int", "");
Expand Down
4 changes: 2 additions & 2 deletions src/attr.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2022 Brodie Gaslam
Copyright (C) 2023 Brodie Gaslam
This file is part of "vetr - Trust, but Verify"
Expand Down Expand Up @@ -439,7 +439,7 @@ Implements comparing character vectors element for element:
This is used to compare names, row.names, etc.
Return value is either a zero length string if comparison successfull, or a
string containing `%s` that can then be used to sprintf in the name of the
string containing `%s` that can then be used to snprintf in the name of the
object being compared.
*/
/*
Expand Down
2 changes: 1 addition & 1 deletion src/cstringr-ext.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2022 Brodie Gaslam
Copyright (C) 2023 Brodie Gaslam
This file is part of "vetr - Trust, but Verify"
Expand Down
14 changes: 9 additions & 5 deletions src/cstringr.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2022 Brodie Gaslam
Copyright (C) 2023 Brodie Gaslam
This file is part of "vetr - Trust, but Verify"
Expand Down Expand Up @@ -188,7 +188,8 @@ size_t CSR_strmlen_x(const char * str, size_t maxlen) {
if((uintptr_t)str > UINTPTR_MAX - maxlen)
// nocov start
error(
"Internal error in strmlen, maxlen would imply pointer overflow"
"Internal error in strmlen, maxlen (%jd) would imply pointer overflow",
maxlen
);
// nocov end

Expand Down Expand Up @@ -323,6 +324,7 @@ char * CSR_smprintf6(
full_len = CSR_add_szt(full_len, CSR_strmlen_x(d, maxlen));
full_len = CSR_add_szt(full_len, CSR_strmlen_x(e, maxlen));
full_len = CSR_add_szt(full_len, CSR_strmlen_x(f, maxlen));
full_len = CSR_add_szt(full_len, 1);

char * res;

Expand All @@ -335,9 +337,11 @@ char * CSR_smprintf6(
char * e_cpy = CSR_strmcpy(e, maxlen);
char * f_cpy = CSR_strmcpy(f, maxlen);

res = R_alloc(full_len + 1, sizeof(char));
int res_len = sprintf(
res, CSR_strmcpy(format, maxlen), a_cpy, b_cpy, c_cpy, d_cpy, e_cpy, f_cpy
res = R_alloc(full_len, sizeof(char));
int res_len = snprintf(
res, full_len,
CSR_strmcpy(format, maxlen),
a_cpy, b_cpy, c_cpy, d_cpy, e_cpy, f_cpy
);
if(res_len < 0) {
// nocov start
Expand Down
12 changes: 6 additions & 6 deletions src/cstringr.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2022 Brodie Gaslam
Copyright (C) 2023 Brodie Gaslam
This file is part of "vetr - Trust, but Verify"
Expand Down Expand Up @@ -47,11 +47,11 @@ Go to <https://www.r-project.org/Licenses/GPL-2> for a copy of the license.
SEXP CSR_nchar_u(SEXP string);
SEXP CSR_char_offsets(SEXP string);

SEXP CSR_test_strmcpy();
SEXP CSR_test_strappend();
SEXP CSR_test_strappend2();
SEXP CSR_test_add_szt();
SEXP CSR_test_smprintfx();
SEXP CSR_test_strmcpy(void);
SEXP CSR_test_strappend(void);
SEXP CSR_test_strappend2(void);
SEXP CSR_test_add_szt(void);
SEXP CSR_test_smprintfx(void);

// Internal Functions

Expand Down
12 changes: 6 additions & 6 deletions src/cstringrtest.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2022 Brodie Gaslam
Copyright (C) 2023 Brodie Gaslam
This file is part of "vetr - Trust, but Verify"
Expand All @@ -25,21 +25,21 @@ Go to <https://www.r-project.org/Licenses/GPL-2> for a copy of the license.
* These are all expected to produce errors
*/

SEXP CSR_test_strmcpy() {
SEXP CSR_test_strmcpy(void) {
size_t maxlen = 0;
maxlen--; // size_t of max value
CSR_strmcpy("hello", maxlen);
return R_NilValue; // nocov
}

SEXP CSR_test_strappend() {
SEXP CSR_test_strappend(void) {
size_t maxlen = 0;
maxlen--; // size_t of max value
CSR_strappend("hello", "hello", maxlen);
return R_NilValue; // nocov
}

SEXP CSR_test_add_szt() {
SEXP CSR_test_add_szt(void) {
size_t maxlen = 0;
maxlen--; // size_t of max value
CSR_add_szt(maxlen, maxlen);
Expand All @@ -48,7 +48,7 @@ SEXP CSR_test_add_szt() {
/*
* Make sure all the variations on CSR_smprintf6 actually work
*/
SEXP CSR_test_smprintfx() {
SEXP CSR_test_smprintfx(void) {
return mkString(
CSR_smprintf5(
10000, "%s\n%s\n%s\n%s\n",
Expand All @@ -62,7 +62,7 @@ SEXP CSR_test_smprintfx() {
}
// Make sure warning generated correctly

SEXP CSR_test_strappend2() {
SEXP CSR_test_strappend2(void) {
char * str_new = R_alloc(20, sizeof(char));
CSR_strappend(str_new, "hellothere", 5);
return R_NilValue;
Expand Down
2 changes: 1 addition & 1 deletion src/envtrack.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2022 Brodie Gaslam
Copyright (C) 2023 Brodie Gaslam
This file is part of "vetr - Trust, but Verify"
Expand Down
Loading

0 comments on commit 0a9075d

Please sign in to comment.