On Wed, Jun 23, 2010 at 03:57:20PM -0700, Josh Allmann wrote:
Hi,
On 23 June 2010 14:48, Josh Allmann <joshua.allmann@gmail.com> wrote:
Awesome -- patch 002 in this series also replaces memchr with strspn, as noted by Michael and Ronald.
Updated version attached.
Josh
internal.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 6e0a821a7df48a080706183c1bf3e7483986e1af 0002-Use-strspn-rather-than-memchr-in-ff_skip_spaces.patch From abd99d7f37708fa6c41825eb4a2c37133f7d62f5 Mon Sep 17 00:00:00 2001 From: Josh Allmann <joshua.allmann@gmail.com> Date: Wed, 23 Jun 2010 14:29:27 -0700 Subject: [PATCH 2/7] Use strspn rather than memchr in ff_skip_spaces.
--- libavformat/internal.h | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/libavformat/internal.h b/libavformat/internal.h index aaa71ac..ebe5d6b 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -175,15 +175,17 @@ int ff_write_chained(AVFormatContext *dst, int dst_stream, AVPacket *pkt, AVFormatContext *src);
#define SPACE_CHARS " \t\r\n" -/* we use memchr() instead of strchr() here because strchr() will return +/* we use strspn() 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) +#define redir_isspace(c) strspn(c, SPACE_CHARS) static inline void ff_skip_spaces(const char **pp) { const char *p; + int span; + p = *pp; - while (redir_isspace(*p)) - p++; + span = redir_isspace(p); + p += span; *pp = p; }
you can call strspn(SPACE_CHARS) directly, you dont need ff_skip_spaces() [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you really think that XML is the answer, then you definitly missunderstood the question -- Attila Kinali