[libvirt] [PATCH 6/9] Remove the rest of VIR_STRNDUP
Daniel Henrique Barboza
danielhb413 at gmail.com
Wed Nov 13 12:57:05 UTC 2019
On 11/12/19 2:02 PM, Ján Tomko wrote:
> Replace all the uses passing a single parameter as the length.
>
> Signed-off-by: Ján Tomko <jtomko at redhat.com>
> ---
> src/conf/nwfilter_conf.c | 4 ++--
> src/conf/nwfilter_params.c | 6 ++----
> src/interface/interface_backend_udev.c | 8 ++------
> src/libxl/xen_common.c | 3 +--
> src/libxl/xen_xl.c | 6 ++----
> src/libxl/xen_xm.c | 6 ++----
> src/qemu/qemu_monitor_json.c | 3 +--
> src/rpc/virnetlibsshsession.c | 7 ++-----
> src/storage/storage_backend_logical.c | 7 ++-----
> src/util/viriscsi.c | 3 +--
> src/util/virjson.c | 11 +++--------
> src/util/virkeyfile.c | 3 +--
> src/util/virsocketaddr.c | 5 +----
> src/util/virstoragefile.c | 3 +--
> src/util/virstring.c | 3 +--
> 15 files changed, 24 insertions(+), 54 deletions(-)
>
[...]
> diff --git a/src/util/viriscsi.c b/src/util/viriscsi.c
> index 9f4c8f4e03..84fa542b7c 100644
> --- a/src/util/viriscsi.c
> +++ b/src/util/viriscsi.c
> @@ -162,8 +162,7 @@ virStorageBackendIQNFound(const char *initiatoriqn,
> if (!(next = strchr(current, ' ')))
> goto error;
>
> - if (VIR_STRNDUP(iface, current, (next - current)) < 0)
> - goto cleanup;
> + iface = g_strndup(current, (next - current));
>
> current = next + 1;
>
We can live without the parenthesis around 'next - current'.
Also, I think this change belongs to the previous patch that handled subtraction in the
length argument of VIR_STRNDUP().
Thanks,
DHB
More information about the libvir-list
mailing list