wget-dev
[Top][All Lists]
Advanced

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

Re: wget2 | Draft: Small fixes (!505)


From: @rockdaboot
Subject: Re: wget2 | Draft: Small fixes (!505)
Date: Sat, 28 May 2022 17:54:44 +0000



Tim Rühsen started a new discussion on examples/getstream.c: 
https://gitlab.com/gnuwget/wget2/-/merge_requests/505#note_963276547

>               // .wax/.asx format <ASX VERSION="3.0">
>               char *p, url[128];
>  
> -             if ((p = strcasestr_ascii(resp->body->data, " HREF=\"")) && 
> sscanf(p + 7, "%127[^\"]", url) == 1) {
> +             if ((p = strcasestr_ascii(resp->body->data, " HREF=\"")) && 
> sscanf(p + strlen(" HREF=\""), "%127[^\"]", url) == 1) {

I agree that those hard-coded numbers are not perfect. But the same is true to 
your changes, they duplicate the string. Both can get out-of-sync in future 
changes. Also I am not sure that all compilers optimize the strlen() away under 
all conditions (e.g. with -O0).

We try to avoid macros, but maybe we can add a static inline function for this 
!?

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




reply via email to

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