Re: Done any string functions lately?

"Mark Hahn" <[email protected]> Tue, 27 Apr 2004 13:01:33 -0700
Newsgroups gmane.comp.lang.prothon.devel
Message-ID <[email protected]>
Joe Knapka wrote:

> I did lower(), tried to rebuild from the svn repository in order to
> test it, got a ./configure error claiming that apr-util isn't
> installed, and haven't touched it since then. I have no idea why
> ./configure can't find the apr-util stuff when I try to build from the
> svn code; when I build from the source tarball everything works.

Ben should be able to help you with that.  I unfortunately know doo-dah
about linux.

> I should have time to investigate further tonight.
>
> By the way, I notice that a lot of the code in builtins-string.c
> is not doing the highly-recommended DEL_UNLOCK on objects it
> creates. Is there a good reason for that?

Yes, there's a very good reason.  I'm a lazy bum :)

I've been putting off worrying about memory leaks (which that is an example
of) until later.  There are also a fair number of unmatched pr_mallocs.

Note that when you make or get responsibility for a new object you may
del_unlock it after putting it in a containment hierarchy rooted in
global_objects, or you may leave it del_locked while you want it preserved
until you del_unlock it later (the equivalent of doing a pr_free to a
pr_malloc).  So it is legal to not del_unlock a new object if you are sure
it will be del_unlocked later.

P.S. You will discover that the garbage collector in the other thread is
quite aggressive. If you accidently do del_unlock() too early it is
surprising how quickly that obj will dissapear out from under you.  You'll
get quite nasty errors.