cmcfarlen commented on code in PR #12167:
URL: https://github.com/apache/trafficserver/pull/12167#discussion_r2042765997


##########
include/proxy/hdrs/MIME.h:
##########
@@ -1139,35 +1141,32 @@ class MIMEHdr : public HdrHeapSDKHandle
   int parse(MIMEParser *parser, const char **start, const char *end, bool 
must_copy_strs, bool eof, bool remove_ws_from_field_name,
             size_t max_hdr_field_size = UINT16_MAX);
 
-  int              value_get_index(const char *name, int name_length, const 
char *value, int value_length) const;
-  const char      *value_get(const char *name, int name_length, int 
*value_length) const;
-  std::string_view value_get(std::string_view const &name) const; // 
Convenience overload.
-  int32_t          value_get_int(const char *name, int name_length) const;
-  uint32_t         value_get_uint(const char *name, int name_length) const;
-  int64_t          value_get_int64(const char *name, int name_length) const;
-  time_t           value_get_date(const char *name, int name_length) const;
-  int              value_get_comma_list(const char *name, int name_length, 
StrList *list) const;
-
-  void value_set(const char *name, int name_length, const char *value, int 
value_length);
-  void value_set_int(const char *name, int name_length, int32_t value);
-  void value_set_uint(const char *name, int name_length, uint32_t value);
-  void value_set_int64(const char *name, int name_length, int64_t value);
-  void value_set_date(const char *name, int name_length, time_t value);
+  int              value_get_index(std::string_view name, std::string_view 
value) const;
+  std::string_view value_get(std::string_view name) const;
+  int32_t          value_get_int(std::string_view name) const;
+  uint32_t         value_get_uint(std::string_view name) const;
+  int64_t          value_get_int64(std::string_view name) const;
+  time_t           value_get_date(std::string_view name) const;

Review Comment:
   I think for this one and a few others we could provide an override that 
takes string_view rather than replace the existing one.  That will avoid some 
of the conversions to string_view that just get converted back immediately.



##########
include/proxy/hdrs/MIME.h:
##########
@@ -1652,7 +1636,7 @@ MIMEHdr::value_append(const char *name, int name_length, 
const char *value, int
 inline time_t
 MIMEHdr::get_age() const
 {
-  int64_t age = value_get_int64(MIME_FIELD_AGE, MIME_LEN_AGE);
+  int64_t age = value_get_int64(std::string_view{MIME_FIELD_AGE, 
static_cast<std::string_view::size_type>(MIME_LEN_AGE)});

Review Comment:
   This is another example where also having the other override is cleaner.



-- 
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-unsubscr...@trafficserver.apache.org

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

Reply via email to