[FFmpeg-devel] [PATCH 2/4] lavf/segment: Simplify CSV field quoting code (part 2)

Alexander Strasser eclipse7 at gmx.net
Sat Sep 15 01:07:27 CEST 2012


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, '"');
-- 
1.7.10.2.552.gaa3bb87


More information about the ffmpeg-devel mailing list