From nobody Fri Aug 7 01:48:18 2026 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4hGRr34qnHz6ndtr for ; Fri, 07 Aug 2026 01:48:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hGRr275Bhz3pfb for ; Fri, 07 Aug 2026 01:48:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1786067299; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=huf4xcgijA0vFxUV0RIMNtSHUU9ZmO3mRIdoZzzdygI=; b=jP92OW2eSPNxK6SrVuEdKB1WA71q2JnvDb8fvHA33qXSqZz6SpPQS54+3OVWlR2Z89Etaa Zh9ecktn9zxQvXzq/KPS9ahntZjoo6g9qwNvdQ9Y3L+1En6a7r/UaIoRDn6TR2eU5F1f5l BhgGuOsXe5jrFVsbFMlN2bwzMFENH4yiBCm0B32KbK6oXHEGSFcbV1SrZUbTM3++AD5Ix5 wLGLQ10mQ5oyzugDygLlg7K1ryMFhxp98IMbLixjXoIOiz0VA/pljvdMoENqNcz5Lpjos6 vYhXVSZ4G2AuIVCdw2Qf1xM3atcgmRaZGMgBflI9yYk5eRZ94iuRpPL2sdr5MQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1786067299; a=rsa-sha256; cv=none; b=GliqEX7CU//0ZHt7LPp3pyBZzi+Z2Ch1qMtIk7rL+IFohQ6o8snnfhLoUFyF9rwAs1gWlG 2ALgsDYn1FjDa4BrnOsJJntU1XrijPdJVRMz0WGgRc0zAmaUN9jKADy3AHfzxmWnBQ+mew 1A3UN5cg3Lz6MuVKAHbArXqx1RVc5xgJaVRAa8rhgiVrR185x5p+KHE+Owvrc8edX/o9ai arQF0ApNdED0L5WRjwetkgMutHkRdZk+QcM3xhpO8xG89c4Z1h22FOtGDjp54xSFhxXZTd yptMPbxC8jQYE6wLSXbd/bK6zxYeKPwWSJWX+eaaozwXnn7Up8P4t1KIolZlqw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1786067299; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=huf4xcgijA0vFxUV0RIMNtSHUU9ZmO3mRIdoZzzdygI=; b=SS5/jD/aSPPhL6npqtt7bI1fH7cAp2Lbr7pyAwloILlChsDijK6uOx1hYshda1GJ0lQIYP PU0tbk1urlb0ONQKc3TBVrBnszFRfGt+5WLJY4x+kUa5aaW826hKBxOjj9QB7Cur5x7qrr AccF6Mna8IwsXORVxuboxnh0AMiTamoHXznjKZvrEPTiqs0fMXKi0z5hs9ciPj1M5iXstO vVMu/HZveCe4kZFa8fvpou0yjuIkFIPROOu9PdkUeOZraYCHUBjj7SXkKe3xF3m63yOSHq TKl86WQqc6cwKculZbmLo3KVsvMRpi0T2OnyOqgRc23jH1tUTYVqBKfeLxdzgw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hGRr2633zzmZ8 for ; Fri, 07 Aug 2026 01:48:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3c315 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 07 Aug 2026 01:48:18 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: c675e0710ea6 - stable/15 - stdio: *memstream: slightly streamline growth function List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: c675e0710ea6c3f8608fcb356ea49ae81e0aefd8 Auto-Submitted: auto-generated Date: Fri, 07 Aug 2026 01:48:18 +0000 Message-Id: <6a753962.3c315.a2debe1@gitrepo.freebsd.org> The branch stable/15 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=c675e0710ea6c3f8608fcb356ea49ae81e0aefd8 commit c675e0710ea6c3f8608fcb356ea49ae81e0aefd8 Author: Kyle Evans AuthorDate: 2026-08-01 03:34:37 +0000 Commit: Kyle Evans CommitDate: 2026-08-06 23:37:17 +0000 stdio: *memstream: slightly streamline growth function Inverting the condition after realloc*() is a minor cleanup, but makes the success path a little cleaner to ease a future change. Reviewed by: des, jhb Sponsored by: Klara, Inc. (cherry picked from commit 28327c58ee6de7ddbdcf0e56352b257d37f2103d) --- lib/libc/stdio/open_memstream.c | 17 ++++++++--------- lib/libc/stdio/open_wmemstream.c | 16 +++++++--------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/lib/libc/stdio/open_memstream.c b/lib/libc/stdio/open_memstream.c index 371022adf6b3..29de688376bf 100644 --- a/lib/libc/stdio/open_memstream.c +++ b/lib/libc/stdio/open_memstream.c @@ -62,17 +62,16 @@ memstream_grow(struct memstream *ms, fpos_t newoff) newsize = newoff; if (newsize > ms->len) { buf = realloc(*ms->bufp, newsize + 1); - if (buf != NULL) { + if (buf == NULL) + return (0); + #ifdef DEBUG - fprintf(stderr, "MS: %p growing from %zd to %zd\n", - ms, ms->len, newsize); + fprintf(stderr, "MS: %p growing from %zd to %zd\n", + ms, ms->len, newsize); #endif - memset(buf + ms->len + 1, 0, newsize - ms->len); - *ms->bufp = buf; - ms->len = newsize; - return (1); - } - return (0); + memset(buf + ms->len + 1, 0, newsize - ms->len); + *ms->bufp = buf; + ms->len = newsize; } return (1); } diff --git a/lib/libc/stdio/open_wmemstream.c b/lib/libc/stdio/open_wmemstream.c index 213d61fcd4dd..0bed4cff5d11 100644 --- a/lib/libc/stdio/open_wmemstream.c +++ b/lib/libc/stdio/open_wmemstream.c @@ -63,17 +63,15 @@ wmemstream_grow(struct wmemstream *ms, fpos_t newoff) newsize = newoff; if (newsize > ms->len) { buf = reallocarray(*ms->bufp, newsize + 1, sizeof(wchar_t)); - if (buf != NULL) { + if (buf == NULL) + return (0); #ifdef DEBUG - fprintf(stderr, "WMS: %p growing from %zd to %zd\n", - ms, ms->len, newsize); + fprintf(stderr, "WMS: %p growing from %zd to %zd\n", + ms, ms->len, newsize); #endif - wmemset(buf + ms->len + 1, 0, newsize - ms->len); - *ms->bufp = buf; - ms->len = newsize; - return (1); - } - return (0); + wmemset(buf + ms->len + 1, 0, newsize - ms->len); + *ms->bufp = buf; + ms->len = newsize; } return (1); }