[FFmpeg-devel] [PATCH 2/4] lavf/segment: Simplify CSV field quoting code (part 2)
Stefano Sabatini
stefasab at gmail.com
Sat Sep 15 10:07:45 CEST 2012
On date Saturday 2012-09-15 01:07:27 +0200, Alexander Strasser encoded:
> Remove the pointer indirection. Since we do not need to reset the
> pointer to the start of the string, it is not needed anymore.
>
> Signed-off-by: Alexander Strasser <eclipse7 at gmx.net>
> ---
> libavformat/segment.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/libavformat/segment.c b/libavformat/segment.c
> index 6dde547..07b8da3 100644
> --- a/libavformat/segment.c
> +++ b/libavformat/segment.c
> @@ -76,16 +76,15 @@ typedef struct {
>
> static void print_csv_escaped_str(AVIOContext *ctx, const char *str)
> {
> - const char *p;
> int quote = !!str[strcspn(str, "\",\n\r")];
>
> if (quote)
> avio_w8(ctx, '"');
>
> - for (p = str; *p; p++) {
> - if (*p == '"')
> + for (; *str; str++) {
> + if (*str == '"')
> avio_w8(ctx, '"');
> - avio_w8(ctx, *p);
> + avio_w8(ctx, *str);
> }
> if (quote)
> avio_w8(ctx, '"');
LGTM.
--
FFmpeg = Fierce and Furious Maxi Programmable Esoteric God
More information about the ffmpeg-devel
mailing list