guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: EXTERNAL: Re: Guile 1.8 Garbage Collection Question


From: Whitlock, Bradley D
Subject: RE: EXTERNAL: Re: Guile 1.8 Garbage Collection Question
Date: Wed, 26 Oct 2011 16:07:09 +0000

Hm, thanks Andy. I settled on the following solution, no problems:

SCM_DEFINE (libguile_fst_writer_emit_value, "libguile-fst-writer-emit-value",
            3,0,0,
            (SCM scm_ctx, SCM scm_fsthandle, SCM scm_val), 
            "Write a change on fstHandle")
{
  // Storage for temporary string
  char* s = NULL;

  scm_dynwind_begin (0);
  s = scm_to_locale_string (scm_val);

  fstWriterEmitValueChange(SCM_TO_CTX (scm_ctx),
                           SCM_TO_FSTHANDLE (scm_fsthandle),
                           s);
  scm_dynwind_free (s);
  scm_dynwind_end();

  return SCM_UNSPECIFIED;
}

Thanks,
Brad

-----Original Message-----
From: Andy Wingo [mailto:address@hidden 
Sent: Wednesday, October 26, 2011 2:39 AM
To: Whitlock, Bradley D
Cc: address@hidden
Subject: EXTERNAL: Re: Guile 1.8 Garbage Collection Question

On Tue 25 Oct 2011 22:34, "Whitlock, Bradley D" <address@hidden> writes:

>   scm_dynwind_unwind_handler (free, s, SCM_F_WIND_EXPLICITLY);

You can write this as scm_dynwind_free (s), FWIW.

Otherwise I didn't see the problem.  `s' is not managed by the GC, so
the GC shouldn't have much to do with it.

Regards,

Andy
-- 
http://wingolog.org/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]