Re: Rationale for change in behavior of g_strsplit when passed empty string?



Darin Adler <darin bentspoon com> writes:
> When g_strsplit in glib 1.2 was passed an empty string, it returned an
> empty vector.
> 
> When g_strsplit in glib 1.3 is passed an empty string, it returns a
> vector with a single empty string in it.
> 
> Is there a good reason for this change? We'll have to make some small
> changes to code in eel and nautilus because of the change, and I just
> wanted to make sure it was no accident.
> 

I don't remember discussion of this, but here is a relevant-looking
ChangeLog:

2000-10-26  Sebastian Wilhelmi  <wilhelmi ira uka de>

        * gstrfuncs.c (g_strsplit): When the string is ended by a
        delimiter, return an extra empty string just like for a
        delimiter at the start of the string. This makes the function
        behave more consistent and also fixes Bug #15026.

The bug is here:
  http://bugzilla.gnome.org/show_bug.cgi?id=15026

Fixing this bug sounds reasonable. However, it isn't clear to me that
the change you describe was intentionally made as part of fixing it.
Any thoughts on which behavior is more useful or more expected?

Havoc




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]