MCPcopy Create free account
hub / github.com/acl-dev/acl / get_array

Method get_array

lib_acl_cpp/src/redis/redis_client.cpp:311–338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

309}
310
311redis_result* redis_client::get_array(socket_stream& conn, dbuf_pool* dbuf)
312{
313 string& buf = conn.get_buf();
314 buf.clear();
315 if (!conn.gets(buf)) {
316 logger_error("gets error, server: %s", conn.get_peer(true));
317 return NULL;
318 }
319
320 redis_result* rr = new(dbuf) redis_result(dbuf);
321 rr->set_type(REDIS_RESULT_ARRAY);
322 int count = atoi(buf.c_str());
323 if (count <= 0) {
324 return rr;
325 }
326
327 rr->set_size((size_t) count);
328
329 for (int i = 0; i < count; i++) {
330 redis_result* child = get_object(conn, dbuf);
331 if (child == NULL) {
332 return NULL;
333 }
334 rr->put(child, i);
335 }
336
337 return rr;
338}
339
340redis_result* redis_client::get_object(socket_stream& conn, dbuf_pool* dbuf)
341{

Callers

nothing calls this directly

Calls 7

getsMethod · 0.80
get_bufMethod · 0.45
clearMethod · 0.45
get_peerMethod · 0.45
set_typeMethod · 0.45
c_strMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected