You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by GitBox <gi...@apache.org> on 2022/06/08 01:22:44 UTC

[GitHub] [trafficserver] ywkaras commented on a diff in pull request #8886: Add escape json for logging

ywkaras commented on code in PR #8886:
URL: https://github.com/apache/trafficserver/pull/8886#discussion_r891833035


##########
proxy/logging/LogAccess.cc:
##########
@@ -643,6 +643,126 @@ LogAccess::unmarshal_str(char **buf, char *dest, int len, LogSlice *slice)
   return -1;
 }
 
+static int
+escape_json(char *dest, const char *buf, int len)
+{
+  ink_assert(buf != nullptr);
+
+  int escaped_len = 0;
+
+  for (int i = 0; i < len; i++) {
+    char c = buf[i];
+    switch (c) {

Review Comment:
   Here are two alternatives to a switch statement:  https://godbolt.org/z/G3fz3469v



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org