You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by SolidWallOfCode <gi...@git.apache.org> on 2017/03/14 15:14:36 UTC

[GitHub] trafficserver pull request #1567: [WIP] Diags scrubbing mechanism

Github user SolidWallOfCode commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/1567#discussion_r105936302
  
    --- Diff: lib/ts/Scrubber.cc ---
    @@ -0,0 +1,138 @@
    +#include "Scrubber.h"
    +#include "MemView.h"
    +
    +Scrubber::Scrubber(const char *config)
    +{
    +  bool state_expecting_regex = true;
    +  char *regex                = nullptr;
    +  char *replacement          = nullptr;
    +  const ts::StringView delimiters("->;,", ts::StringView::literal);
    +  ts::StringView text(config);
    +
    +  this->config = ats_strdup(config);
    --- End diff --
    
    Another option would be for Scrubber to take ownership of the memory and avoid the extra alloc/copy. Beyond that, since the entire string is already persistent, you can use `StringView` instances for the pieces and not allocate for them at all. E.g., `regex` can be a `StringView` that points in to `config`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---