chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] gdbm.egg patch


From: Daishi Kato
Subject: Re: [Chicken-users] gdbm.egg patch
Date: Thu, 14 Jul 2005 10:54:50 +0900
User-agent: Wanderlust/2.15.1 (Almost Unreal) Emacs/21.4 Mule/5.0 (SAKAKI)

Hi felix,

Thanks a lot for your modification.
The new version works fine, except for
the case of fetching non-existent data. (it crashes)

My patch is the following, but I hope
you have another way, maybe?

Daishi

--- gdbm.scm.felix      2005-07-14 09:56:33.000000000 +0900
+++ gdbm.scm    2005-07-14 10:31:01.000000000 +0900
@@ -119,7 +119,7 @@
         (lp (gdbm-next-key dbf key) (kons key val acc))))))
 
 (define-external (make_string_with_len (c-pointer ptr) (int len)) scheme-object
-  (and (not (##sys#null-pointer? ptr))
+  (and ptr
        (let ([str (make-string len)])
         (##core#inline "copy_string_result" ptr len str)
         (##core#inline "free_ptr" ptr)


At Wed, 13 Jul 2005 23:29:01 +0200,
felix winkelmann wrote:
> 
> [1  <text/plain; ISO-8859-1 (quoted-printable)>]
> On 7/5/05, Daishi Kato <address@hidden> wrote:
> > Hi,
> > 
> > As looking into the gdbm egg, I noticed the limitation
> > that it can only handle strings without any zeros in the middle,
> > in other words, "c-string"s.
> > Attached file is the patch for it,
> > although the function "make_string_with_len" is not nice.
> > I'm not sure if it works correctly,
> > since I'm not familiar with the GC stuff.
> > I believe there should be some kind of low-level function
> > doing the similar thing, which can improve this patch.
> > 
> 
> Many thanks for your patch. I've optimized the string-construction
> procedure a little (the way you handle this is correct, there is currently
> no way of heap-allocating storage from the GC'd heap without
> doing a callback), and replaced some foreign-lambda forms with
> foreign-safe-lambda (otherwise really weird crashes happen when
> you call back the string-constructor). I also checked out the gdbm
> manpages and they require to free(3) the results of `gdbm_fetch', etc.
> I've attached the new version. I plan to release a new chicken version
> soon, and since many things have changed, the improved gdbm egg
> will be made publicly available at the same time (but this one should
> work fine with the current chicken). 
> 
> 
> cheers,
> felix
> [2 gdbm.scm <application/octet-stream (base64)>]
> 




reply via email to

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