From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65457C63797 for ; Thu, 22 Jul 2021 07:13:56 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E324161279 for ; Thu, 22 Jul 2021 07:13:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E324161279 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:45666 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m6Su3-0000Cr-1d for qemu-devel@archiver.kernel.org; Thu, 22 Jul 2021 03:13:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47904) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m6St2-00061w-S8 for qemu-devel@nongnu.org; Thu, 22 Jul 2021 03:12:52 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:33291) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m6St1-0005Pp-DV for qemu-devel@nongnu.org; Thu, 22 Jul 2021 03:12:52 -0400 Received: by mail-wm1-x32c.google.com with SMTP id k14-20020a05600c1c8eb02901f13dd1672aso1974124wms.0 for ; Thu, 22 Jul 2021 00:12:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qWN2HIRs01eKm6dhCHQnthOBil+q+4JpNVw/kRffS9E=; b=bnXzRNou3B0QNiGKhYYdq9XybemWfoFTodXM4iK0Ph/nWabvtdRK3ub7Tx0iQKySsX 4T12bGJZqci6f8M64fCoB//E+s49mqqoa5rMR2fxbpdd4C1zkufysdwb5XpDnYys6TKv ijKSUY0+rC8j1didsr/5Zfc7/k/Ldi7WbrPMquE8lI1CoXV2exX40t4nZ+tK7VRQwRTT STsa84cGixL26RVpyj1jHXok0QzFl2izAEATvYoX4m4lziU2xaUtRQQXl9bEXsiGG8wE m2hl6Dc++xVNP802vx5pBADbjCjkIGQGY9R74lwscr1hN5BAQQC2HYITMqWg2l0Qg5iH 3oSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qWN2HIRs01eKm6dhCHQnthOBil+q+4JpNVw/kRffS9E=; b=GW4QH2qWCQ8Gv5EorPMSWK9GulgMhIQGCwDTQujtrT13Ty+jQbfqQKDOsS2cUw1jtH lPv8WZQQxTzTaNIanGZpk6RFGcy/BlAyZjwyMMVbWKO10lgkUqn6dsywm425VPTTWhU6 MeUJtfI+X7J62WxJ+lTpDyVLuCAsjixY0WHrQ9JhdYy/L6t7ddLTmP+Mobuqhpu1Zomz 7t92l4iKYPp0Vp6KBBXatpwso06qVEs5lwvVPB2m+RVqSh+5hoXOkLPJPJMCx91X8d9/ Cjl/mVwpRpiTu1j0Lc0b3RAIzIa9k4MRs61hGoH0QHYuaGa3sstTQI4xEcqbF7fluxhr ejxg== X-Gm-Message-State: AOAM533i2lLuc5jjBELgZepIVbACWP316xHTCvTp94Qd2GVtmFkaRE3M z86DZvcFwcW5XnHJph85VS5SnYJgSu4= X-Google-Smtp-Source: ABdhPJxbPKmfNwZVc8gbzzUwMRDdS5ucF15O/tvTw5/RBP5Jna+JI+jM2n0fHTg7B4zYx6rcOWzXLw== X-Received: by 2002:a1c:7410:: with SMTP id p16mr7392085wmc.6.1626937969995; Thu, 22 Jul 2021 00:12:49 -0700 (PDT) Received: from localhost.localdomain ([102.44.10.38]) by smtp.gmail.com with ESMTPSA id v21sm1802871wml.5.2021.07.22.00.12.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jul 2021 00:12:49 -0700 (PDT) From: Mahmoud Mandour To: qemu-devel@nongnu.org Subject: [PATCH v3 04/13] plugins/hotblocks: Added correct boolean argument parsing Date: Thu, 22 Jul 2021 09:12:27 +0200 Message-Id: <20210722071236.139520-5-ma.mandourr@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210722071236.139520-1-ma.mandourr@gmail.com> References: <20210722071236.139520-1-ma.mandourr@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=ma.mandourr@gmail.com; helo=mail-wm1-x32c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mahmoud Mandour , cota@braap.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Mahmoud Mandour --- contrib/plugins/hotblocks.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/contrib/plugins/hotblocks.c b/contrib/plugins/hotblocks.c index 4b08340143..062200a7a4 100644 --- a/contrib/plugins/hotblocks.c +++ b/contrib/plugins/hotblocks.c @@ -133,8 +133,18 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id, const qemu_info_t *info, int argc, char **argv) { - if (argc && strcmp(argv[0], "inline") == 0) { - do_inline = true; + for (int i = 0; i < argc; i++) { + char *opt = argv[i]; + g_autofree char **tokens = g_strsplit(opt, "=", 2); + if (g_strcmp0(tokens[0], "inline") == 0) { + if (!qemu_plugin_bool_parse(tokens[0], tokens[1], &do_inline)) { + fprintf(stderr, "boolean argument parsing failed: %s\n", opt); + return -1; + } + } else { + fprintf(stderr, "option parsing failed: %s\n", opt); + return -1; + } } plugin_init(); -- 2.25.1