# include <ohana.h>
# include <gfitsio.h>

/*********************** fits create matrix *******************************/
int gfits_create_matrix (Header *header, Matrix *matrix) {

  int i;
  off_t Nbytes;

  matrix[0].bitpix = header[0].bitpix;
  matrix[0].unsign = header[0].unsign;
  matrix[0].bscale = header[0].bscale;
  matrix[0].bzero  = header[0].bzero;
  matrix[0].Naxes  = header[0].Naxes;
  for (i = 0; i < FT_MAX_NAXES; i++)
    matrix[0].Naxis[i] = header[0].Naxis[i];

  Nbytes = gfits_data_size (header);
  ALLOCATE (matrix[0].buffer, char, MAX (Nbytes, 1));
  memset (matrix[0].buffer, 0, Nbytes);
  
  matrix[0].datasize = Nbytes;
  return (TRUE);

}

// XXX free buffer if non-null: need to double check for existing frees
