EV-Redis

 view release on metacpan or  search on metacpan

deps/hiredis/ffc.h  view on Meta::CPAN

  if ((*first == '-') ||
      ((uint64_t)(fmt & FFC_FORMAT_FLAG_ALLOW_LEADING_PLUS) &&
       (*first == '+'))) {
    ++first;
  }
  if (last - first >= 3) {
    if (ffc_strncasecmp3(first, "nan", 1)) {
      answer.ptr = (first += 3);

      // The macro casts the literal AFTER applying the negative sign. This is ok:
      // -NAN is a double negative NaN, and (float)(-NAN) correctly produces a negative float NaN.
      // Same for infinity — (float)(-INFINITY) gives negative float infinity
      ffc_set_value(value, vk, minus_sign ? -NAN : NAN);
      // Check for possible nan(n-char-seq-opt), C++17 20.19.3.7,
      // C11 7.20.1.3.3. At least MSVC produces nan(ind) and nan(snan).
      if (first != last && *first == '(') {
        for (char *ptr = first + 1; ptr != last; ++ptr) {
          if (*ptr == ')') {
            answer.ptr = ptr + 1; // valid nan(n-char-seq-opt)
            break;
          } else if (!(('a' <= *ptr && *ptr <= 'z') ||

deps/hiredis/read.c  view on Meta::CPAN

                d = INFINITY; /* Positive infinite. */
            } else if (len == 4 && strcasecmp(buf,"-inf") == 0) {
                d = -INFINITY; /* Negative infinite. */
            } else if ((len == 3 && strcasecmp(buf,"nan") == 0) ||
                       (len == 4 && strcasecmp(buf, "-nan") == 0)) {
                d = NAN; /* nan. */
            } else {
                d = strtod((char*)buf,&eptr);
                /* RESP3 only allows "inf", "-inf", and finite values, while
                 * strtod() allows other variations on infinity,
                 * etc. We explicity handle our two allowed infinite cases and NaN
                 * above, so strtod() should only result in finite values. */
                if (buf[0] == '\0' || eptr != &buf[len] || !isfinite(d)) {
                    __redisReaderSetError(r,REDIS_ERR_PROTOCOL,
                            "Bad double value");
                    return REDIS_ERR;
                }
            }

            if (r->fn && r->fn->createDouble) {
                obj = r->fn->createDouble(cur,d,buf,len);

src/ppport.h  view on Meta::CPAN

    s++; if (s == send || (*s != 'F' && *s != 'f')) return 0;
    s++; if (s < send && (*s == 'I' || *s == 'i')) {
      s++; if (s == send || (*s != 'N' && *s != 'n')) return 0;
      s++; if (s == send || (*s != 'I' && *s != 'i')) return 0;
      s++; if (s == send || (*s != 'T' && *s != 't')) return 0;
      s++; if (s == send || (*s != 'Y' && *s != 'y')) return 0;
      s++;
    }
    sawinf = 1;
  } else if (*s == 'N' || *s == 'n') {
    /* XXX TODO: There are signaling NaNs and quiet NaNs. */
    s++; if (s == send || (*s != 'A' && *s != 'a')) return 0;
    s++; if (s == send || (*s != 'N' && *s != 'n')) return 0;
    s++;
    sawnan = 1;
  } else
    return 0;

  if (sawinf) {
    numtype &= IS_NUMBER_NEG; /* Keep track of sign  */
    numtype |= IS_NUMBER_INFINITY | IS_NUMBER_NOT_INT;

t/options.t  view on Meta::CPAN

        eval { $r->waiting_timeout($big) };
        like $@, qr/waiting_timeout too large/, "waiting_timeout($big) croaks as too large";
        eval { $r->reconnect(1, $big) };
        like $@, qr/reconnect_delay too large/, "reconnect(1, $big) croaks as too large";
        eval { $r->connect('127.0.0.1', $big) };
        like $@, qr/invalid port \d/, "connect port $big croaks";
    }
    $r->max_pending(0);
    $r->priority(0);

    # NaN is not a large number: it stays what SvIV makes of it
    my $nan = do { no warnings 'numeric'; 'NaN' + 0 };
    my $nan_iv = do { use integer; $nan + 0 };
    SKIP: {
        skip "NaN is $nan_iv as an integer here", 3 if $nan_iv;
        $r->priority(1);
        $r->priority($nan);
        is $r->priority, 0, 'priority(NaN) is 0';
        $r->max_pending(5);
        $r->max_pending($nan);
        is $r->max_pending, 0, 'max_pending(NaN) is 0';
        ok eval { $r->waiting_timeout($nan); 1 }, 'waiting_timeout(NaN) does not croak' or diag $@;
    }
}

{
    my $r = EV::Redis->new(
        path     => $connect_info{sock},
        on_error => sub { },
    );
    my $t; $t = EV::timer 0.1, 0, sub {
        undef $t;



( run in 3.913 seconds using v1.01-cache-2.11-cpan-60884a8df76 )