X-Git-Url: https://git.hcoop.net/bpt/guile.git/blobdiff_plain/e33a910dd0f430f34c32fe6846899aee33fc2cf6..fbb857a472eb4e69c1cba05e86646b7004f32df6:/libguile/hooks.c diff --git a/libguile/hooks.c b/libguile/hooks.c index d6b8981d5..c6541fadd 100644 --- a/libguile/hooks.c +++ b/libguile/hooks.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995,1996,1998,1999,2000,2001, 2003, 2006, 2008 Free Software Foundation, Inc. +/* Copyright (C) 1995,1996,1998,1999,2000,2001, 2003, 2006, 2008, 2009 Free Software Foundation, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -43,6 +43,9 @@ * using C level hooks. */ +/* Hint for `scm_gc_malloc ()' and friends. */ +static const char hook_entry_gc_hint[] = "hook entry"; + void scm_c_hook_init (scm_t_c_hook *hook, void *hook_data, scm_t_c_hook_type type) { @@ -57,8 +60,10 @@ scm_c_hook_add (scm_t_c_hook *hook, void *fn_data, int appendp) { - scm_t_c_hook_entry *entry = scm_malloc (sizeof (scm_t_c_hook_entry)); + scm_t_c_hook_entry *entry; scm_t_c_hook_entry **loc = &hook->first; + + entry = scm_gc_malloc (sizeof (scm_t_c_hook_entry), hook_entry_gc_hint); if (appendp) while (*loc) loc = &(*loc)->next; @@ -78,9 +83,7 @@ scm_c_hook_remove (scm_t_c_hook *hook, { if ((*loc)->func == func && (*loc)->data == fn_data) { - scm_t_c_hook_entry *entry = *loc; *loc = (*loc)->next; - free (entry); return; } loc = &(*loc)->next; @@ -294,7 +297,6 @@ void scm_init_hooks () { scm_tc16_hook = scm_make_smob_type ("hook", 0); - scm_set_smob_mark (scm_tc16_hook, scm_markcdr); scm_set_smob_print (scm_tc16_hook, hook_print); #include "libguile/hooks.x" }