ywkaras commented on a change in pull request #7606:
URL: https://github.com/apache/trafficserver/pull/7606#discussion_r602613370
##########
File path: proxy/ControlBase.cc
##########
@@ -114,19 +113,19 @@ TimeMod::check(HttpRequestData *req) const
TimeMod *
TimeMod::make(char *value, const char **error)
{
- Tokenizer rangeTok("-");
- TimeMod *mod = nullptr;
- TimeMod tmp;
- int num_tok;
-
- num_tok = rangeTok.Initialize(value, SHARE_TOKS);
- if (num_tok == 1) {
+ TimeMod *mod = nullptr;
+ char *range_end = std::strchr(value, '-');
+ if (nullptr == range_end) {
*error = "End time not specified";
- } else if (num_tok > 2) {
- *error = "Malformed time range";
- } else if (nullptr == (*error = timeOfDayToSeconds(rangeTok[0],
&tmp.start_time)) &&
- nullptr == (*error = timeOfDayToSeconds(rangeTok[1],
&tmp.end_time))) {
- mod = new TimeMod(tmp);
+ } else {
+ *(range_end++) = '\0';
Review comment:
I used strchr() instead of TextView due to the need to poke in null
chars for compatibility with C-style utils.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]