This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Suggestion for strings.c


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]