On Mon, Sep 7, 2009 at 2:08 AM, Dan McGee<[email protected]> wrote: > On Sun, Sep 6, 2009 at 6:47 PM, Xavier Chantry<[email protected]> 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.
