]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
guile: Adjust for Guile 1.9.3+.
authorLudovic Courtès <ludo@gnu.org>
Mon, 28 Sep 2009 20:46:33 +0000 (22:46 +0200)
committerLudovic Courtès <ludo@gnu.org>
Mon, 28 Sep 2009 20:47:08 +0000 (22:47 +0200)
* guile/src/core.c (mark_session_record_port, free_session_record_port):
  Conditionalize on `SCM_MAJOR_VERSION == 1 && SCM_MINOR_VERSION <= 8'.
  (scm_init_gnutls_session_record_port_type): Adjust accordingly.
  (make_session_record_port): Use `scm_gc_malloc_pointerless ()' when
  available.

configure.ac
guile/src/core.c

index 47203a699ba8858ff57d6d723092b172e52025c0..77297ac5dc9aaf3313d1c1d10e662e1836df25b1 100644 (file)
@@ -145,6 +145,15 @@ if test "$opt_guile_bindings" = "yes"; then
                           gnu89_inline=yes, gnu89_inline=no)
         AC_MSG_RESULT($gnu89_inline)
         CFLAGS="$_gcc_cflags_save"
+
+       # Optional Guile functions.
+       save_CFLAGS="$CFLAGS"
+       save_LIBS="$LIBS"
+       CFLAGS="$CFLAGS $GUILE_CFLAGS"
+       LIBS="$LIBS $GUILE_LDFLAGS"
+       AC_CHECK_FUNCS([scm_gc_malloc_pointerless])
+       CFLAGS="$save_CFLAGS"
+       LIBS="$save_LIBS"
       else
         AC_MSG_RESULT([no])
         AC_MSG_WARN([A sufficiently recent GNU Guile not found.  Guile bindings not built.])
index da711c216e96a860b99a4bc5026e79849b035b11..c0ded90166ebcfbadc37639e1e2326d51a536b26 100644 (file)
@@ -720,6 +720,9 @@ static scm_t_bits session_record_port_type;
 static const char session_record_port_gc_hint[] =
   "gnutls-session-record-port";
 
+
+#if SCM_MAJOR_VERSION == 1 && SCM_MINOR_VERSION <= 8
+
 /* Mark the session associated with PORT.  */
 static SCM
 mark_session_record_port (SCM port)
@@ -755,9 +758,11 @@ free_session_record_port (SCM port)
 
   return 0;
 }
-
 #undef FUNC_NAME
 
+#endif /* SCM_MAJOR_VERSION == 1 && SCM_MINOR_VERSION <= 8 */
+
+
 /* Data passed to `do_fill_port ()'.  */
 typedef struct
 {
@@ -865,7 +870,12 @@ make_session_record_port (SCM session)
 
   c_port_buf =
     (unsigned char *)
-    scm_gc_malloc (SCM_GNUTLS_SESSION_RECORD_PORT_BUFFER_SIZE,
+#ifdef HAVE_SCM_GC_MALLOC_POINTERLESS
+    scm_gc_malloc_pointerless
+#else
+    scm_gc_malloc
+#endif
+                  (SCM_GNUTLS_SESSION_RECORD_PORT_BUFFER_SIZE,
                   session_record_port_gc_hint);
 
   /* Create a new port.  */
@@ -921,8 +931,14 @@ scm_init_gnutls_session_record_port_type (void)
     scm_make_port_type ("gnutls-session-port",
                        fill_session_record_port_input,
                        write_to_session_record_port);
+
+  /* Guile >= 1.9.3 doesn't need a custom mark procedure, and doesn't need a
+     finalizer (since memory associated with the port is automatically
+     reclaimed.)  */
+#if SCM_MAJOR_VERSION == 1 && SCM_MINOR_VERSION <= 8
   scm_set_port_mark (session_record_port_type, mark_session_record_port);
   scm_set_port_free (session_record_port_type, free_session_record_port);
+#endif
 }
 \f