From nobody Mon Feb 9 10:35:10 2026 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584604012; cv=none; d=zohomail.com; s=zohoarc; b=Szjfzk08rjQcI5N3pUSpO3/PLXiZWO1kEWXFoC85O9ol5+JmqP9/RFbBxqQsHPtSocrkjEJZqcBFDYug1nnLuleyL6hZCI1yEwDoEafFGUWiABZlmXup02X1opr2Rj9qmvXekT/ouh1tVTkl0eHcqeodPUI1Yq77fNnbVF2fSfo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584604012; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Subject:To; bh=tmSZtOLMkXQutNmduEtdi2c08u33Nu3eh8iVlwx3r68=; b=gaaMS7G1GyZWlORwMS/QWMbbOELvl6tKvEixnXxLdR6wRnH02x9b7vqNvjiOz6UCBBz9phQESfDKTbuHJRzTFzfV62DyB0opZPfSK8vkfPj0A8M9OLiQ73CVsr7vOI0wt/Nt46emNwEFlo3sAA0KmtrE/WUFs+DvjuOnCh9itj4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1584604012049882.7338621121011; Thu, 19 Mar 2020 00:46:52 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 917F3B01B19; Thu, 19 Mar 2020 07:46:48 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 5AAD1B01B18 for ; Thu, 19 Mar 2020 07:46:05 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-426-lQLH7k4yPzqkjrq0uz0YZg-1; Thu, 19 Mar 2020 03:39:44 -0400 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 24DF08010EA for ; Thu, 19 Mar 2020 07:39:44 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA707BBBC0; Thu, 19 Mar 2020 07:39:43 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) id F333E31EAC; Thu, 19 Mar 2020 08:39:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584603964; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Jzyp5ggFwZpOWJyyVGsk/UabhlIjk3Jp3yEqTx9z3t4=; b=cl9jaImX+DOVLC7Qsan1vZbYxEwkuWzE3OFJbuSOM5zrsnvVNn47EzJwtlEdy2Xz4N/F9S WI2aCHYsndPpKhjg/ZhmQvH913T1vNeOUO09dkIQrfBY+JUXs4f6ipydcNclGk1ZMAoRB1 9iJi+Gx67X16VLsbMCOST+N9AGo2fjc= X-MC-Unique: lQLH7k4yPzqkjrq0uz0YZg-1 From: Gerd Hoffmann To: seabios@seabios.org Date: Thu, 19 Mar 2020 08:39:32 +0100 Message-Id: <20200319073937.5561-2-kraxel@redhat.com> In-Reply-To: <20200319073937.5561-1-kraxel@redhat.com> References: <20200319073937.5561-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: TWFNIE7XHIEUAOXGNFZZWTNLMXNXHQVX X-Message-ID-Hash: TWFNIE7XHIEUAOXGNFZZWTNLMXNXHQVX X-MailFrom: kraxel@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Gerd Hoffmann X-Mailman-Version: 3.3.1 Precedence: list Subject: [SeaBIOS] [PATCH 1/6] string: add strtol() implementation List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: ++++ X-Spam-Level: **** Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Gerd Hoffmann --- src/string.h | 1 + src/string.c | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/string.h b/src/string.h index d069989db4b4..17ef3c6a1e89 100644 --- a/src/string.h +++ b/src/string.h @@ -27,5 +27,6 @@ void *memmove(void *d, const void *s, size_t len); char *strtcpy(char *dest, const char *src, size_t len); char *strchr(const char *s, int c); char *nullTrailingSpace(char *buf); +u64 strtol(const char *ptr, int base); =20 #endif // string.h diff --git a/src/string.c b/src/string.c index adb8198f84f4..ec8cf6108561 100644 --- a/src/string.c +++ b/src/string.c @@ -249,3 +249,28 @@ nullTrailingSpace(char *buf) buf++; return buf; } + +u64 strtol(const char *ptr, int base) +{ + u64 digit, val =3D 0; + + for (;;) { + switch (*ptr) { + case '0' ... '9': + digit =3D *ptr - '0'; + break; + case 'a' ... 'f': + digit =3D *ptr - 'a' + 10; + break; + case 'A' ... 'F': + digit =3D *ptr - 'A' + 10; + break; + default: + return val; + } + if (digit >=3D base) + return val; + val =3D val * base + digit; + ptr++; + } +} --=20 2.18.2 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org