/* MX LIBRARY FUNCTION: mxip_image_s_close_f1 * * PURPOSE: Close a mxip_image_s structure. * * USAGE EXAMPLE: * * struct mxip_image_s *old=NULL; * * ! N.B. old must be opened and *old!=NULL * * status = mxip_image_s_close_f1 (&old); * * AUTHOR: K. J. Mighell (mighell@noao.edu) * * LANGUAGE: ANSI C * * DOCUMENTATION: http://www.noao.edu/staff/mighell/mx * * DATE: 20000313 * * MOD: 3 * * Copyleft (L) 2000 Kenneth John Mighell */ #include "mx.h" int mxip_image_s_close_f1( struct mxip_image_s **old ) { char mxfunc[] = "mxip_image_s_close_f1"; int status; struct mxip_image_s *image; image = *old; if ( mxip_image_s_ok_f1 (image) ) { status = 1; goto error; } /* * Free up memory allocated to image->matrixd */ free (image->matrixd); image->matrixd = (double **)NULL; /* * Free up memory allocated to image->vectord */ free (image->vectord); image->vectord = (double *)NULL; /* * Free up memory allocated to image */ free (image); image = (struct mxip_image_s *)NULL; ok: status = 0; goto bye; error: mxp_errmsg_append_f3 (mxfunc, status, MX.tmpmsg); goto bye; bye: *old = &*image; return (status); } /* end-of-file */