2 * Copyright (C) 1995,1997,1998,2000,2001, 2006, 2011 Free Software Foundation, Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public License
6 * as published by the Free Software Foundation; either version 3 of
7 * the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
29 #include "libguile/_scm.h"
30 #include "libguile/ports.h"
31 #include "libguile/smob.h"
33 #include "libguile/mallocs.h"
41 scm_t_bits scm_tc16_malloc
;
46 malloc_print (SCM exp
, SCM port
, scm_print_state
*pstate SCM_UNUSED
)
48 scm_puts_unlocked("#<malloc ", port
);
49 scm_uintprint (SCM_SMOB_DATA (exp
), 16, port
);
50 scm_putc_unlocked('>', port
);
56 scm_malloc_obj (size_t n
)
58 scm_t_bits mem
= n
? (scm_t_bits
) scm_gc_malloc (n
, "malloc smob") : 0;
61 SCM_RETURN_NEWSMOB (scm_tc16_malloc
, mem
);
69 scm_tc16_malloc
= scm_make_smob_type ("malloc", 0);
70 scm_set_smob_print (scm_tc16_malloc
, malloc_print
);