Skip to content
Prev 32981 / 63424 Next

reference counting bug related to break and next in loops

Thanks Luke.

I used codetools::walkCode to look for functions that returned the
value of a loop and found a surprising number in base R.
However, it looks like non of these functions were written to return
anything useful (the side effects were important), so the change
to loop-returns-NULL should let such functions use less
memory (and time) and make them correspond better to their
documentation.

E.g., fixup.libraries.URLs is not documented to return anything
and it returns the value of for loop:

$`src/library/utils/R/windows/linkhtml.R`[[2]]
function(lib.loc = .libPaths())
{
    for (lib in lib.loc) {
        if(lib == .Library) next
        pg <- sort(.packages(all.available = TRUE, lib.loc = lib))
        for(pkg in pg)
            try(fixup.package.URLs(file.path(lib,pkg)), silent = TRUE)
    }
}

Bill Dunlap
TIBCO Software Inc - Spotfire Division
wdunlap tibco.com