From: Ludovic Courtès Date: Mon, 28 Sep 2009 20:46:33 +0000 (+0200) Subject: guile: Adjust for Guile 1.9.3+. X-Git-Tag: gnutls_2_9_7~14 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b595d1625e13a1836df6504ee1bafe1ef067726f;p=thirdparty%2Fgnutls.git guile: Adjust for Guile 1.9.3+. * 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. --- diff --git a/configure.ac b/configure.ac index 47203a699b..77297ac5dc 100644 --- a/configure.ac +++ b/configure.ac @@ -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.]) diff --git a/guile/src/core.c b/guile/src/core.c index da711c216e..c0ded90166 100644 --- a/guile/src/core.c +++ b/guile/src/core.c @@ -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 }