mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 19:50:24 +02:00
(image_tag): Changed type to scm_t_bits.
(make_image): Use scm_gc_malloc instead of scm_must_malloc. (free_image): Use scm_gc_free instead of free. Return zero.
This commit is contained in:
parent
5ddf900c86
commit
d115af0eea
1 changed files with 6 additions and 7 deletions
|
@ -21,7 +21,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <libguile.h>
|
#include <libguile.h>
|
||||||
|
|
||||||
static scm_bits_t image_tag;
|
static scm_t_bits image_tag;
|
||||||
|
|
||||||
struct image {
|
struct image {
|
||||||
int width, height;
|
int width, height;
|
||||||
|
@ -49,10 +49,10 @@ make_image (SCM name, SCM s_width, SCM s_height)
|
||||||
width = SCM_INUM (s_width);
|
width = SCM_INUM (s_width);
|
||||||
height = SCM_INUM (s_height);
|
height = SCM_INUM (s_height);
|
||||||
|
|
||||||
image = (struct image *) scm_must_malloc (sizeof (struct image), "image");
|
image = (struct image *) scm_gc_malloc (sizeof (struct image), "image");
|
||||||
image->width = width;
|
image->width = width;
|
||||||
image->height = height;
|
image->height = height;
|
||||||
image->pixels = scm_must_malloc (width * height, "image pixels");
|
image->pixels = scm_gc_malloc (width * height, "image pixels");
|
||||||
image->name = name;
|
image->name = name;
|
||||||
image->update_func = SCM_BOOL_F;
|
image->update_func = SCM_BOOL_F;
|
||||||
|
|
||||||
|
@ -93,12 +93,11 @@ static size_t
|
||||||
free_image (SCM image_smob)
|
free_image (SCM image_smob)
|
||||||
{
|
{
|
||||||
struct image *image = (struct image *) SCM_SMOB_DATA (image_smob);
|
struct image *image = (struct image *) SCM_SMOB_DATA (image_smob);
|
||||||
size_t size = image->width * image->height + sizeof (struct image);
|
|
||||||
|
|
||||||
free (image->pixels);
|
scm_gc_free (image->pixels, image->width * image->height, "image pixels");
|
||||||
free (image);
|
scm_gc_free (image, sizeof (struct image), "image");
|
||||||
|
|
||||||
return size;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue