Skip to content

Commit 73974db

Browse files
author
Florian Plaza Oñate
committed
Fix wrong indent
1 parent 8b993cf commit 73974db

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

inst/include/Rcpp/vector/DimNameProxy.h

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,34 +32,33 @@ namespace internal{
3232
DimNameProxy(SEXP data, int dim): data_(data), dim_(dim) {}
3333
DimNameProxy(DimNameProxy const& other):
3434
data_(other.data_), dim_(other.dim_) {}
35-
35+
3636
inline DimNameProxy& assign(SEXP other) {
37-
if (Rf_length(other) == 0)
38-
{
39-
Rf_setAttrib(data_, R_DimNamesSymbol, R_NilValue);
40-
} else {
41-
SEXP dims = Rf_getAttrib(data_, R_DimSymbol);
42-
43-
if (INTEGER(dims)[dim_] != Rf_length(other)) {
44-
stop("dimension extent is '%d' while length of names is '%d'", INTEGER(dims)[dim_], Rf_length(other));
45-
}
37+
if (Rf_length(other) == 0)
38+
{
39+
Rf_setAttrib(data_, R_DimNamesSymbol, R_NilValue);
40+
} else {
41+
SEXP dims = Rf_getAttrib(data_, R_DimSymbol);
42+
if (INTEGER(dims)[dim_] != Rf_length(other)) {
43+
stop("dimension extent is '%d' while length of names is '%d'", INTEGER(dims)[dim_], Rf_length(other));
44+
}
4645

47-
SEXP dimnames = Rf_getAttrib(data_, R_DimNamesSymbol);
48-
if (Rf_isNull(dimnames)) {
49-
Shield<SEXP> new_dimnames(Rf_allocVector(VECSXP, Rf_length(dims)));
50-
SET_VECTOR_ELT(new_dimnames, dim_, other);
51-
Rf_setAttrib(data_, R_DimNamesSymbol, new_dimnames);
52-
} else {
53-
SET_VECTOR_ELT(dimnames, dim_, other);
54-
}
55-
}
46+
SEXP dimnames = Rf_getAttrib(data_, R_DimNamesSymbol);
47+
if (Rf_isNull(dimnames)) {
48+
Shield<SEXP> new_dimnames(Rf_allocVector(VECSXP, Rf_length(dims)));
49+
SET_VECTOR_ELT(new_dimnames, dim_, other);
50+
Rf_setAttrib(data_, R_DimNamesSymbol, new_dimnames);
51+
} else {
52+
SET_VECTOR_ELT(dimnames, dim_, other);
53+
}
54+
}
5655
return *this;
57-
}
56+
}
5857

5958
inline DimNameProxy& operator=(SEXP other) {
6059
return assign(other);
6160
}
62-
61+
6362
inline DimNameProxy& operator=(const DimNameProxy& other) {
6463
return assign(SEXP(other));
6564
}

0 commit comments

Comments
 (0)