コード例 #1
0
ファイル: array.c プロジェクト: victor1589007281/GCS
my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size,
                           uint init_alloc, uint alloc_increment)
{
  /* placeholder to preserve ABI */
  return my_init_dynamic_array_ci(array, element_size, init_alloc, 
                                  alloc_increment);
}
コード例 #2
0
ファイル: hash.c プロジェクト: A-eolus/mysql
/**
  @brief Initialize the hash
  
  @details

  Initialize the hash, by defining and giving valid values for
  its elements. The failure to allocate memory for the
  hash->array element will not result in a fatal failure. The
  dynamic array that is part of the hash will allocate memory
  as required during insertion.

  @param[in,out] hash         The hash that is initialized
  @param[in]     charset      The charater set information
  @param[in]     size         The hash size
  @param[in]     key_offest   The key offset for the hash
  @param[in]     key_length   The length of the key used in
                              the hash
  @param[in]     get_key      get the key for the hash
  @param[in]     free_element pointer to the function that
                              does cleanup
  @return        inidicates success or failure of initialization
    @retval 0 success
    @retval 1 failure
*/
my_bool
_my_hash_init(HASH *hash, uint growth_size, CHARSET_INFO *charset,
              ulong size, size_t key_offset, size_t key_length,
              my_hash_get_key get_key,
              void (*free_element)(void*), uint flags)
{
  DBUG_ENTER("my_hash_init");
  DBUG_PRINT("enter",("hash: 0x%lx  size: %u", (long) hash, (uint) size));

  hash->records=0;
  hash->key_offset=key_offset;
  hash->key_length=key_length;
  hash->blength=1;
  hash->get_key=get_key;
  hash->free=free_element;
  hash->flags=flags;
  hash->charset=charset;
  DBUG_RETURN(my_init_dynamic_array_ci(&hash->array, 
                                       sizeof(HASH_LINK), size, growth_size));
}
コード例 #3
0
ファイル: hash.c プロジェクト: ChenzhenqingCC/WinProjects
my_bool
_hash_init(HASH *hash,CHARSET_INFO *charset,
	   uint size,uint key_offset,uint key_length,
	   hash_get_key get_key,
	   void (*free_element)(void*),uint flags CALLER_INFO_PROTO)
{
  DBUG_ENTER("hash_init");
  DBUG_PRINT("enter",("hash: 0x%lx  size: %d",hash,size));

  hash->records=0;
  if (my_init_dynamic_array_ci(&hash->array,sizeof(HASH_LINK),size,0))
  {
    hash->free=0;				/* Allow call to hash_free */
    DBUG_RETURN(1);
  }
  hash->key_offset=key_offset;
  hash->key_length=key_length;
  hash->blength=1;
  hash->get_key=get_key;
  hash->free=free_element;
  hash->flags=flags;
  hash->charset=charset;
  DBUG_RETURN(0);
}