Bläddra i källkod

Delete useless checks in confparse.c

config_parse_interval() and config_parse_msec_interval() were checking
whether the variable "ok" (a pointer to an int) was null, rather than
derefencing it.  Both functions are static, and all existing callers
pass a valid pointer to those static functions.  The callers do check
the variables (also confusingly named "ok") whose addresses they pass
as the "ok" arguments, so even if the pointer check were corrected to
be a dereference, it would be redundant.

Fixes #22103.
Taylor Yu 7 år sedan
förälder
incheckning
5494087ed7
1 ändrade filer med 0 tillägg och 4 borttagningar
  1. 0 4
      src/or/confparse.c

+ 0 - 4
src/or/confparse.c

@@ -1190,8 +1190,6 @@ config_parse_msec_interval(const char *s, int *ok)
 {
 {
   uint64_t r;
   uint64_t r;
   r = config_parse_units(s, time_msec_units, ok);
   r = config_parse_units(s, time_msec_units, ok);
-  if (!ok)
-    return -1;
   if (r > INT_MAX) {
   if (r > INT_MAX) {
     log_warn(LD_CONFIG, "Msec interval '%s' is too long", s);
     log_warn(LD_CONFIG, "Msec interval '%s' is too long", s);
     *ok = 0;
     *ok = 0;
@@ -1209,8 +1207,6 @@ config_parse_interval(const char *s, int *ok)
 {
 {
   uint64_t r;
   uint64_t r;
   r = config_parse_units(s, time_units, ok);
   r = config_parse_units(s, time_units, ok);
-  if (!ok)
-    return -1;
   if (r > INT_MAX) {
   if (r > INT_MAX) {
     log_warn(LD_CONFIG, "Interval '%s' is too long", s);
     log_warn(LD_CONFIG, "Interval '%s' is too long", s);
     *ok = 0;
     *ok = 0;