From nobody Tue Apr 30 08:52:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1508365994282924.0823813563364; Wed, 18 Oct 2017 15:33:14 -0700 (PDT) Received: from localhost ([::1]:46772 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4wtZ-0001hT-06 for importer@patchew.org; Wed, 18 Oct 2017 18:33:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40813) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4wsJ-00017G-Bv for qemu-devel@nongnu.org; Wed, 18 Oct 2017 18:31:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e4wsE-0005GJ-El for qemu-devel@nongnu.org; Wed, 18 Oct 2017 18:31:43 -0400 Received: from mail-io0-x244.google.com ([2607:f8b0:4001:c06::244]:54569) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e4wsE-0005DO-9O; Wed, 18 Oct 2017 18:31:38 -0400 Received: by mail-io0-x244.google.com with SMTP id e89so7913311ioi.11; Wed, 18 Oct 2017 15:31:36 -0700 (PDT) Received: from localhost.localdomain (d14-69-20-184.try.wideopenwest.com. [69.14.184.20]) by smtp.gmail.com with ESMTPSA id z71sm6263468ioz.27.2017.10.18.15.31.34 (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 18 Oct 2017 15:31:35 -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; bh=J5DEFGm35jtwh+YJqpOSZNFQtLjJ+BRleKjdLRY2OYU=; b=fBRxDuYQyOgG5eh6zqdTxKPmuWlqH11g96+Zmn74ajN1nAg2yj0xUywNGHKnAlntRA saLaTiIM1ik1zDemzdB16N/pAQ0SQW17kFnS0jLT2E68CqbHtxIiXpWFajOk6maAyDX9 SCwxWvhmJF2T8D3m/tKggg95YXtmx3tjYFuNIaqA2WocT8IblKpNHJM9R0NSdMLyl7f7 NF71KZYX4V1TxT/oq1DcnJLob5FHlu4pi8KnxztUhAlaKZJrQJk0PtA94wPqFCGmoAZN 8V4Ct/sUOo1R9BKc+BVBXYkEONk5l9oUaBG5iKv/eomtto66T8hbLxuMiouk2339WiqV qrxw== 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; bh=J5DEFGm35jtwh+YJqpOSZNFQtLjJ+BRleKjdLRY2OYU=; b=oR9j9zr1fhmvtiQLDDRjDdMAwRzMmz1ZWbHiwSRQIvwrVn5Uy/RVVxMVYpXkmpOyT8 txMtqqxC2qqpRG5DKLd62Gmisd8MfzKclJqocyNHv0/+0awjEB+Nfuc1zc6bs/VXTNPY 6qAVFMVlZaEbZzIn5HXlAnL+XbEj75VFs0GRV/lbdy05RuRXxatDx+o2Rsb1KPNg9E2X RhhmebttXPU37Vwo/aJLon1Ku7tkfdbQSjrOZ008+8sC94kiFTaMYQ0QaPW7iB5nvFRP m5hKnc9NsE74iqzCirq4CzLPga/pdcQZ5ZjSy5De9m4eBxVLPGRtD9/Y3AQzKu4mj8IX sC8A== X-Gm-Message-State: AMCzsaVcHtR3beq5Lftqx2nscYxx8TP8MXfopDrENuf8WA4OnMfJpKAT xbGvE5qSFqAEQKQ5eRiwmoON6Q== X-Google-Smtp-Source: ABhQp+QPAfELvmMvbBThE96BPORyAGJ06qErizj1p7A/F3UsIoVfMa3D+yoQVswADqgRZbQ8cCU8fg== X-Received: by 10.107.147.131 with SMTP id v125mr119148iod.240.1508365895997; Wed, 18 Oct 2017 15:31:35 -0700 (PDT) From: John Arbuckle To: qemu-devel@nongnu.org, david@gibson.dropbear.id.au, qemu-ppc@nongnu.org Date: Wed, 18 Oct 2017 18:31:16 -0400 Message-Id: <20171018223116.6035-1-programmingkidx@gmail.com> X-Mailer: git-send-email 2.13.5 (Apple Git-94) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4001:c06::244 Subject: [Qemu-devel] [PATCH] fdt_ro.c: implement strnlen X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: John Arbuckle Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Implement the strnlen() function if it isn't implemented. Signed-off-by: John Arbuckle --- libfdt/fdt_ro.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/libfdt/fdt_ro.c b/libfdt/fdt_ro.c index 3d00d2e..a7986fb 100644 --- a/libfdt/fdt_ro.c +++ b/libfdt/fdt_ro.c @@ -55,6 +55,30 @@ =20 #include "libfdt_internal.h" =20 +/* if the current environment does not define strnlen */ +#ifndef strnlen + +/* This eliminates the missing prototype warning */ +int strnlen(const char *string, int max_count); + +/* + * strnlen: return the length of a string or max_count + * which ever is shortest + */ + +int strnlen(const char *string, int max_count) +{ + int count; + for(count =3D 0; count < max_count; count++) { + if (string[count] =3D=3D '\0') { + break; + } + } + return count; +} + +#endif /* strnlen */ + static int _fdt_nodename_eq(const void *fdt, int offset, const char *s, int len) { --=20 2.13.5 (Apple Git-94)