serrislew commented on code in PR #13352:
URL: https://github.com/apache/trafficserver/pull/13352#discussion_r3626396248
##########
plugins/prefetch/configs.cc:
##########
@@ -71,14 +71,39 @@ iequals(const StringView lhs, const StringView rhs)
[](const char a, const char b) { return tolower(a) ==
tolower(b); });
}
-void
+bool
PrefetchConfig::setFetchOverflow(const char *optarg)
{
- if (StringView("64") == optarg) {
+ if (nullptr == optarg) {
+ return false;
+ }
+ if (StringView("32") == optarg) {
+ _fetchOverflow = EvalPolicy::Overflow32;
+ } else if (StringView("64") == optarg) {
_fetchOverflow = EvalPolicy::Overflow64;
} else if (iequals("bignum", optarg)) {
_fetchOverflow = EvalPolicy::Bignum;
+ } else {
+ return false;
+ }
+ return true;
+}
+
+/**
+ * @brief Whether @a optarg is a non-empty string of decimal digits (a valid
unsigned integer option).
+ */
+static bool
+isUnsignedInt(const char *optarg)
+{
+ if (nullptr == optarg || '\0' == *optarg) {
+ return false;
+ }
+ for (const char *p = optarg; '\0' != *p; ++p) {
Review Comment:
nitpicky but does this need any range-checking?
--
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]