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 Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2A4D7C433EF for ; Thu, 3 Mar 2022 21:16:23 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E2C1B83CCE; Thu, 3 Mar 2022 22:15:40 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ZbQCC4uF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E392A83CD9; Thu, 3 Mar 2022 22:15:38 +0100 (CET) Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2FFB383C70 for ; Thu, 3 Mar 2022 22:15:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=alpernebiyasak@gmail.com Received: by mail-ej1-x633.google.com with SMTP id dr20so13353402ejc.6 for ; Thu, 03 Mar 2022 13:15:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:from:subject:to:cc :references:content-language:in-reply-to:content-transfer-encoding; bh=eAsGq98/Z6PnlN9i5OKiI2CYxvlTtgqTOj0P8jYNswg=; b=ZbQCC4uFzaipgaKjAHN5CiX+80Gt246uxJZtlqwe4194pj8xKmyp22GZwsBBVxpWTm MrixV9s8/H6GGWSR73iAfz/RAQXKsXIJpkXYBzolyj1ZtdimiEgOHV3FjEu0AVp/oQq5 vSjjw/wje5sQAaT8CfAg7mK2sJwRDN7DRhygfppMhLZnyaTRqKfIA3G/BS3zLgHbu3wa eopEWKB9D50BHZj3wJH04gn/sgXebd8HtONhbS4oyHtz2oQiJoCKp/h/Fy8cW/hLIupr TFc1aB9akCcF18E/5dPvN6xIIzlpXy6I2tBxcUX3Vw47Wlj3uEXA+dFD0oUbs+6krNZM di1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:from :subject:to:cc:references:content-language:in-reply-to :content-transfer-encoding; bh=eAsGq98/Z6PnlN9i5OKiI2CYxvlTtgqTOj0P8jYNswg=; b=MyaFSAMRuGAjA2iPj0n0hSL0PwXYSTjZEh9zKTJ0cYLZmt+pxlqJCEmWSM6YtI1FYg 3CXge7LC8o9hwBUKORNDqHFH2jnQKgvAtVB5RrlpB0iN5N/s5g7v3blLVYIo+/zpMMk3 J1Rto0UMdzRCZRqdmi+tPs+Pz4yPwUTILCX7nyXQJ6PaVgc0Y7RuzU2e+OOZOYKvazHD vInwXtghHVItoIHFfxsohplN5fLGF0CvFoRRRfTeHg6Dky6TAI4rO5g12sQh9rnDzBUE K/W6zduwnstLa5cBLrIBBANuEP/ypzzXnYGEuJLZWLfUAj0xyKMH97F8zhgmQN4dnd6/ TXbw== X-Gm-Message-State: AOAM532i27BWgPhMa9PUtNIOOMHg3ND1qifO4Qt6daOPskJsjiPTcvOM u6/alDuMtVja53KNqS1ITOofWyd14U4= X-Google-Smtp-Source: ABdhPJzOm+6tUhVVf7GJDLbFUw9sgYUJIF576NxevoMs29FH7MQvpwadQbpOQStf/DmOTTJ2FxNCow== X-Received: by 2002:a17:906:c0c:b0:6ce:e59c:c38a with SMTP id s12-20020a1709060c0c00b006cee59cc38amr28385068ejf.483.1646342133790; Thu, 03 Mar 2022 13:15:33 -0800 (PST) Received: from [192.168.0.74] ([178.233.26.119]) by smtp.gmail.com with ESMTPSA id h7-20020a1709066d8700b006d4b4d137fbsm1079099ejt.50.2022.03.03.13.15.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Mar 2022 13:15:33 -0800 (PST) Message-ID: <022f43ee-eb2a-78d3-eaf5-0b3af59de0ad@gmail.com> Date: Fri, 4 Mar 2022 00:08:19 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 From: Alper Nebi Yasak Subject: Re: [PATCH v2 05/25] dtoc: Tidy up implementation of AddStringList() To: Simon Glass Cc: Ivan Mikhaylov , Tom Rini , Philippe Reynes , huang lin , Jeffy Chen , Kever Yang , U-Boot Mailing List References: <20220223230040.159317-1-sjg@chromium.org> <20220223230040.159317-6-sjg@chromium.org> Content-Language: en-US In-Reply-To: <20220223230040.159317-6-sjg@chromium.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean On 24/02/2022 02:00, Simon Glass wrote: > Refactor this to avoid a loop. Also add a test for an empty string. > > Signed-off-by: Simon Glass > Suggested-by: Alper Nebi Yasak > --- > > Changes in v2: > - Add new patch to tidy up implementaiton of AddStringList() > > tools/dtoc/fdt.py | 4 +--- > tools/dtoc/test_fdt.py | 6 ++++++ > 2 files changed, 7 insertions(+), 3 deletions(-) Reviewed-by: Alper Nebi Yasak > diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py > index c16909a876..d933972918 100644 > --- a/tools/dtoc/fdt.py > +++ b/tools/dtoc/fdt.py > @@ -516,9 +516,7 @@ class Node: > Returns: > Prop added > """ > - out = b'' > - for string in val: > - out += bytes(string, 'utf-8') + b'\0' > + out = b'\0'.join(bytes(s, 'utf-8') for s in val) + b'\0' if val else b'' Meh, it turned out uglier than I thought it would be. Either is fine really, I didn't add "Reviewed-by"s for v1 only because I thought you'd need to send a v2 for the later FIT stuff anyway. > return self.AddData(prop_name, out) > > def AddInt(self, prop_name, val): > > [...]