all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Alexander Zeidler <a.zeidler@proxmox.com>
Subject: Re: [pve-devel] [PATCH manager 1/3] pvesubscription: add missing return statement
Date: Wed, 10 Jan 2024 10:29:50 +0100	[thread overview]
Message-ID: <ef3c15fd-9771-45ed-8532-bb09dde57212@proxmox.com> (raw)
In-Reply-To: <20240109142356.171494-1-a.zeidler@proxmox.com>


any reason this is relevant you might want to add to the commit
message here?

Am 09/01/2024 um 15:23 schrieb Alexander Zeidler:
> Signed-off-by: Alexander Zeidler <a.zeidler@proxmox.com>
> ---
>  PVE/CLI/pvesubscription.pm | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/PVE/CLI/pvesubscription.pm b/PVE/CLI/pvesubscription.pm
> index 2eb26cb4..2fd641d0 100755
> --- a/PVE/CLI/pvesubscription.pm
> +++ b/PVE/CLI/pvesubscription.pm
> @@ -47,6 +47,8 @@ __PACKAGE__->register_method({
>  	PVE::API2::Subscription::check_key($info->{key}, PVE::API2::Subscription::get_sockets());
>  
>  	PVE::API2::Subscription::write_etc_subscription($info);
> +
> +	return undef;

simple

return;

is slightly preferred for returning undef, as there is a very rare, but
 nasty bug one can hit with returning undef.
I.e., if the call site forces list-context and checks if something is
returned then the `return` works but return undef returns a single undef
element in a (defined) list, thus causing a false-positive fora check like
`if (my @foo = bar()) { ... }`.

As said, this is rather seldom and forced-list context is not that often
used so we do not need to clean up existing code, but for new one it makes
sense to default to a plain `return;` in such cases.

>  }});
>  
>  our $cmddef = {





  parent reply	other threads:[~2024-01-10  9:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-09 14:23 Alexander Zeidler
2024-01-09 14:23 ` [pve-devel] [PATCH manager 2/3] pvesubscription: update set-offline-key description Alexander Zeidler
2024-01-10  9:41   ` Thomas Lamprecht
2024-01-10 11:03     ` Alexander Zeidler
2024-01-10  9:55   ` [pve-devel] applied: " Thomas Lamprecht
2024-01-09 14:23 ` [pve-devel] [PATCH manager 3/3] report: format iptables output for readability Alexander Zeidler
2024-01-10  9:54   ` [pve-devel] applied: " Thomas Lamprecht
2024-01-10  9:29 ` Thomas Lamprecht [this message]
2024-01-10 10:59   ` [pve-devel] [PATCH manager 1/3] pvesubscription: add missing return statement Alexander Zeidler
2024-01-29  9:51     ` Alexander Zeidler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ef3c15fd-9771-45ed-8532-bb09dde57212@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=a.zeidler@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal