This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Suggestion for strings.c
- To: Guile Mailing List <guile at sourceware dot cygnus dot com>
- Subject: Suggestion for strings.c
- From: Dirk Herrmann <dirk at ida dot ing dot tu-bs dot de>
- Date: Wed, 26 Jan 2000 18:02:35 +0100 (MET)
Hi!
In strings.c there is a function scm_makstr, which takes an additional
slot parameter. This slot parameter, however, is always 0 throughout
guile, with one exception: scm_makfromstr in string.c calls this function
and passes a slot parameter which it receives as a paramter
itself. Again, the slot parameter for scm_makfromstr is also always 0
throughout guile, with two exceptions in symbol.c.
In symbol.c the slot parameter is used for a very special purpose, which
is to create an 'msymbol'. Don't ask me what that is, but it is _not_ a
string, but a certain kind of symbol.
This shows, that scm_makstr is basically used to perform two different
tasks: Creating strings, and creating msymbols (if slot != 0).
My suggestion is to separate the two functionalities. This allows to get
rid of the redundant 0 parameter in places where it does not make any
sense. (This would be at over 50 places in guile, while, as I said above,
only at two places this parameter has some meaning).
This would clarify the semantics of scm_makstr and scm_makfromstr and
might also improve performance a tiny bit, since passing the redundant 0
parameter as well as checking for that special case in scm_makstr causes
some overhead.
If I get an OK, I will provide a patch for this.
Best regards,
Dirk Herrmann