Re: …: Reduce scope for the variable “…” in …()

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

 



> Probably the other people are right that making scopes shorter is more
> important when the function is very long.

How much will sizes of function implementations influence the acceptance
for possible source code refactorings?
https://refactoring.com/catalog/reduceScopeOfVariable.html

* Would you find another conversion of an extra null pointer initialisation
  to a later variable definition helpful then at other places?

  Example:
  [PATCH] dm snapshot: Reduce scope for the variable “pe” in snapshot_map()
  https://elixir.bootlin.com/linux/v5.10/source/drivers/md/dm-snap.c#L1941
  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/md/dm-snap.c?id=2c85ebc57b3e1817b6ce1a6b703928e113a90442#n1941

* How do you think about to omit the initialisation for the variable “ret”
  in the implementation of the function “w1_uevent”
  (because it will be reassigned by a function call a bit later)?
  https://elixir.bootlin.com/linux/v5.10/source/drivers/w1/w1.c#L578
  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/w1/w1.c?id=2c85ebc57b3e1817b6ce1a6b703928e113a90442#n578

  Would any adjustment with the tag “Addresses-Coverity: ("Unused value")”
  become relevant here?

Regards,
Markus


--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux