In addition to the deduplicative benefits, several uses-after-free are fixed:
function d() { delete a } BEGIN { sub(/./, d(), a[0]) }
function d() { delete a } BEGIN { sub(d(), "repl", a[0]) }
function d() { delete a } BEGIN { gsub(/./, d(), a[0]) }
function d() { delete a } BEGIN { gsub(d(), "repl", a[0]) }
When not matching globally, dosub breaks the loop immediately after the lone replacement (a significant speedup in some cases).
In addition to the deduplicative benefits, several uses-after-free are fixed:
When not matching globally, dosub breaks the loop immediately after the lone replacement (a significant speedup in some cases).