dim: implicit passing/handling of url variable

Daniel Vetter daniel at ffwll.ch
Wed Oct 24 08:10:34 UTC 2018


On Tue, Oct 23, 2018 at 04:47:35PM +0100, Emil Velikov wrote:
> Hi all,
> 
> Many of the functions would define a local url, yet pull the contents
> of variable, implicitly from the parent function.
> 
> Take url_to_remote() for example:
>  - takes a variable list of URLs - $*
>  - checks if there's at least one URL passed to the function
>  - uses $url from the parent to iterate through the URLs ... doesn't use $*

Where does it do that? I spot a local url (so not using the parents), and
afaiui the

for url ; do
...

thing iterates through $*, putting it into url.

>  - prints an error via $*
>  - picks the first URL and stores it in the url variable
> 
> Quick skim shows that other functions do the same thing. I cannot spot
> anything that would mention why or point out this (imho unusual)
> design decision.
> Is that intentional? Did i completely misunderstood the code?
> 
> Can we avoid doing that - as-is the code is fairly hard to follow :-\

Definitely should avoid doing that. We try to only have local variables
(all pre-declared), global, or function arguments, No other fancy
inheriting, because that's unmaintainable.
-Daniel

> 
> Any input will be appreciated.
> 
> Thanks
> Emil
> _______________________________________________
> dim-tools mailing list
> dim-tools at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dim-tools

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the dim-tools mailing list