Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
Trac
Trac
  • Project overview
    • Project overview
    • Details
    • Activity
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Operations
    • Operations
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar

GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

  • Legacy
  • TracTrac
  • Issues
  • #8308

Closed (moved)
Open
Opened Feb 22, 2013 by Nick Mathewson@nickm🐭

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.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Tor: 0.2.4.x-final
Milestone
Tor: 0.2.4.x-final
Assign milestone
Time tracking
None
Due date
None
Reference: legacy/trac#8308