[FFmpeg-devel] [PATCH] eval: implement av_strtod internally.

Michael Niedermayer michaelni at gmx.at
Tue Feb 21 00:20:05 CET 2012


On Sun, Feb 19, 2012 at 03:02:42PM +0100, Nicolas George wrote:
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  libavutil/eval.c |  155 ++++++++++++++++++++++++++++++++++++++++++++----------
>  1 files changed, 127 insertions(+), 28 deletions(-)
> 
> 
> I do not know if people will like it, and I will not insist if not.
> 
> This patch implements our own version of strtod, with pros and cons;
> hopefully more pros but YMMV. The cons are:
> 
> - More code to maintain.
> - Does not set errno (we do not use it).
> - Does not support "NAN(blah)".
> - Probably less optimized than the libc's.
> 
> The pros, on the other hand:
> 
> - Does not break if LC_NUMERIC is set (LC_NUMERIC is synonym with
>   PLEASE_BREAK_HALF_MY_CODE, but still, some program init it).
> 
> - Supports hexadecimal non-integers (the current implementation implements
>   hexadecimal integers by wrapping strtod, therefore making it impossible to
>   use them if they are supported; this would be easily fixed though).
> 
> - Can use a string terminated by a pointer rather than an extra NUL. This is
>   useful when parsing a substring, to avoid copying it.

I like the idea

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When the tyrant has disposed of foreign enemies by conquest or treaty, and
there is nothing more to fear from them, then he is always stirring up
some war or other, in order that the people may require a leader. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120221/948a28f5/attachment.asc>


More information about the ffmpeg-devel mailing list