[bt-devel] backend

Joachim Ansorg bt-devel@crosswire.org
Sat, 28 Oct 2000 16:39:07 +0000


Hi!

> > You know we talked about this topic. AFAIK we said, that functions should
> > get a pointer to modify to prevent memory leaks. For example if we return
> > a CSwordLDKey it would probably create some memory leaks.
>
> That is true. IMO the function should only modify this key where it is
> called, and give back a pointer to _this_. No new key created, only moved
> this one to the next entry.

Hm, but if we say something like this:
CSwordVerseKey *key1 = new CSwordVerseKey(m_module);
CSwordVerseKey *key2 = new CSwordVerseKey(m_module);
....
key1 = key2->getNextVerse();

This would not delete key1 so a memory leak will appear. 

> > Using only NextEntry() would be bad because we can't work with other
> > keys.

> The "other key" has its own nextEntry() function.

--Joachim