Skip to content

Commit 20fc7b1

Browse files
committed
move temporary variables
1 parent c651d91 commit 20fc7b1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/utils.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -633,11 +633,14 @@ SEXP frev(SEXP x, SEXP copyArg) {
633633
names = PROTECT(getAttrib(x, R_NamesSymbol));
634634
nprotect++;
635635
if (copy) {
636+
SEXP klass = PROTECT(getAttrib(x, R_ClassSymbol));
637+
SEXP levels = PROTECT(getAttrib(x, R_LevelsSymbol));
638+
nprotect += 2;
639+
// swipe attributes from x
636640
SET_ATTRIB(x, R_NilValue);
637641
setAttrib(x, R_NamesSymbol, names);
638-
setAttrib(x, R_ClassSymbol, PROTECT(getAttrib(x, R_ClassSymbol)));
639-
setAttrib(x, R_LevelsSymbol, PROTECT(getAttrib(x, R_LevelsSymbol)));
640-
nprotect += 2;
642+
setAttrib(x, R_ClassSymbol, klass);
643+
setAttrib(x, R_LevelsSymbol, levels);
641644
}
642645
if (!isNull(names)) {
643646
frev(names, ScalarLogical(FALSE));

0 commit comments

Comments
 (0)