Skip to content

Commit

Permalink
Use 'isS4' to check for S4 object
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Widgren <stefan.widgren@gmail.com>
  • Loading branch information
stewid committed Jan 5, 2018
1 parent 106da51 commit e5136a0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions src/git2r_arg.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* git2r, R bindings to the libgit2 library.
* Copyright (C) 2013-2017 The git2r contributors
* Copyright (C) 2013-2018 The git2r contributors
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2,
Expand Down Expand Up @@ -32,7 +32,7 @@ int git2r_arg_check_blob(SEXP arg)
{
SEXP class_name;

if (isNull(arg) || S4SXP != TYPEOF(arg))
if (isNull(arg) || !isS4(arg))
return -1;

class_name = getAttrib(arg, R_ClassSymbol);
Expand All @@ -56,7 +56,7 @@ int git2r_arg_check_branch(SEXP arg)
SEXP class_name;
SEXP slot;

if (isNull(arg) || S4SXP != TYPEOF(arg))
if (isNull(arg) || !isS4(arg))
return -1;

class_name = getAttrib(arg, R_ClassSymbol);
Expand Down Expand Up @@ -90,7 +90,7 @@ int git2r_arg_check_commit(SEXP arg)
{
SEXP class_name;

if (isNull(arg) || S4SXP != TYPEOF(arg))
if (isNull(arg) || !isS4(arg))
return -1;

class_name = getAttrib(arg, R_ClassSymbol);
Expand All @@ -117,7 +117,7 @@ int git2r_arg_check_credentials(SEXP arg)
if (isNull(arg))
return 0;

if (S4SXP != TYPEOF(arg))
if (!isS4(arg))
return -1;

class_name = getAttrib(arg, R_ClassSymbol);
Expand Down Expand Up @@ -195,7 +195,7 @@ int git2r_arg_check_fetch_heads(SEXP arg)
SEXP class_name;
SEXP item = VECTOR_ELT(arg, i);

if (isNull(item) || S4SXP != TYPEOF(item))
if (isNull(item) || !isS4(item))
return -1;

class_name = getAttrib(item, R_ClassSymbol);
Expand Down Expand Up @@ -338,7 +338,7 @@ int git2r_arg_check_note(SEXP arg)
{
SEXP class_name;

if (isNull(arg) || S4SXP != TYPEOF(arg))
if (isNull(arg) || !isS4(arg))
return -1;

class_name = getAttrib(arg, R_ClassSymbol);
Expand Down Expand Up @@ -381,7 +381,7 @@ int git2r_arg_check_signature(SEXP arg)
SEXP class_name;
SEXP when;

if (isNull(arg) || S4SXP != TYPEOF(arg))
if (isNull(arg) || !isS4(arg))
return -1;

class_name = getAttrib(arg, R_ClassSymbol);
Expand Down Expand Up @@ -481,7 +481,7 @@ int git2r_arg_check_tag(SEXP arg)
{
SEXP class_name;

if (isNull(arg) || S4SXP != TYPEOF(arg))
if (isNull(arg) || !isS4(arg))
return -1;

class_name = getAttrib(arg, R_ClassSymbol);
Expand All @@ -504,7 +504,7 @@ int git2r_arg_check_tree(SEXP arg)
{
SEXP class_name;

if (isNull(arg) || S4SXP != TYPEOF(arg))
if (isNull(arg) || !isS4(arg))
return -1;

class_name = getAttrib(arg, R_ClassSymbol);
Expand Down
4 changes: 2 additions & 2 deletions src/git2r_repository.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* git2r, R bindings to the libgit2 library.
* Copyright (C) 2013-2017 The git2r contributors
* Copyright (C) 2013-2018 The git2r contributors
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2,
Expand Down Expand Up @@ -41,7 +41,7 @@ git_repository* git2r_repository_open(SEXP repo)
SEXP path;
git_repository *repository;

if (isNull(repo) || S4SXP != TYPEOF(repo))
if (isNull(repo) || !isS4(repo))
return NULL;

class_name = getAttrib(repo, R_ClassSymbol);
Expand Down

0 comments on commit e5136a0

Please sign in to comment.