INLINE_FUN R_xlen_t xlength(SEXP s) { int i; switch (TYPEOF(s)) { case NILSXP: return 0; case LGLSXP: case INTSXP: case REALSXP: case CPLXSXP: case STRSXP: case CHARSXP: case VECSXP: case EXPRSXP: case RAWSXP: return XLENGTH(s); case LISTSXP: case LANGSXP: case DOTSXP: i = 0; while (s != NULL && s != R_NilValue) { i++; s = CDR(s); } return i; case ENVSXP: return Rf_envlength(s); default: return 1; } }
inline R_len_t Rf_length (SEXP s) { int i; switch (((s)->sxpinfo.type)) { case 0: return 0; case 24: return (((VECSEXP) (s))->vecsxp.length); case 6: case 17: i = 0; while (s != ((void *) 0) && s != R_NilValue) { i++; s = ((s)->u.listsxp.cdrval); } return i; case 4: return Rf_envlength (s); default: return 1; } }