[Mono-devel-list] culture info patches

Jackson Harper jackson at ximian.com
Tue Mar 16 12:34:54 EST 2004


> Why not do a binary search?

I'll go back to using bsearch, I was using it before (with sorted data)
and it would keep scanning after a match. Most likely due to an error I
had in my tables that I have fixed.

> Do you really need to call the argumentless ctor? We control all the
> code, so if possible we should avoid going to managed code here
> and initialize what we need ourselves.

Yeah I guess I can just init these on the managed side before passing
control over.

> > +	if (ci->datetime_format_index > 0)
> > +		this->datetime_format = create_datetime_format_info (this, ci->datetime_format_index);
> > +	if (ci->number_format_index > 0)
> > +		this->number_format = create_number_format_info (this, ci->number_format_index);
> 
> Shouldn't the compare here be >= 0?

Damn it you are observant, I did fix that about 5 minutes after sending
the patches and thought to myself "I bet Paolo is the only one that
catches that".

> 
> > typedef struct {
> > 	gint lcid;
> > 	const gchar *englishname;
> > 	const gchar *displayname;
> > 	const gchar *nativename;
> > 	const gchar *iso3lang;
> > 	const gchar *iso2lang;
> > 	gint datetime_format_index;
> > 	gint number_format_index;
> > } CultureInfoEntry;
> 
> AFAIK cultures have a sort of parent-child relationship.
> How do you take that into account? Maybe you can add a parent_lcid to
> the structure.

Right now the parent-child-specific relationship is handled by the 
culture map. Since we are removing that I'll add this data in.

> > typedef struct {
> > 	gint cur_lcid;
> > 	gint seek_lcid;
> > 	gint idx;
> > } DisplayNameEntry;
> 
> What is this structure used for?
> 

Ugh, This was an artifact of some old code.

Thanks for the review, much appreciated,
Jackson






More information about the Mono-devel-list mailing list