ext/iodine/redis_engine.c
/**
 * a local static callback, called when an Array should be allocated.
 *
 * `array_len` is the expected number of objects that will fill the Array
 * object.
 *
 * There's no `resp_on_end_array` callback since the RESP protocol assumes the
 * message is finished along with the Array (`resp_on_message` is called).
 * However, just in case a non-conforming client/server sends nested Arrays,
 * the callback should test against possible overflow or nested Array endings.
 *
 * If this function returns any value besides 0, parsing is stopped.
 */
a local static callback, called when an Array should be allocated.
`array_len` is the expected number of objects that will fill the Array
object.

There's no `resp_on_end_array` callback since the RESP protocol assumes the
message is finished along with the Array (`resp_on_message` is called).
However, just in case a non-conforming client/server sends nested Arrays,
the callback should test against possible overflow or nested Array endings.

If this function returns any value besides 0, parsing is stopped.
a local static callback called when an Array should be allocated . ` array_len ` is the expected number of objects that will fill the Array object . There ' s no ` resp_on_end_array ` callback since the RESP protocol assumes the message is finished along with the Array ( ` resp_on_message ` is called ) . However just in case a non - conforming client / server sends nested Arrays the callback should test against possible overflow or nested Array endings . If this function returns any value besides 0 parsing is stopped .
static int resp_on_start_array(resp_parser_s *parser, size_t array_len) {
  struct redis_engine_internal_s *i = parser2data(parser);
  if (i->ary) {
    ++i->nesting;
    FIOBJ tmp = fiobj_ary_new2(array_len + 2);
    fiobj_ary_push(tmp, fiobj_num_new(i->ary_count));
    fiobj_ary_push(tmp, fiobj_num_new(i->ary));
    i->ary = tmp;
  } else {
    i->ary = fiobj_ary_new2(array_len + 2);
  }
  i->ary_count = array_len;
  return 0;
}
static int resp_on_start_array ( resp_parser_s * parser , size_t array_len ) { struct redis_engine_internal_s * i = parser2data ( parser ) ; if ( i -> ary ) { ++ i -> nesting ; FIOBJ tmp = fiobj_ary_new2 ( array_len + 2 ) ; fiobj_ary_push ( tmp , fiobj_num_new ( i -> ary_count ) ) ; fiobj_ary_push ( tmp , fiobj_num_new ( i -> ary ) ) ; i -> ary = tmp ; } else { i -> ary = fiobj_ary_new2 ( array_len + 2 ) ; } i -> ary_count = array_len ; return 0 ; }
a local static callback, called when an Array should be allocated.
a local static callback called when an Array should be allocated .