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

Måns Rullgård mans
Sat Jun 23 00:38:14 CEST 2007


Michael Niedermayer <michaelni at gmx.at> writes:

> 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

Commited.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list