tests/mem_functions.cc
/*
  Look for zero length value problems
  */
Look for zero length value problems
Look for zero length value problems
static test_return_t user_supplied_bug15(memcached_st *memc)
{
  for (uint32_t x= 0; x < 2; x++)
  {
    memcached_return_t rc= memcached_set(memc, test_literal_param("mykey"),
                                         NULL, 0,
                                         (time_t)0, (uint32_t)0);
    test_compare(MEMCACHED_SUCCESS, rc);
    size_t length;
    uint32_t flags;
    char *value= memcached_get(memc, test_literal_param("mykey"),
                               &length, &flags, &rc);
    test_compare(MEMCACHED_SUCCESS, rc);
    test_false(value);
    test_zero(length);
    test_zero(flags);
    value= memcached_get(memc, test_literal_param("mykey"),
                         &length, &flags, &rc);
    test_compare(MEMCACHED_SUCCESS, rc);
    test_true(value == NULL);
    test_zero(length);
    test_zero(flags);
  }
  return TEST_SUCCESS;
}
static test_return_t user_supplied_bug15 ( memcached_st * memc ) { for ( uint32_t x = 0 ; x < 2 ; x ++ ) { memcached_return_t rc = memcached_set ( memc , test_literal_param ( " " ) , NULL , 0 , ( time_t ) 0 , ( uint32_t ) 0 ) ; test_compare ( MEMCACHED_SUCCESS , rc ) ; size_t length ; uint32_t flags ; char * value = memcached_get ( memc , test_literal_param ( " " ) , & length , & flags , & rc ) ; test_compare ( MEMCACHED_SUCCESS , rc ) ; test_false ( value ) ; test_zero ( length ) ; test_zero ( flags ) ; value = memcached_get ( memc , test_literal_param ( " " ) , & length , & flags , & rc ) ; test_compare ( MEMCACHED_SUCCESS , rc ) ; test_true ( value == NULL ) ; test_zero ( length ) ; test_zero ( flags ) ; } return TEST_SUCCESS ; }
Look for zero length value problems
Look for zero length value problems