]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/DelaySpec.cc
Source Format Enforcement (#1234)
[thirdparty/squid.git] / src / DelaySpec.cc
index b0da4ee41935cca46bbb5a63bda6d5154f0706e9..8fed4dcdf0b05dc347a9b1c2611121c49361e326 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
  *
  * Squid software is distributed under GPLv2+ license and includes
  * contributions from numerous individuals and organizations.
@@ -43,8 +43,10 @@ DelaySpec::parse()
 {
     // get the token.
     char *token = ConfigParser::NextToken();
-    if (token == NULL)
+    if (!token) {
         self_destruct();
+        return;
+    }
 
     // no-limit value
     if (strcmp(token, "none") == 0 || token[0] == '-') {
@@ -54,15 +56,15 @@ DelaySpec::parse()
     }
 
     // parse the first digits into restore_bps
-    const char *p = NULL;
-    if (!StringToInt(token, restore_bps, &p, 10) && *p != '/') {
+    const char *p = nullptr;
+    if (!StringToInt(token, restore_bps, &p, 10) || *p != '/') {
         debugs(77, DBG_CRITICAL, "ERROR: invalid delay rate '" << token << "'. Expecting restore/max or 'none'.");
         self_destruct();
     }
     p++; // increment past the '/'
 
     // parse the rest into max_bytes
-    if (!StringToInt64(p, max_bytes, NULL, 10)) {
+    if (!StringToInt64(p, max_bytes, nullptr, 10)) {
         debugs(77, DBG_CRITICAL, "ERROR: restore rate in '" << token << "' is not a number.");
         self_destruct();
     }