ps(1): find_varentry() to take a name instead of a VAR

The only information that find_varentry() needs and uses is
a keyword/var name.  The rest of the fields in the passed VAR are
unused.

Changing its signature will ease introducing new calls to
find_varentry() in subsequent commits, as there no VAR object will exist
to be passed but just a name.

Reviewed by:    kib
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49609
This commit is contained in:
Olivier Certner 2025-02-28 10:25:31 +01:00
parent 07a7557add
commit c1e5a7fdad
No known key found for this signature in database
GPG key ID: 8CA13040971E2627
3 changed files with 4 additions and 4 deletions

View file

@ -50,7 +50,7 @@ int donlist(void);
char *elapsed(KINFO *, VARENT *);
char *elapseds(KINFO *, VARENT *);
char *emulname(KINFO *, VARENT *);
VARENT *find_varentry(VAR *);
VARENT *find_varentry(const char *);
const char *fmt_argv(char **, char *, char *, size_t);
double getpcpu(const KINFO *);
char *jailname(KINFO *, VARENT *);

View file

@ -287,7 +287,7 @@ parsefmt(const char *p, struct velisthead *const var_list,
* get on with our lives if this VAR is already
* represented in the list.
*/
vent = find_varentry(v);
vent = find_varentry(v->name);
if (vent != NULL)
continue;
}

View file

@ -1180,12 +1180,12 @@ init_list(struct listinfo *inf, addelem_rtn artn, int elemsize,
}
VARENT *
find_varentry(VAR *v)
find_varentry(const char *name)
{
struct varent *vent;
STAILQ_FOREACH(vent, &varlist, next_ve) {
if (strcmp(vent->var->name, v->name) == 0)
if (strcmp(vent->var->name, name) == 0)
return vent;
}
return NULL;