[pacman-dev] [PATCH] rewrite strreplace

Xavier shiningxc at gmail.com
Mon Sep 7 13:50:26 EDT 2009


On Mon, Sep 7, 2009 at 2:08 AM, Dan McGee<dpmcgee at gmail.com> wrote:
> On Sun, Sep 6, 2009 at 6:47 PM, Xavier Chantry<shiningxc at gmail.com> wrote:
>> +
>> +       if(!list) {
>> +               return(strdup(str));
>> +       }
>> +       newstr = malloc(strlen(str) + 1 +
>> +                       alpm_list_count(list) * (replacesz - needlesz));
> Maybe an explanation comment here? And there should be no way to trick
> this up by having needlesize > replacesize, or the other way around
> (replacesize > needlesize), since those are declared as unsigned?
>

All situations should be handled, needlesize >= replacesize or
needlesize <= replacesize

But I don't understand what the problem is with unsigned ? I guess
it's probably a good thing that size/legnth are positive.


More information about the pacman-dev mailing list