bneradt commented on a change in pull request #8204:
URL: https://github.com/apache/trafficserver/pull/8204#discussion_r687033706



##########
File path: example/plugins/c-api/txn_data_sink/txn_data_sink.cc
##########
@@ -28,89 +28,97 @@
   limitations under the License.
  */
 
-#include <stdio.h>
-#include <unistd.h>
 #include <ts/ts.h>
 
-// This gets the PRI*64 types
-#define __STDC_FORMAT_MACROS 1
-#include <inttypes.h>
+#include <string>
+#include <string_view>
 
-#define PLUGIN_NAME "txn_data_sink"
-#define PCP "[" PLUGIN_NAME "] "
-
-// Activate the data sink if this field is present in the request.
-static const char FLAG_MIME_FIELD[] = "TS-Agent";
-static size_t const FLAG_MIME_LEN   = sizeof(FLAG_MIME_FIELD) - 1;
-
-typedef struct {
-  int64_t total;
-} SinkData;
+namespace
+{
+std::string const PLUGIN_NAME = "txn_data_sink";

Review comment:
       Yeah, sounds good. Since as is PLUGIN_NAME always has .c_str() after it 
anyway in the file, it is actually convenient to make it a `constexpr char 
const *` as you suggest. I'll make `FLAG_HEADER_FIELD` a string_view though 
since .size() is useful for it in the place where it is called.
   
   Thanks for the review!




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to