From patchwork Wed Oct 18 22:31:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Programmingkid X-Patchwork-Id: 827835 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="fBRxDuYQ"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yHRdN1N5nz9sBd for ; Thu, 19 Oct 2017 09:32:23 +1100 (AEDT) Received: from localhost ([::1]:46770 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4wsr-00018b-4S for incoming@patchwork.ozlabs.org; Wed, 18 Oct 2017 18:32:17 -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) 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) 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) 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 @@ #include "libfdt_internal.h" +/* 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 = 0; count < max_count; count++) { + if (string[count] == '\0') { + break; + } + } + return count; +} + +#endif /* strnlen */ + static int _fdt_nodename_eq(const void *fdt, int offset, const char *s, int len) {