From patchwork Mon Nov 11 14:40:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arjun Shankar X-Patchwork-Id: 35792 Received: (qmail 96504 invoked by alias); 11 Nov 2019 14:40:57 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 96490 invoked by uid 89); 11 Nov 2019 14:40:57 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=ISO-8859-1, ISO88591 X-HELO: aloka.lostca.se DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=lostca.se; h=date:from:to :subject:message-id:mime-version:content-type :content-transfer-encoding; s=howrah; bh=OgE7b0KFrp45nJFqJo5nk2Y ZOuw=; b=jYgs4PC4uJiRvIAEQB1NQmWGuEeNlPs6VMabnV2iu+O2r4GuNa4dvT/ Olt//JNCOFsOHku9SXjR6LGIw02PfHZ5CZrrsfhIle+P6jxyPmiPSLpt4GMFbaZ0 o2h4q18M7/ObixkPMOg/r2BHGRFiwUFpATXX6VVmSEWwmvD+qmTY= Date: Mon, 11 Nov 2019 14:40:53 +0000 From: Arjun Shankar To: libc-alpha@sourceware.org Subject: [PATCH] libio/tst-fopenloc: Use xsetlocale, xfopen, and xfclose Message-ID: <20191111144052.GB5229@aloka.lostca.se> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) From: Arjun Shankar --- libio/tst-fopenloc.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/libio/tst-fopenloc.c b/libio/tst-fopenloc.c index e9548c57ac..797540da04 100644 --- a/libio/tst-fopenloc.c +++ b/libio/tst-fopenloc.c @@ -25,14 +25,11 @@ #include #include #include +#include +#include static const char inputfile[] = "../iconvdata/testdata/ISO-8859-1"; -static int do_test(void); - -#define TEST_FUNCTION do_test () -#include "../test-skeleton.c" - static int do_bz17916 (void) { @@ -66,14 +63,9 @@ do_test (void) mtrace (); - setlocale (LC_ALL, "de_DE.UTF-8"); + xsetlocale (LC_ALL, "de_DE.UTF-8"); - fp = fopen (inputfile, "r,ccs=ISO-8859-1"); - if (fp == NULL) - { - printf ("cannot open \"%s\": %s\n", inputfile, strerror (errno)); - exit (1); - } + fp = xfopen (inputfile, "r,ccs=ISO-8859-1"); while (! feof_unlocked (fp)) { @@ -85,7 +77,9 @@ do_test (void) fputws (buf, stdout); } - fclose (fp); + xfclose (fp); return do_bz17916 (); } + +#include