[sword-devel] IMPORTANT INTERFACE CHANGE

Troy A. Griffitts sword-devel@crosswire.org
Mon, 10 Apr 2000 03:06:19 -0700


To fix this problem correctly, I had to fix a logic bug that may have
been causing other failures elsewhere.

For VerseKey::ParseVerseList() to return a ListKey &, I had to return a
static member ListKey &internalListKey.  This was poor code that was not
thread safe nor safe in recursive code.  In my opinion, the correct way
to solve this is to remove internalListKey and return a ListKey object
on the stack which is what is now committed in CVS.

THIS EFFECTS CLIENT CODE!  Anyone calling ParseVerseList manually may
need to change their code.  It was previously possible to optimize a
call like this:

	ListKey &verses = VerseKey::ParseVerseList("jo 1:1-10,15,17");

This will no longer produce the same optimized effect.  The only change
to the code would be:

	ListKey verses = VerseKey::ParseVerseList("jo 1:1-10,15,17");

This syntax works with older 1.4.x code also, but was not as optimized.

NOTE: the absense of the '&' reference symbol.  This causes the stack
ListKey to be copied into your local ListKey object.  If you retain the
'&' you will likely get compiler warnings and your reference variable
will be bound to a stack variable that will disappear after this line is
complete.  HEED THE COMPILER WARNINGS :)


It is a drag to change the interface, especially in a release thread. 
It was a tossup between leaving the bug in place or breaking binary
compatibility between 1.4.x versions.  Hope everyone agrees with my
decision.

	-Troy.


"Troy A. Griffitts" wrote:
> 
> Got it.  Ugh.  What a pain in my butt.  Anyway, changes are commited to
> the 1.4.x tree.  I'm working on the 1.4.7 final release now.  The
> parsing should be a little more intelligent now if you would like it to
> parse ranges like mat-rev
> 
> Let me know how it works.  I'll have a Windows binary up soon that
> showcases the new range parsing.  I'll post the url when it's done.
> 
>         Praise God always,
>                 -Troy.