FreeBSD/contrib/subversion/subversion/libsvn_subr/cache-membuffer.c
/* Return the next available spare group from CACHE and mark it as used.
 * May return NULL.
 */
Return the next available spare group from CACHE and mark it as used.
May return NULL.
Return the next available spare group from CACHE and mark it as used . May return NULL .
static entry_group_t *
allocate_spare_group(svn_membuffer_t *cache)
{
  entry_group_t *group = NULL;
  if (cache->first_spare_group != NO_INDEX)
    {
      group = &cache->directory[cache->first_spare_group];
      cache->first_spare_group = group->header.next;
    }
  else if (cache->max_spare_used < cache->spare_group_count)
    {
      apr_uint32_t group_index = cache->group_count + cache->max_spare_used;
      ++cache->max_spare_used;
      if (!is_group_initialized(cache, group_index))
        initialize_group(cache, group_index);
      group = &cache->directory[group_index];
    }
  assert(!group || !group->header.used);
  return group;
}
static entry_group_t * allocate_spare_group ( svn_membuffer_t * cache ) { entry_group_t * group = NULL ; if ( cache -> first_spare_group != NO_INDEX ) { group = & cache -> directory [ cache -> first_spare_group ] ; cache -> first_spare_group = group -> header . next ; } else if ( cache -> max_spare_used < cache -> spare_group_count ) { apr_uint32_t group_index = cache -> group_count + cache -> max_spare_used ; ++ cache -> max_spare_used ; if ( ! is_group_initialized ( cache , group_index ) ) initialize_group ( cache , group_index ) ; group = & cache -> directory [ group_index ] ; } assert ( ! group || ! group -> header . used ) ; return group ; }
Return the next available spare group from CACHE and mark it as used.
Return the next available spare group from CACHE and mark it as used .
/* is there some ready-to-use group? */ /* any so far untouched spares available? */ /* spare groups must be empty */