Page MenuHomeFreeBSD

D49611.diff
No OneTemporary

D49611.diff

diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c
--- a/bin/ps/keyword.c
+++ b/bin/ps/keyword.c
@@ -299,10 +299,7 @@
vent->header = hp;
}
vent->width = strlen(vent->header);
- vent->var = malloc(sizeof(*vent->var));
- if (vent->var == NULL)
- xo_errx(1, "malloc failed");
- memcpy(vent->var, v, sizeof(*vent->var));
+ vent->var = v;
STAILQ_INSERT_TAIL(var_list, vent, next_ve);
}
free(tempstr1);
diff --git a/bin/ps/print.c b/bin/ps/print.c
--- a/bin/ps/print.c
+++ b/bin/ps/print.c
@@ -66,7 +66,7 @@
void
printheader(void)
{
- VAR *v;
+ const VAR *v;
struct varent *vent;
STAILQ_FOREACH(vent, &varlist, next_ve)
@@ -734,7 +734,7 @@
* structures.
*/
static char *
-printval(void *bp, VAR *v)
+printval(void *bp, const VAR *v)
{
static char ofmt[32] = "%";
const char *fcp;
@@ -785,7 +785,7 @@
char *
kvar(KINFO *k, VARENT *ve)
{
- VAR *v;
+ const VAR *v;
v = ve->var;
return (printval((char *)((char *)k->ki_p + v->off), v));
@@ -794,7 +794,7 @@
char *
rvar(KINFO *k, VARENT *ve)
{
- VAR *v;
+ const VAR *v;
v = ve->var;
if (!k->ki_valid)
diff --git a/bin/ps/ps.h b/bin/ps/ps.h
--- a/bin/ps/ps.h
+++ b/bin/ps/ps.h
@@ -57,7 +57,7 @@
typedef struct varent {
STAILQ_ENTRY(varent) next_ve;
const char *header;
- struct var *var;
+ const struct var *var;
u_int width;
} VARENT;
STAILQ_HEAD(velisthead, varent);
diff --git a/bin/ps/ps.c b/bin/ps/ps.c
--- a/bin/ps/ps.c
+++ b/bin/ps/ps.c
@@ -1192,7 +1192,7 @@
scanvars(void)
{
struct varent *vent;
- VAR *v;
+ const VAR *v;
STAILQ_FOREACH(vent, &varlist, next_ve) {
v = vent->var;
@@ -1207,7 +1207,7 @@
format_output(KINFO *ki)
{
struct varent *vent;
- VAR *v;
+ const VAR *v;
KINFO_STR *ks;
char *str;
u_int len;

File Metadata

Mime Type
text/plain
Expires
Sat, Jul 4, 9:29 AM (13 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34634042
Default Alt Text
D49611.diff (1 KB)

Event Timeline