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
  • Collapse sidebar
  • Activity
  • Create a new issue
  • Issue Boards

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
  • #22342

Closed (moved)
Open
Opened May 23, 2017 by Nick Mathewson@nickm🥄

Add a nice append-only stringbuffer, and refactor code to use it

Right now we have 2.5 strategies for building strings out of pieces:

1a) Sometimes, we use a stack-allocated buffer, and a pointer into that buffer, and we write into that buffer using tor_snprintf and strlcpy and friends.

1b) Sometimes we do the same with a heap-allocated buffer.

  1. Sometimes we allocate a smartlist full of little strings, and use smartlist_join_strings() to turn it into one big string.

Both of these methods are cumbersome and at least somewhat inefficient. It would be better to have something that managed the buffer size, and supported commands like "extend with snprintf" or "extend with string".

Calling this "intro" because it doesn't require extensive knowledge of Tor; but it isn't a small task to do it right. This is something where we'd want to optimize for efficiency... though in the short run, we might just do it as a wrapper around smartlist_t and smartlist_join_strings().

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