/* This routine computes the total memory space available for allocation.  */
jpeg_mem_available(j_common_ptr cinfo, long min_bytes_needed, long max_bytes_needed, long already_allocated)
/* This routine computes the total memory space available for allocation.  */
jpeg_mem_available(j_common_ptr cinfo, long min_bytes_needed, long max_bytes_needed, long already_allocated)
{
  if (cinfo->mem->max_memory_to_use)
    return cinfo->mem->max_memory_to_use - already_allocated;
  return max_bytes_needed;
}