[Freeciv-Dev] Re: Government file.
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
> > Example:
> > for(i = 0; i < size; i++)
> > if (ToBeFound == Tab [i]) return i;
> > becomes
> > for(i = 0; i < size && ToBeFound != Tab [i]; i++);
> > return i;
>
> These don't seem identical to me. Is it my C knowledge which is
> getting rusty? (ie the first one says nothing about what to return
> if no element in Tab is '==' to ToBeFound)
True, the code was
for(i = 0; i < size; i++)
if (ToBeFound == Tab [i]) return i;
return size;
And, in government.c, (It's in the patch attached. )
for(i=G_FIRST_FLAG; i<G_LAST_FLAG; i++) {
if (mystrcasecmp(flag_names[i], s)==0) {
return i;
}
}
return G_LAST_FLAG;
Bye,
Nicolas
|
|