From patchwork Wed Feb 19 16:39:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denys Vlasenko X-Patchwork-Id: 11391923 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 42FE792A for ; Wed, 19 Feb 2020 16:39:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 23E282465D for ; Wed, 19 Feb 2020 16:39:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Hq5HL6uZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726671AbgBSQjW (ORCPT ); Wed, 19 Feb 2020 11:39:22 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:43499 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726700AbgBSQjW (ORCPT ); Wed, 19 Feb 2020 11:39:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582130361; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=X+2xUn1xR/ZEwsR2W0cHAAO4buIWbbEVWAc06iZQG3Y=; b=Hq5HL6uZ1I6xwLIvQF+0XOeNr+D1BzlJj61N/0EcAu57eMiCqY1WQLy1De7SkHehK94+R5 Gd0ambz5iZt031rpZTjY2guJ2COKHSIMRA7M1C9ApEZJ64jnSXkXmfJlxLRVzme2GEIL8Z 6TEYk9MM7AgX5nzucYnnG5L/cclILzY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-134-sTZVQsZzP9e-hiDzJ_xMig-1; Wed, 19 Feb 2020 11:39:18 -0500 X-MC-Unique: sTZVQsZzP9e-hiDzJ_xMig-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E083513E4; Wed, 19 Feb 2020 16:39:15 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.17.109]) by smtp.corp.redhat.com (Postfix) with ESMTP id 12CF286CCC; Wed, 19 Feb 2020 16:39:14 +0000 (UTC) From: Denys Vlasenko To: Herbert Xu , dash@vger.kernel.org Cc: Denys Vlasenko Subject: [PATCH] Remove poplocalvars() always-zero argument, make it static Date: Wed, 19 Feb 2020 17:39:13 +0100 Message-Id: <20200219163913.11951-1-dvlasenk@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Sender: dash-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dash@vger.kernel.org Signed-off-by: Denys Vlasenko --- src/var.c | 24 ++++-------------------- src/var.h | 1 - 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/src/var.c b/src/var.c index 0d7e1db..b146018 100644 --- a/src/var.c +++ b/src/var.c @@ -504,8 +504,8 @@ void mklocal(char *name, int flags) * Interrupts must be off. */ -void -poplocalvars(int keep) +static void +poplocalvars(void) { struct localvar_list *ll; struct localvar *lvp, *next; @@ -522,23 +522,7 @@ poplocalvars(int keep) next = lvp->next; vp = lvp->vp; TRACE(("poplocalvar %s\n", vp ? vp->text : "-")); - if (keep) { - int bits = VSTRFIXED; - - if (lvp->flags != VUNSET) { - if (vp->text == lvp->text) - bits |= VTEXTFIXED; - else if (!(lvp->flags & (VTEXTFIXED|VSTACK))) - ckfree(lvp->text); - } - - vp->flags &= ~bits; - vp->flags |= (lvp->flags & bits); - - if ((vp->flags & - (VEXPORT|VREADONLY|VSTRFIXED|VUNSET)) == VUNSET) - unsetvar(vp->text); - } else if (vp == NULL) { /* $- saved */ + if (vp == NULL) { /* $- saved */ memcpy(optlist, lvp->text, sizeof(optlist)); ckfree(lvp->text); optschanged(); @@ -586,7 +570,7 @@ out: void unwindlocalvars(struct localvar_list *stop) { while (localvar_stack != stop) - poplocalvars(0); + poplocalvars(); } diff --git a/src/var.h b/src/var.h index cd0477f..aa7575a 100644 --- a/src/var.h +++ b/src/var.h @@ -148,7 +148,6 @@ int exportcmd(int, char **); int localcmd(int, char **); void mklocal(char *name, int flags); struct localvar_list *pushlocalvars(int push); -void poplocalvars(int); void unwindlocalvars(struct localvar_list *stop); int unsetcmd(int, char **); void unsetvar(const char *);