[haiku-commits] Re: r37716 - in haiku/trunk: headers/os/locale src/kits/locale

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 23 Jul 2010 15:20:36 +0200

On 2010-07-23 at 14:35:49 [+0200], Adrien Destugues 
<pulkomandy@xxxxxxxxxxxxxxxxx> wrote:
> > pulkomandy@xxxxxxxxxxxxxxxxx wrote:
> > > Log:
> > >  * Add locking system to BCountry to avoid problems with the
> > > formatters
> > > being deleted while you use them, or created multiple times.
> > 
> > That really doesn't look like a friendly API anymore - why make this
> > public? Since only the *creation* of the formatters is the problem,
> > why
> > this complicated solution?
> 
> It is not public. The class handles the locking itself, you don't have
> to care about it.

I guess the missing underscore prefix of {Lock,Unlock}TimeFormatter() 
misled Axel.

Some ideas to simplify the implementation:

* Group BLocker and the formatter pointer in a struct, say Formatter.

* Use an array with four Formatter elements. Indexed by an enum 
({SHORT,LONG}_{DATE,TIME}_FORMATTER). This way the public Format*() methods 
can just be demultiplexed to common private implementations.

CU, Ingo

Other related posts: