From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMvAg-0005Bl-FT for barebox@lists.infradead.org; Mon, 28 Sep 2020 15:34:35 +0000 From: Ahmad Fatoum Date: Mon, 28 Sep 2020 17:34:29 +0200 Message-Id: <20200928153431.1095-2-a.fatoum@pengutronix.de> In-Reply-To: <20200928153431.1095-1-a.fatoum@pengutronix.de> References: <20200928153431.1095-1-a.fatoum@pengutronix.de> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 2/4] vsprintf: add %pe format specifier for printing symbolic error names To: barebox@lists.infradead.org Cc: Ahmad Fatoum , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= U3RhcnRpbmcgd2l0aCB2NS41LCBMaW51eCBoYXMgYSBmb3JtYXQgc3BlY2lmaWVyIGZvciBwcmlu dGluZyBlcnJvcgpwb2ludGVycy4gV2UgaGF2ZSBoYWQgc3RyZXJyb3IgaW4gYmFyZWJveCBiZWZv cmUgdGhhdCwgYnV0IGxldHMgd2lyZSBpdAppbnRvIHZzcHJpbnRmIHdpdGggdGhlIHNhbWUgZm9y bWF0IHNwZWNpZmllciB0aGF0IExpbnV4IG5vdyB1c2VzLgoKVGhpcyB5aWVsZHMgbGVzcyB2ZXJi b3NlIGNhbGwgc2l0ZXMgYW5kIG1ha2VzIExpbnV4IGRyaXZlcnMgbW9yZSBwb3J0YWJsZQp0byBi YXJlYm94IGluIGZ1dHVyZS4gVGhpcyBhbHNvIGhhcyB0aGUgcG90ZW50aWFsIHRvIHJlZHVjZSBj b2RlIHNpemUgYXMKdGhlIHByZXZpb3VzbHkgImlubGluZ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