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/09 16:21:38 UTC

[GitHub] [trafficserver] ywkaras commented on a diff in pull request #8900: Eliminate potentially error-prone function pointer casting in logging code.

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


##########
proxy/logging/LogField.h:
##########
@@ -82,6 +82,12 @@ class LogField
   typedef int (*UnmarshalFuncWithMap)(char **buf, char *dest, int len, const Ptr<LogFieldAliasMap> &map);
   typedef void (LogAccess::*SetFunc)(char *buf, int len);
 
+  static UnmarshalFunc
+  castToUnmarshalFunc(UnmarshalFuncWithSlice func)
+  {
+    return reinterpret_cast<UnmarshalFunc>(func);
+  }
+

Review Comment:
   Perhaps it would be better to consolidate m_unmarshal_func and m_unmarshal_func_map into an std::variant and also add an UnmarshalFuncWithSlice variant.
   
   https://github.com/apache/trafficserver/blob/12801c966e5710d818287e79a7a977e837bfddc6/proxy/logging/LogField.h#L192



-- 
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