Remove default port/SMOB finalizers.
authorLudovic Courtès <ludo@gnu.org>
Fri, 25 Sep 2009 10:29:02 +0000 (12:29 +0200)
committerLudovic Courtès <ludo@gnu.org>
Mon, 28 Sep 2009 21:32:33 +0000 (23:32 +0200)
* libguile/ports.c (scm_port_free0): Remove.
  (scm_make_port_type): Set `free' to NULL.

* libguile/smob.c (scm_make_smob_type): Leave `free' to NULL.
  (scm_smob_free): Remove.

* libguile/smob.h (scm_smob_free): Remove.

* libguile/deprecated.c (scm_smob_free): New.

* libguile/deprecated.h (scm_smob_free): New declaration.

libguile/deprecated.c
libguile/deprecated.h
libguile/ports.c
libguile/smob.c
libguile/smob.h

index d066996..1b9e581 100644 (file)
@@ -633,6 +633,21 @@ scm_set_smob_mfpe (long tc,
   if (equalp) scm_set_smob_equalp (tc, equalp);
 }
 
+size_t
+scm_smob_free (SCM obj)
+{
+  long n = SCM_SMOBNUM (obj);
+
+  scm_c_issue_deprecation_warning
+    ("`scm_smob_free' is deprecated.  "
+     "It is no longer needed.");
+
+  if (scm_smobs[n].size > 0)
+    scm_gc_free ((void *) SCM_CELL_WORD_1 (obj), 
+                scm_smobs[n].size, SCM_SMOBNAME (n));
+  return 0;
+}
+
 SCM
 scm_read_0str (char *expr)
 {
index f428f7d..18424d5 100644 (file)
@@ -224,6 +224,8 @@ SCM_API void scm_set_smob_mfpe (long tc,
                                int (*print) (SCM, SCM, scm_print_state*),
                                SCM (*equalp) (SCM, SCM));
 
+SCM_API size_t scm_smob_free (SCM obj);
+
 SCM_API SCM scm_strprint_obj (SCM obj);
 SCM_API SCM scm_read_0str (char *expr);
 SCM_API SCM scm_eval_0str (const char *expr);
index 24afbfe..53f64e3 100644 (file)
@@ -127,12 +127,6 @@ end_input_default (SCM port SCM_UNUSED, int offset SCM_UNUSED)
 {
 }
 
-static size_t
-scm_port_free0 (SCM port)
-{
-  return 0;
-}
-
 scm_t_bits
 scm_make_port_type (char *name,
                    int (*fill_input) (SCM port),
@@ -153,7 +147,7 @@ scm_make_port_type (char *name,
 
       scm_ptobs[scm_numptob].name = name;
       scm_ptobs[scm_numptob].mark = 0;
-      scm_ptobs[scm_numptob].free = scm_port_free0;
+      scm_ptobs[scm_numptob].free = NULL;
       scm_ptobs[scm_numptob].print = scm_port_print;
       scm_ptobs[scm_numptob].equalp = 0;
       scm_ptobs[scm_numptob].close = 0;
index 22b90ad..42a51fd 100644 (file)
@@ -97,6 +97,7 @@ scm_markcdr (SCM ptr)
   return SCM_CELL_OBJECT_1 (ptr);
 }
 
+\f
 /* {Free}
  */
 
@@ -106,16 +107,7 @@ scm_free0 (SCM ptr SCM_UNUSED)
   return 0;
 }
 
-size_t
-scm_smob_free (SCM obj)
-{
-  long n = SCM_SMOBNUM (obj);
-  if (scm_smobs[n].size > 0)
-    scm_gc_free ((void *) SCM_CELL_WORD_1 (obj), 
-                scm_smobs[n].size, SCM_SMOBNAME (n));
-  return 0;
-}
-
+\f
 /* {Print}
  */
 
@@ -307,11 +299,7 @@ scm_make_smob_type (char const *name, size_t size)
     scm_misc_error (FUNC_NAME, "maximum number of smobs exceeded", SCM_EOL);
 
   scm_smobs[new_smob].name = name;
-  if (size != 0)
-    {
-      scm_smobs[new_smob].size = size;
-      scm_smobs[new_smob].free = scm_smob_free;
-    }
+  scm_smobs[new_smob].size = size;
 
   /* Make a class object if Goops is present. */
   if (SCM_UNPACK (scm_smob_class[0]) != 0)
index ca4a418..ee0e53e 100644 (file)
@@ -167,7 +167,6 @@ SCM_API void scm_i_finalize_smob (GC_PTR obj, GC_PTR data);
 SCM_API SCM scm_mark0 (SCM ptr);
 SCM_API SCM scm_markcdr (SCM ptr);
 SCM_API size_t scm_free0 (SCM ptr);
-SCM_API size_t scm_smob_free (SCM obj);
 SCM_API int scm_smob_print (SCM exp, SCM port, scm_print_state *pstate);
 
 /* The following set of functions is the standard way to create new