Skip to content
Snippets Groups Projects
Commit d1bca8d2 authored by Marek Behún's avatar Marek Behún Committed by Simon Glass
Browse files

env: Use better name for variable in env_get_f()


The `nxt` variable actually points to the terminating null-byte of the
current env var, and the next env var is at `nxt + 1`, not `nxt`. So a
better name for this variable is `end`.

Signed-off-by: default avatarMarek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
parent eff73b2e
No related branches found
No related tags found
No related merge requests found
...@@ -726,19 +726,19 @@ static const char *env_match(const char *p, const char *s1) ...@@ -726,19 +726,19 @@ static const char *env_match(const char *p, const char *s1)
*/ */
int env_get_f(const char *name, char *buf, unsigned len) int env_get_f(const char *name, char *buf, unsigned len)
{ {
const char *env, *p, *nxt; const char *env, *p, *end;
if (gd->env_valid == ENV_INVALID) if (gd->env_valid == ENV_INVALID)
env = (const char *)default_environment; env = (const char *)default_environment;
else else
env = (const char *)gd->env_addr; env = (const char *)gd->env_addr;
for (p = env; *p != '\0'; p = nxt + 1) { for (p = env; *p != '\0'; p = end + 1) {
const char *value; const char *value;
int n; int n;
for (nxt = p; *nxt != '\0'; ++nxt) for (end = p; *end != '\0'; ++end)
if (nxt - env >= CONFIG_ENV_SIZE) if (end - env >= CONFIG_ENV_SIZE)
return -1; return -1;
value = env_match(p, name); value = env_match(p, name);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment