[FFmpeg-devel] [PATCH] rtsp.c small cleanups

Ronald S. Bultje rsbultje
Mon Mar 23 23:31:55 CET 2009


Hi,

On Mon, Mar 23, 2009 at 6:28 PM, Ronald S. Bultje <rsbultje at gmail.com> wrote:
> memchr() appears to work.

Same patch with a comment explaining why we use memchr() instead of
the more obvious strchr().

Sorry for all this noise. :-).

Ronald
-------------- next part --------------
Index: ffmpeg-svn/libavformat/rtsp.c
===================================================================
--- ffmpeg-svn.orig/libavformat/rtsp.c	2009-03-23 14:51:11.000000000 -0400
+++ ffmpeg-svn/libavformat/rtsp.c	2009-03-23 18:30:34.000000000 -0400
@@ -55,7 +55,9 @@
 }
 
 #define SPACE_CHARS " \t\r\n"
-#define redir_isspace(c) strchr(SPACE_CHARS, c)
+/* we use memchr() instead of strchr() here because strchr() will return
+ * the terminating '\0' of SPACE_CHARS instead of NULL if c is '\0'. */
+#define redir_isspace(c) memchr(SPACE_CHARS, c, 4)
 static void skip_spaces(const char **pp)
 {
     const char *p;



More information about the ffmpeg-devel mailing list