[Freeciv-Dev] C99 vsnprintf().
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Currently, if the native vsnprintf() does not follow the letter of the
C99 specification, we use a large (64k) buffer and vsprintf() instead.
Requiring strict adherence to C99 is a in my opinion a bit harsh,
since there are a lot of systems around with perfectly good
vsnprintf()'s except for the fact that they do not return the number
of byte written. Pre-glibc 2.1 systems are one prominent example, and
I'm pretty sure that the Amiga is not up to scratch either. On the
other hand, there are only 6 places in the source where this behaviour
is actually relied upon.
I have two proposals:
1) Don't rely on C99 behaviour and use strlen() explicitly whenever
we need this information.
2) Add a call to strlen() in my_vsnprintf() so we don't have to care
at all.
My preferred method would be no. 1, since this is the most
straight-forward and unobtrusive method.
I think this would be worthwhile, in particular on the Amiga where 64k
is not that insignificant amount.
--
Big Gaute (not to be confused with LG)
WHO sees a BEACH BUNNY sobbing on a SHAG RUG?!
- [Freeciv-Dev] C99 vsnprintf().,
Gaute (B) Strokkenes <=
|
|