Skip to content

Commit 1320a7a

Browse files
authored
Merge pull request #582 from r-lib/unused-args
Eliminate unused function arguments
2 parents c0c88f1 + d4b0c63 commit 1320a7a

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

R/replace.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ replacement <- function(name, env = as.environment(-1), target_value = get(name,
2828
}
2929

3030
replace <- function(replacement) {
31-
.Call(covr_reassign_function, replacement$name, replacement$env, replacement$target_value, replacement$new_value)
31+
.Call(covr_reassign_function, replacement$target_value, replacement$new_value)
3232
}
3333

3434
reset <- function(replacement) {
35-
.Call(covr_reassign_function, replacement$name, replacement$env, replacement$target_value, replacement$orig_value)
35+
.Call(covr_reassign_function, replacement$target_value, replacement$orig_value)
3636
}

src/reassign.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
#include <Rdefines.h>
66
#include <stdlib.h> // for NULL
77

8-
SEXP covr_reassign_function(SEXP name, SEXP env, SEXP old_fun, SEXP new_fun) {
9-
if (TYPEOF(name) != SYMSXP) error("name must be a symbol");
10-
if (TYPEOF(env) != ENVSXP) error("env must be an environment");
8+
SEXP covr_reassign_function(SEXP old_fun, SEXP new_fun) {
119
if (TYPEOF(old_fun) != CLOSXP) error("old_fun must be a function");
1210
if (TYPEOF(new_fun) != CLOSXP) error("new_fun must be a function");
1311

@@ -23,11 +21,11 @@ SEXP covr_duplicate_(SEXP x) { return duplicate(x); }
2321

2422
/* .Call calls */
2523
extern SEXP covr_duplicate_(SEXP);
26-
extern SEXP covr_reassign_function(SEXP, SEXP, SEXP, SEXP);
24+
extern SEXP covr_reassign_function(SEXP, SEXP);
2725

2826
static const R_CallMethodDef CallEntries[] = {
2927
{"covr_duplicate_", (DL_FUNC)&covr_duplicate_, 1},
30-
{"covr_reassign_function", (DL_FUNC)&covr_reassign_function, 4},
28+
{"covr_reassign_function", (DL_FUNC)&covr_reassign_function, 2},
3129
{NULL, NULL, 0}};
3230

3331
void R_init_covr(DllInfo *dll) {

0 commit comments

Comments
 (0)