On Mon, Sep 7, 2009 at 12:50 PM, Xavier<shiningxc@gmail.com> wrote:
On Mon, Sep 7, 2009 at 2:08 AM, Dan McGee<dpmcgee@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
On Sun, Sep 6, 2009 at 6:47 PM, Xavier Chantry<shiningxc@gmail.com> wrote: 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.
You are doing math on two unsigned integers, and you need a signed result. I just want to make sure the result is sane. -Dan