Re: [Nautilus-list] Rename Eel

iain wrote:
> Which is what I did. I'm just asking if the change is needed.
> I don't think my method is less inconvienient, but iterating over a list
> with nth is a nono.
> I think my way of iterating turned from
> for (i = 0; i < eel_string_list_length (stringlist); i++) {
>         data = eel_string_list_nth (stringlist, i);
> }
> into
> for (l = eel_string_list_peek (stringlist); l; l = l->next) {
>         data = l->data;
> }
> I'm not intending this as a flame (which were the vibes I got from your
> reply), I'm honestly asking is it worth changing, given that it's used
> in so few places.
> iain

The change to peek the internal details of the list is definitely
something that I think is bad and defeats the whole purpose of this data

Note that there is an iterator which does the same thing as your second
example.  You can use this if you are trying to avoid the nth string
duplication during an iteration:

void eel_string_list_for_each (
const EelStringList *string_list,
EelStringListForEachCallback for_each_callback,
gpointer callback_data);

Use the iterator instead.  That way if the implementations details
change, code that iterates string lists will still work.  Exposing the
details of with a peek function defeats this.

Btw, I didnt take your mail as a flame and im sorry if I gave that
impression.  I think that a patch that makes the internals of the string
list faster without breaking the api would be welcome.


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