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

Måns Rullgård mans
Sat Jun 23 14:13:11 CEST 2007


Michael Niedermayer <michaelni at gmx.at> writes:

> Hi
>
> On Fri, Jun 22, 2007 at 06:52:24PM +0200, Michael Niedermayer wrote:
>> Hi
>> 
>> On Fri, Jun 22, 2007 at 03:27:46PM +0200, Benoit Fouet wrote:
> [...]
>> >  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!
>
> i think this ended up sounding a little more rude then it was
> intended to
> what i wanted to say is that the code should be cleaned up and simplified
> before moving it into libavutil

OK, I've cleaned up the string functions.  Can we move them now?

Can we also rename some of them using more intuitive names?  I would
suggest these:

strstart  -> av_strstart
stristart -> av_stristart
pstrcpy   -> av_strncpy
pstrcat   -> av_strncat

I'd also suggest placing the prototypes for these functions in
libavutil/string.h.

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




More information about the ffmpeg-devel mailing list