From patchwork Sat Sep 25 19:46:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Kacper_Piwi=C5=84ski?= X-Patchwork-Id: 45436 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9AC53385843A for ; Sat, 25 Sep 2021 19:47:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9AC53385843A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1632599242; bh=M2Et2i/nHssTQ1buwTKIu8/F2Vo70+A5tdeV/bnMdiw=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=xyCPcRi5D41Q3zZcSKFlvGeOOEaNU2b2kY6GHHIZVCNj3Pq9+Tc9iflmyecsd/kNO rIyEPDN0DQs1PPkuaF0n5MIYwtQiZuAYmbf7qPbI4EsKxxgsBPqc/pfgt10j4elmcb 8ttjwtZutr4vePZh026KHyX6Emh69EA82JCWOPtE= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mx-out.tlen.pl (mx-out.tlen.pl [193.222.135.148]) by sourceware.org (Postfix) with ESMTPS id 3B72F3858403 for ; Sat, 25 Sep 2021 19:46:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3B72F3858403 Received: (wp-smtpd smtp.tlen.pl 19077 invoked from network); 25 Sep 2021 21:46:56 +0200 Received: from public-gprs404142.centertel.pl (HELO localhost.localdomain) (cosiekvfj@o2.pl@[37.47.209.239]) (envelope-sender ) by smtp.tlen.pl (WP-SMTPD) with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP for ; 25 Sep 2021 21:46:56 +0200 To: libc-alpha@sourceware.org Subject: [PATCH] *put*s: indentation Date: Sat, 25 Sep 2021 21:46:18 +0200 Message-Id: <20210925194618.14189-1-cosiekvfj@o2.pl> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 X-WP-DKIM-Status: good (id: o2.pl) X-WP-MailID: a4a7d0c6af9a0b1082f0affeeed02804 X-WP-AV: skaner antywirusowy Poczty o2 X-WP-SPAM: NO 0000000 [wZP0] X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Kacper_Piwi=C5=84ski_via_Libc-alpha?= From: =?utf-8?q?Kacper_Piwi=C5=84ski?= Reply-To: =?utf-8?q?Kacper_Piwi=C5=84ski?= Cc: =?utf-8?q?Kacper_Piwi=C5=84ski?= Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Make indentation consistent across *put*s functions --- libio/iofputs.c | 2 ++ libio/iofputs_u.c | 5 ++++- libio/iofputws.c | 2 ++ libio/iofputws_u.c | 2 ++ libio/ioputs.c | 3 +-- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/libio/iofputs.c b/libio/iofputs.c index a8721314bc..c865b01f61 100644 --- a/libio/iofputs.c +++ b/libio/iofputs.c @@ -34,9 +34,11 @@ _IO_fputs (const char *str, FILE *fp) int result = EOF; CHECK_FILE (fp, EOF); _IO_acquire_lock (fp); + if ((_IO_vtable_offset (fp) != 0 || _IO_fwide (fp, -1) == -1) && _IO_sputn (fp, str, len) == len) result = 1; + _IO_release_lock (fp); return result; } diff --git a/libio/iofputs_u.c b/libio/iofputs_u.c index b9eb3b415f..9c3d81f7bc 100644 --- a/libio/iofputs_u.c +++ b/libio/iofputs_u.c @@ -34,8 +34,11 @@ __fputs_unlocked (const char *str, FILE *fp) size_t len = strlen (str); int result = EOF; CHECK_FILE (fp, EOF); - if (_IO_fwide (fp, -1) == -1 && _IO_sputn (fp, str, len) == len) + + if (_IO_fwide (fp, -1) == -1 + && _IO_sputn (fp, str, len) == len) result = 1; + return result; } libc_hidden_def (__fputs_unlocked) diff --git a/libio/iofputws.c b/libio/iofputws.c index 614ac0e336..6f50f42fab 100644 --- a/libio/iofputws.c +++ b/libio/iofputws.c @@ -34,9 +34,11 @@ fputws (const wchar_t *str, FILE *fp) int result = EOF; CHECK_FILE (fp, EOF); _IO_acquire_lock (fp); + if (_IO_fwide (fp, 1) == 1 && _IO_sputn (fp, (char *) str, len) == len) result = 1; + _IO_release_lock (fp); return result; } diff --git a/libio/iofputws_u.c b/libio/iofputws_u.c index 0b0cacd293..94aa4bf199 100644 --- a/libio/iofputws_u.c +++ b/libio/iofputws_u.c @@ -34,9 +34,11 @@ fputws_unlocked (const wchar_t *str, FILE *fp) size_t len = __wcslen (str); int result = EOF; CHECK_FILE (fp, EOF); + if (_IO_fwide (fp, 1) == 1 && _IO_sputn (fp, (char *) str, len) == len) result = 1; + return result; } libc_hidden_def (fputws_unlocked) diff --git a/libio/ioputs.c b/libio/ioputs.c index 99a177876a..5969c0af30 100644 --- a/libio/ioputs.c +++ b/libio/ioputs.c @@ -35,8 +35,7 @@ _IO_puts (const char *str) size_t len = strlen (str); _IO_acquire_lock (stdout); - if ((_IO_vtable_offset (stdout) != 0 - || _IO_fwide (stdout, -1) == -1) + if ((_IO_vtable_offset (stdout) != 0 || _IO_fwide (stdout, -1) == -1) && _IO_sputn (stdout, str, len) == len && _IO_putc_unlocked ('\n', stdout) != EOF) result = MIN (INT_MAX, len + 1);