add_section (Dwg_Data *dwg)
{
  if (dwg->header.num_sections == 0)
    dwg->header.section = calloc (1, sizeof (Dwg_Section));
  else
    {
      dwg->header.section
          = realloc (dwg->header.section,
                     sizeof (Dwg_Section) * (dwg->header.num_sections + 1));
      memset (&dwg->header.section[dwg->header.num_sections], 0,
              sizeof (Dwg_Section));
    }
  if (!dwg->header.section)
    {
      LOG_ERROR ("Out of memory");
      return DWG_ERR_OUTOFMEM;
    }
  dwg->header.num_sections++;
  return 0;
}
add_section (Dwg_Data *dwg)
{
  if (dwg->header.num_sections == 0)
    dwg->header.section = calloc (1, sizeof (Dwg_Section));
  else
    {
      dwg->header.section
          = realloc (dwg->header.section,
                     sizeof (Dwg_Section) * (dwg->header.num_sections + 1));
      memset (&dwg->header.section[dwg->header.num_sections], 0,
              sizeof (Dwg_Section));
    }
  if (!dwg->header.section)
    {
      LOG_ERROR ("Out of memory");
      return DWG_ERR_OUTOFMEM;
    }
  dwg->header.num_sections++;
  return 0;
}