Use smartlist-of-strings rather than preallocated-charbuf for more directory stuff
In too many places, we have code that looks like this:
r = tor_snprintf(s+written, maxlen-s, "foo %s %s\nbar %s\n", baz, qux, quuz);
if (r<0) {
goto err;
}
written += n;
...
return buf;
or other variants on the theme. This is much easier phrased as
smartlist_add_asprintf(chunks, "foo %s %s\nbar %s\n", baz, qux, quuz);
...
return smartlist_join_strings(chunks, "", ...);
Making this change will remove a bunch of boilerplate, eliminate some risk of cut-and-paste errors, make a large class of "didn't allocate enough" bugs impossible, and generally make our code easier to read.