From nobody Sun Dec 22 08:05:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 173461984730513.025049124464545; Thu, 19 Dec 2024 06:50:47 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 51FA81704; Thu, 19 Dec 2024 09:50:46 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 05BE7166C; Thu, 19 Dec 2024 09:46:32 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 572D7153F; Thu, 19 Dec 2024 09:46:15 -0500 (EST) Received: from mail-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id DE2E8153F for ; Thu, 19 Dec 2024 09:46:12 -0500 (EST) Received: by mail-ot1-f48.google.com with SMTP id 46e09a7af769-71e16519031so469296a34.1 for ; Thu, 19 Dec 2024 06:46:12 -0800 (PST) Received: from home.. ([2603:8081:c640:1::1009]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71fc97a40afsm272978a34.25.2024.12.19.06.46.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 06:46:11 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734619572; x=1735224372; darn=lists.libvirt.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aAagNEhhoP8t9C8eJwwXRIAQDU4uwU5avOfsrGTUoVw=; b=QG/Lv4Mf+sE1UBXUO1n9JJjFXMBorsE+M/aFelUSMu9phY40f2kTqWSU0Mw75LymXF MGzE3obmGhpNGOLXEdKFTwWLZVZiySRsKJybrBA2vc6l9FN+y3mM50cyKW0Ak85jagBz qskZXU6BTkCgbB7Iv/uBGiYm/3l+MjQHzgZUgyHtYYEYyNsOLu4sawzstQ+ESWIi4mbl LuW336hrcYP23vgqWZYmwRq9HuSgkTEGja5ww1KJhcmEvT6XYGPS97JIbcs1My4rE+BW 1wpmyFN11gwVmQ/WIvQPIxIapWZQwlfoszk557BNOtQfm1/z3OJtAqb/PKBEo4Packh7 VORQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734619572; x=1735224372; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aAagNEhhoP8t9C8eJwwXRIAQDU4uwU5avOfsrGTUoVw=; b=v/weX7OV59x3lIzc/uf5lrag8SN8j9MQUAYTIdMs3ulZC3KprI18DyTEEMHza8M4E6 MuAMVWNzcvW0VSVfYA5xHCZmr6A+pBsk66NrSn49jmm7vfRG15Vq+g07eM2DwW5P1sFB fSe8mPV6/W/js03O6KewRtU57ENNVG4BxQ5bcei0Z9BquOPHSKJk6lZVbbffR1gQB69A U0eihhcLIFRyniHCzIsQWbrv5UMXu5FwIGExV4kZu5UJ8+kL7YVZML8I5DxwEzzaD7Q/ G440yvPoZm63V+xXR9WOvnWWMVojXdzTgsi/1k515ko2fQeQVEOhTWSG0xI6SGb1iK45 +4+w== X-Gm-Message-State: AOJu0YyUT/QGLsidDQqTvpd3uAKHlY2RdKwf1YTYVOx/mMkwp28SY5E2 U361OO8Y6dNHPJBITA4vRlaZuV3jB+v89sDjKSYE8MaELE1/kP/qHsmNiGAJ X-Gm-Gg: ASbGncuMqqyfvJnaGDxMT1slINIEMdYJAQZeZznopHWMKt3t7e3Vcj9duXxKlk0PBqH PS9cEvRBgWp74K9h986g+MMwogFTCtOUHK1BwV5chiZrqv8mVMtSW4btCYPbf+fGjLVnypzzcCR MVfE4J3X6KSDFTCE/n/xbxJfnuEByj3TtTlcBDlVGbErh1rBX7AaYROq1udnv/DFXXaxQNotOrs ZZ1XBK4hE5AYqxdrNGd8P1quv5M14E2uyqZwarc X-Google-Smtp-Source: AGHT+IGnJYALt2kP7XhWznPDeuF1CkBSc2fT6NacGkRaGVP5yDE3gkVfxoqcMKz76/8hU1uqVbtTZA== X-Received: by 2002:a9d:6d8e:0:b0:71d:e923:6d2f with SMTP id 46e09a7af769-71fc5b25660mr2298518a34.13.1734619571986; Thu, 19 Dec 2024 06:46:11 -0800 (PST) From: Praveen K Paladugu To: devel@lists.libvirt.org Subject: [PATCH 09/10] ch: move curl_data and curl_callback definitions Date: Thu, 19 Dec 2024 08:46:00 -0600 Message-ID: <20241219144601.16394-10-praveenkpaladugu@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241219144601.16394-1-praveenkpaladugu@gmail.com> References: <20241219144601.16394-1-praveenkpaladugu@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: RYO2JV4CRVQ2ZNZO465RHPMXN4L6NPLO X-Message-ID-Hash: RYO2JV4CRVQ2ZNZO465RHPMXN4L6NPLO X-MailFrom: praveenkpaladugu@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: liuwe@microsoft.com X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1734619848492116600 Content-Type: text/plain; charset="utf-8" Move the definitions of curl_data and curl_callback to be used within virCHMonitorPutNoContent. Signed-off-by: Praveen K Paladugu --- src/ch/ch_monitor.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c index c9b08b0f75..88df9d4a03 100644 --- a/src/ch/ch_monitor.c +++ b/src/ch/ch_monitor.c @@ -671,6 +671,28 @@ virCHMonitorCurlPerform(CURL *handle) return responseCode; } =20 +struct curl_data { + char *content; + size_t size; +}; + +static size_t +curl_callback(void *contents, size_t size, size_t nmemb, void *userp) +{ + size_t content_size =3D size * nmemb; + struct curl_data *data =3D userp; + + if (content_size =3D=3D 0) + return content_size; + + data->content =3D g_realloc(data->content, data->size + content_size); + + memcpy(&(data->content[data->size]), contents, content_size); + data->size +=3D content_size; + + return content_size; +} + int virCHMonitorPutNoContent(virCHMonitor *mon, const char *endpoint) { @@ -698,28 +720,6 @@ virCHMonitorPutNoContent(virCHMonitor *mon, const char= *endpoint) return ret; } =20 -struct curl_data { - char *content; - size_t size; -}; - -static size_t -curl_callback(void *contents, size_t size, size_t nmemb, void *userp) -{ - size_t content_size =3D size * nmemb; - struct curl_data *data =3D userp; - - if (content_size =3D=3D 0) - return content_size; - - data->content =3D g_realloc(data->content, data->size + content_size); - - memcpy(&(data->content[data->size]), contents, content_size); - data->size +=3D content_size; - - return content_size; -} - static int virCHMonitorGet(virCHMonitor *mon, const char *endpoint, virJSONValue **re= sponse) { --=20 2.47.0