File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -17,18 +17,21 @@ SEXP copyCols(SEXP x, SEXP cols) {
1717 return R_NilValue ;
1818}
1919
20+ static SEXP setDuplicateOneAttrib (SEXP key , SEXP val , void * x ) {
21+ setAttrib (x , PROTECT (key ), PROTECT (shallow_duplicate (val )));
22+ UNPROTECT (2 );
23+ return NULL ; // continue
24+ }
25+
2026void mergeIndexAttrib (SEXP to , SEXP from ) {
2127 if (!isInteger (to ) || LENGTH (to )!= 0 )
2228 internal_error (__func__ , "'to' must be integer() already" ); // # nocov
2329 if (isNull (from ))
2430 return ;
2531 if (!ANY_ATTRIB (to )) // target has no attributes -> overwrite
2632 SHALLOW_DUPLICATE_ATTRIB (to , from );
27- else {
28- SEXP t = ATTRIB (to ), f = ATTRIB (from );
29- for (; CDR (t ) != R_NilValue ; t = CDR (t )); // traverse to end of attributes list of to
30- SETCDR (t , shallow_duplicate (f ));
31- }
33+ else
34+ R_mapAttrib (from , setDuplicateOneAttrib , to );
3235}
3336
3437SEXP cbindlist (SEXP x , SEXP copyArg ) {
You can’t perform that action at this time.
0 commit comments