[sword-devel] SWConfig Changes

Daniel Glassey sword-devel@crosswire.org
Thu, 5 Sep 2002 12:26:17 +0100

On 4 Sep 2002 at 21:08, Troy A. Griffitts sent forth the message:

>> [Good ideas]

Just a couple of random things that I want to make sure work.
I guess it should be specified what it is going to be used for just to make sure it will do 

um, I'll just send this and send those bits later.

> > I hope this makes sense :)
> > 
> > Some additional changes I might make:
> > 
> > - remove use of strtok(). strtok() is a non-reentrant function (not to
> > mention not thread safe), which is potentially dangerous, especially for
> > a library to use. Could be replaced by strtok_r(),
> As long as whatever you use is fast and portable, I'm game, BUT know 
> that strtok is used all over the rest of the code, as well.

if a useful solution is found we can change it all over the code.

I'm not sure that config parsing is a critical part of the code in terms of speed (as long as it 
isn't noticeably so)?

> > or hand-coded parsing
> > (since the parsing is not complicated)
> > - get rid of using namespace std; in the header file. Just because
> > people want to use Sword doesn't necessarily mean they want 1000+
> > symbols imported into the global namespace :)
> great.  only add the using std::whatever you use.

I'll add removing 'using namespace std' from the other 8 files it is still in to my todo list

> > - make multimapwithdefault more efficient by caching iterators
> Just be sure it's understandable fast and portable.

efficient sounds fast, c++ standard should be portable, so that just leaves the other ;)

> > - remove non-private member variables from the SWConfig
> Please don't change the current interface.

To rephrase that, only change the interface if you:
notify what specific changes are in advance so 
you replace all current references to such variables with the retreiver functions (in the lib 
and win32 app)
document it
notify the bibletime and gnomesword guys before you make the change and afterwards
check in all the files at once and don't forget any ( hmmm, readtext ;) )


in this case in the lib there is swmgr and swlocale that use swconfig so that should be fine 
The win32 app uses it quite a lot so thats a little more awkward

> > - modify the code to handle arbitrary line-lengths.
> > 
> > Any comments on these suggested changes are welcome.
> I'm excited!  This functionality will be very coooool and useful!

agreed :)