Add API for freeing images

This commit is contained in:
Daniel Drake 2007-10-27 15:16:54 +01:00
parent c2a83ec948
commit da071ff8a2
3 changed files with 7 additions and 0 deletions

View file

@ -94,6 +94,7 @@ int main(void)
fp_img_standardize(img);
r = fp_img_save_to_file(img, "finger_standardized.pgm");
fp_img_free(img);
if (r) {
fprintf(stderr, "standardized img save failed, code %d\n", r);
goto out_close;

View file

@ -100,6 +100,7 @@ int fp_img_get_width(struct fp_img *img);
unsigned char *fp_img_get_data(struct fp_img *img);
int fp_img_save_to_file(struct fp_img *img, char *path);
void fp_img_standardize(struct fp_img *img);
void fp_img_free(struct fp_img *img);
/* Library */
int fp_init(void);

View file

@ -61,6 +61,11 @@ struct fp_img *fpi_img_resize(struct fp_img *img, size_t newsize)
return g_realloc(img, sizeof(*img) + newsize);
}
API_EXPORTED void fp_img_free(struct fp_img *img)
{
g_free(img);
}
API_EXPORTED int fp_img_get_height(struct fp_img *img)
{
return img->height;