[FFmpeg-devel] [PATCH 1/4] lavf/segment: Simplify CSV field quoting code
Stefano Sabatini
stefasab at gmail.com
Sat Sep 15 10:05:59 CEST 2012
On date Saturday 2012-09-15 01:06:50 +0200, Alexander Strasser encoded:
> Should also be faster (though I doubt that hardly
> ever matters for the usage here).
>
> Signed-off-by: Alexander Strasser <eclipse7 at gmx.net>
> ---
> libavformat/segment.c | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/libavformat/segment.c b/libavformat/segment.c
> index dc12349..6dde547 100644
> --- a/libavformat/segment.c
> +++ b/libavformat/segment.c
> @@ -77,14 +77,7 @@ typedef struct {
> static void print_csv_escaped_str(AVIOContext *ctx, const char *str)
> {
> const char *p;
> - int quote = 0;
> -
> - /* check if input needs quoting */
> - for (p = str; *p; p++)
> - if (strchr("\",\n\r", *p)) {
> - quote = 1;
> - break;
> - }
> + int quote = !!str[strcspn(str, "\",\n\r")];
LGTM, assuming it has been tested.
--
FFmpeg = Faithless Fundamentalist Minimalistic Philosophical Encoding/decoding God
More information about the ffmpeg-devel
mailing list