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

Måns Rullgård mans
Fri Jun 22 23:08:18 CEST 2007


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;
}

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




More information about the ffmpeg-devel mailing list