From patchwork Tue Apr 9 19:35:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 787234 Delivered-To: patch@linaro.org Received: by 2002:adf:fdd2:0:b0:346:15ad:a2a with SMTP id i18csp383303wrs; Tue, 9 Apr 2024 12:36:47 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVip2cgara2SYUt1Plcdt/mVfjBCMwAzTretSU7ZD6z5Ek93Rt/Vhu3p3vZ4IZcCgxq8fshJQgeb8vGs9lubH5b X-Google-Smtp-Source: AGHT+IG1GGiIMueqwffP+nX5+t4qAM2MwQDISVJNzFBY60n1lTCL2VSb1zK4hhGhd+ugIrWTvkvn X-Received: by 2002:a0d:e855:0:b0:615:fb2:1e61 with SMTP id r82-20020a0de855000000b006150fb21e61mr730945ywe.4.1712691406738; Tue, 09 Apr 2024 12:36:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712691406; cv=none; d=google.com; s=arc-20160816; b=zxsQzBEvMxhQDsOsZ+zH/CoXUkTBVu3z+AOXhyNDfg8XAG167k8Pn//zSGkqNznghk lsGZV/n3v8Jm7RwAB53Hns3DXMpnEr1y20XcNbxxzPfkICSE7lRobraQUdLyk1ytD4hG kQIHVWWgXKdkHgVeiSiDlf6eaxbz/3T37JqJM6sjE3ODfqBlBTp3sEAULk4S6JIA0otx Rb98hE9fw1gEIMUCbprkP0PBs2Rx+wz2ehLV1FjbvmWOl+fYQ+/medcAqZ1Rvv8iA5qu 3XfHYe3VTyMj18VOAVj8c+cME0VTGTAIP8fuh7W2e/y/QXy9/ixNYXUgR+PKcoO7RH+K OgZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Lw/beNU1QugcC97gSnNNo3jFHiOgyIQNiC5qPkBLROQ=; fh=JowuhYM/cawvxwSjj4eVbOc0NCc2c2dukzC2TrxwJhM=; b=jAKPxe/JZlSBhI5XbB/qMAdQrlDowIb4bTjoV5NJoD/qnDx+gBzLJjVQGqfBo53tOd UULt9tnhsq6mI2MBvNEA9tx3BsLtvOYMeyWos1GL/HVyfNfXoVLLs9JkgSrEvCkrmWyV AAEMycydxy7m9JTc4aQxXirHcbJlkanvn9VexVlEXDxJtX/5dG0gdDeSXYNJJQvjpwxB Aug0uhZ8rPPq5ntE15BvtWrUOORiKwhGDvseAIR7aaMitJg7pyoyeol+5Fy3GdzZmW+B nLxB5lYBeEFiavPMq4FTQ/F+Uc+hPbmJDDcV+1C6K/INBQK+IdteGIQoJ1rkvfFuAqZX u89g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EvzIyHcg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e16-20020ac85dd0000000b004344c626782si4955689qtx.625.2024.04.09.12.36.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Apr 2024 12:36:46 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EvzIyHcg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ruHGQ-0000Xt-Rs; Tue, 09 Apr 2024 15:36:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ruHGO-0000XQ-Vu for qemu-devel@nongnu.org; Tue, 09 Apr 2024 15:36:13 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ruHGN-0004d3-DJ for qemu-devel@nongnu.org; Tue, 09 Apr 2024 15:36:12 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1e2b1cd446fso44162825ad.3 for ; Tue, 09 Apr 2024 12:36:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712691370; x=1713296170; darn=nongnu.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=Lw/beNU1QugcC97gSnNNo3jFHiOgyIQNiC5qPkBLROQ=; b=EvzIyHcgo7LtCmPPB/9RcOJZmakueXCqPF0UgeUDSE9EO+f0Tvf+bfOQH/weCHHtH5 SrifWB/GVrkCUFKIQL/Sb88YZxK07KqaajafMqV7ERPM48oXOow8I9+oCZrZI/i3Z6wM wWWw4AEl/80pRXlO8n+EHd4bOcWuU7/JnFhvhGvRjuynY+TTSiZq/CACp7apljeNpoC9 KoVYUVkL0Ft8HFa4m3R4sMFYBGzjNBjFqFlq0CJFW222BGI+ETL+NrPmUaiOSLf+4K8j 5EflQ6BiwkdssOlxZJHALfW0rwN4KbKed4TuggWBziQveAk77uVb9vSylXwXE9/9pRNU /ckQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712691370; x=1713296170; 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=Lw/beNU1QugcC97gSnNNo3jFHiOgyIQNiC5qPkBLROQ=; b=lNMqsrIV5WSBzrMRTGZBbQDF5Q7+uWl7azySwtUt+TTEIY1FOugd1nPeOE0BPQYPkJ 3jknxj5PASd5uVn5MwM2pu43baGjcpzZwHTABtH0OFWWbuG9AYYpjlHcp4QjQs1QsVo4 KKCbqn2s34gIZdsa+cX225u6SmWNBPN7Rocez2s57lRi8DmElRo/clw3kQKnMAtwqXT3 zKOK+RDwIGtdFF8m8jCNfA2H2Gukz3Z2YNCcIm3S7Pm/M59VImTlW6ed2lHtFuHOZl+Z 93GdUiyPLa+bxa16XiifMiPQpgcfA2SkwARal0HPeFUEGW2I5MOVTrZNg6SQw2++Qu5i 776w== X-Gm-Message-State: AOJu0YxiHTJ5hTn71tg7ToyzDPxhFWIbjWLr5lPUfX1Zdh3W6I2kk7k/ c0xvFRNmk+XJjIQap8ahJZmBYFYMn4fFGT5D+3tmkz/FoWzlIkCVp5cMNRUeSa1q/voygWjI4eH 3 X-Received: by 2002:a17:902:eb8b:b0:1e0:afbb:7a89 with SMTP id q11-20020a170902eb8b00b001e0afbb7a89mr906459plg.22.1712691370019; Tue, 09 Apr 2024 12:36:10 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id c17-20020a170902d49100b001e1071cf0bbsm6065843plg.302.2024.04.09.12.36.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 12:36:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Nguyen Dinh Phi , =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PULL v2 03/20] linux-user: replace calloc() with g_new0() Date: Tue, 9 Apr 2024 09:35:46 -1000 Message-Id: <20240409193603.1703216-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240409193603.1703216-1-richard.henderson@linaro.org> References: <20240409193603.1703216-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.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, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Nguyen Dinh Phi Use glib allocation as recommended by the coding convention Signed-off-by: Nguyen Dinh Phi Message-Id: <20240317171747.1642207-1-phind.uet@gmail.com> Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- linux-user/main.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/linux-user/main.c b/linux-user/main.c index 9277df2e9d..149e35432e 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -928,11 +928,7 @@ int main(int argc, char **argv, char **envp) * Prepare copy of argv vector for target. */ target_argc = argc - optind; - target_argv = calloc(target_argc + 1, sizeof (char *)); - if (target_argv == NULL) { - (void) fprintf(stderr, "Unable to allocate memory for target_argv\n"); - exit(EXIT_FAILURE); - } + target_argv = g_new0(char *, target_argc + 1); /* * If argv0 is specified (using '-0' switch) we replace