wget-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: wget2 | Small fixes (!505)


From: Darshit Shah (@darnir)
Subject: Re: wget2 | Small fixes (!505)
Date: Sun, 24 Apr 2022 10:10:28 +0000


Merge request https://gitlab.com/gnuwget/wget2/-/merge_requests/505 was 
reviewed by Darshit Shah

--
  <!-- Get preloaded note discussion-->
  
Darshit Shah started a new discussion on unit-tests/test.c: 
https://gitlab.com/gnuwget/wget2/-/merge_requests/505#note_921936882

>       CHECK(p = wget_memdup("xxx", 4));
> -     CHECK(!memcmp(p, "xxx", 4)); xfree(p);
> +     if (p) {

This is a good catch. But, IMO, the better check here is to verify that `p` is 
indeed not a null pointer, since we don't expect that to happen. If p was null, 
we should trigger a fault.

--
  <!-- Get preloaded note discussion-->
  
Darshit Shah started a new discussion on libwget/cookie.c: 
https://gitlab.com/gnuwget/wget2/-/merge_requests/505#note_921936884

>       }
>  
> -     memset(cookie_db, 0, sizeof(*cookie_db));

Why the hate for `memset`? :smile: 

I get it's a one-liner, but malloc + memset is a little more clear that calloc. 
The reader would need to be aware that calloc will zero the allocated memory.

To be clear, I'm not against this change. I'm only wondering why?


-- 
Reply to this email directly or view it on GitLab: 
https://gitlab.com/gnuwget/wget2/-/merge_requests/505
You're receiving this email because of your account on gitlab.com.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]