Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • NetworkManager NetworkManager
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 169
    • Issues 169
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 19
    • Merge requests 19
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

Due to an influx of spam, we have had to impose restrictions on new accounts. Please see this wiki page for instructions on how to get full permissions. Sorry for the inconvenience.

  • NetworkManagerNetworkManager
  • NetworkManagerNetworkManager
  • Merge requests
  • !42

WIP: [th/strbuf] own string-buffer implementation

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Thomas Haller requested to merge th/strbuf into master Nov 02, 2018
  • Overview 5
  • Commits 8
  • Pipelines 11
  • Changes 10

I think GString is not as great as it should be. The basic functionality, for what we mostly use GString, is easy to implement.

The point of NMStrBuf is, that we can build API around it. Meaning, we have various to-string functions like nmp_object_to_string(). Currently, these to-string function force one or another way how to construct strings on the user. For example, nmp_object_to_string() uses a buffer and a fixed length. That is efficient as it requires not re-alloc or may avoid heap allocation. However, it's hard for the caller got choose the right buffer size. Either the string gets truncated or the buffer is too large. If these to-string functions would accept a NMStrBuf, the caller can decide whether the string should grow dynamically (heap-allocated), or whether it should use a static buffer, or whether the maximum length should be limited, or whether the action should avoid leaking secrets (explicit-bzero). Not all of these functionalities (using a static-buffer or a maximum lenght) are implemented yet. However they could easily be added -- without modifying the to-string functions that write to the buffer.

Edited Nov 15, 2018 by Thomas Haller
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: th/strbuf