[FFmpeg-devel] [PATCH] move cutils string functions to libavutil

Michael Niedermayer michaelni
Sat Jun 23 00:19:38 CEST 2007


Hi

On Fri, Jun 22, 2007 at 10:08:18PM +0100, M?ns Rullg?rd wrote:
> Michael Niedermayer <michaelni at gmx.at> writes:
> 
> >>  int strstart(const char *str, const char *val, const char **ptr)
> >>  {
> >> -    const char *p, *q;
> >> -    p = str;
> >> -    q = val;
> >> -    while (*q != '\0') {
> >> -        if (*p != *q)
> >> -            return 0;
> >> -        p++;
> >> -        q++;
> >> -    }
> >> -    if (ptr)
> >> -        *ptr = p;
> >> -    return 1;
> >> +    return av_strstart(str, val, ptr);
> >>  }
> >
> > dont even think about moving this trash into libavutil!
> > this can be implemented in half the code
> 
> How about one third the code (lines)?
> 
> int strstart(const char *str, const char *pfx, const char **ptr)
> {
>     while (*pfx && *pfx++ == *str++);
>     if (!*pfx && ptr)
>         *ptr = str;
>     return !*pfx;
> }

looks nice

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070623/d15a7cd2/attachment.pgp>



More information about the ffmpeg-devel mailing list