diff options
author | Marius Vollmer <mvo@zagadka.de> | 2002-02-28 20:55:49 +0000 |
---|---|---|
committer | Marius Vollmer <mvo@zagadka.de> | 2002-02-28 20:55:49 +0000 |
commit | d115af0eea8d8c19cb0abc4acb26e647810aafe7 (patch) | |
tree | db6037a67f1e8ea35afeec7d84db31c54015f0cf /doc/example-smob | |
parent | 5ddf900c86feee0accfade7f31a1a8a60513192e (diff) | |
download | guile-d115af0eea8d8c19cb0abc4acb26e647810aafe7.tar.gz |
(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.
Diffstat (limited to 'doc/example-smob')
-rw-r--r-- | doc/example-smob/image-type.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/doc/example-smob/image-type.c b/doc/example-smob/image-type.c index f9b783737..1a03c9ce2 100644 --- a/doc/example-smob/image-type.c +++ b/doc/example-smob/image-type.c @@ -21,7 +21,7 @@ #include <stdlib.h> #include <libguile.h> -static scm_bits_t image_tag; +static scm_t_bits image_tag; struct image { int width, height; @@ -49,10 +49,10 @@ make_image (SCM name, SCM s_width, SCM s_height) width = SCM_INUM (s_width); 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->height = height; - image->pixels = scm_must_malloc (width * height, "image pixels"); + image->pixels = scm_gc_malloc (width * height, "image pixels"); image->name = name; image->update_func = SCM_BOOL_F; @@ -93,12 +93,11 @@ static size_t free_image (SCM 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); - free (image); + scm_gc_free (image->pixels, image->width * image->height, "image pixels"); + scm_gc_free (image, sizeof (struct image), "image"); - return size; + return 0; } static int |