From: Tom Rini Date: Fri, 20 Jul 2018 18:35:50 -0400 Subject: [U-Boot] [U-Boot, v6, 4/6] hashtable: do not recreate whole hash table if vars are passed to himport_r In-Reply-To: <4e497f158d7ce346a3404f13b56cbeb3aa6a0259.1531156332.git-series.quentin.schulz@bootlin.com> References: <4e497f158d7ce346a3404f13b56cbeb3aa6a0259.1531156332.git-series.quentin.schulz@bootlin.com> Message-ID: <20180720223550.GN11755@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Mon, Jul 09, 2018 at 07:16:28PM +0200, Quentin Schulz wrote: > When vars are passed to the himport_r function with H_NOCLEAR flag, > those vars will be overridden in the current environment and if one of > those vars is not in the imported environment, it'll be deleted in the > current environment whatever the flag passed to himport_r. > > The H_NOCLEAR flag is used to clear the whole environment whether vars > are passed to the function or not. > > This leads to incoherent behaviour. If one passes vars to himport_r > with the H_NOCLEAR flag, if a var in vars is not in the imported env, > that var will be removed from the current env. > > If one passes vars to himport_r without the H_NOCLEAR flag, the whole > environment will be removed and vars will be imported from the > environment in RAM. > > It makes more sense to keep the variable that is in the current > environment but not in the imported environment if the H_NOCLEAR flag is > set and remove only that variable if the H_NOCLEAR flag is not set. > > Let's clear the whole environment only if H_NOCLEAR and vars are not > passed to himport_r. > > Let's remove variables that are in the current environment but not in > the imported env only if the H_NOCLEAR flag is not passed. > > Suggested-by: Wolfgang Denk > Signed-off-by: Quentin Schulz Applied to u-boot/master, thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: