Consistently use both leading and trailing spaces inside of the {}'s

when pretty-printing structures.  Most structures used both spaces,
but some only used a trailing space and some used neither.
This commit is contained in:
John Baldwin 2015-08-06 20:05:40 +00:00
parent a046541623
commit 1e2ec671fc
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=286388

View File

@ -847,7 +847,7 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval,
struct timespec ts;
if (get_struct(pid, (void *)args[sc->offset], &ts,
sizeof(ts)) != -1)
asprintf(&tmp, "{%ld.%09ld }", (long)ts.tv_sec,
asprintf(&tmp, "{ %ld.%09ld }", (long)ts.tv_sec,
ts.tv_nsec);
else
asprintf(&tmp, "0x%lx", args[sc->offset]);
@ -863,7 +863,7 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval,
if (get_struct(pid, (void *)args[sc->offset], &ts, sizeof(ts))
!= -1) {
fp = open_memstream(&tmp, &len);
fputc('{', fp);
fputs("{ ", fp);
sep = "";
for (i = 0; i < nitems(ts); i++) {
fputs(sep, fp);
@ -881,7 +881,7 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval,
break;
}
}
fputc('}', fp);
fputs(" }", fp);
fclose(fp);
} else
asprintf(&tmp, "0x%lx", args[sc->offset]);
@ -891,7 +891,7 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval,
struct timeval tv;
if (get_struct(pid, (void *)args[sc->offset], &tv, sizeof(tv))
!= -1)
asprintf(&tmp, "{%ld.%06ld }", (long)tv.tv_sec,
asprintf(&tmp, "{ %ld.%06ld }", (long)tv.tv_sec,
tv.tv_usec);
else
asprintf(&tmp, "0x%lx", args[sc->offset]);
@ -901,7 +901,7 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval,
struct timeval tv[2];
if (get_struct(pid, (void *)args[sc->offset], &tv, sizeof(tv))
!= -1)
asprintf(&tmp, "{%ld.%06ld, %ld.%06ld }",
asprintf(&tmp, "{ %ld.%06ld, %ld.%06ld }",
(long)tv[0].tv_sec, tv[0].tv_usec,
(long)tv[1].tv_sec, tv[1].tv_usec);
else
@ -912,7 +912,7 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval,
struct itimerval itv;
if (get_struct(pid, (void *)args[sc->offset], &itv,
sizeof(itv)) != -1)
asprintf(&tmp, "{%ld.%06ld, %ld.%06ld }",
asprintf(&tmp, "{ %ld.%06ld, %ld.%06ld }",
(long)itv.it_interval.tv_sec,
itv.it_interval.tv_usec,
(long)itv.it_value.tv_sec,
@ -1016,6 +1016,7 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval,
tmpsize);
tmp[used++] = '{';
tmp[used++] = ' ';
for (i = 0; i < numfds; i++) {
u = snprintf(tmp + used, per_fd, "%s%d/%s",
@ -1024,6 +1025,7 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval,
if (u > 0)
used += u < per_fd ? u : per_fd;
}
tmp[used++] = ' ';
tmp[used++] = '}';
tmp[used++] = '\0';
} else {
@ -1056,6 +1058,7 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval,
"output", tmpsize);
tmp[used++] = '{';
tmp[used++] = ' ';
for (i = 0; i < numfds; i++) {
if (FD_ISSET(i, fds)) {
u = snprintf(tmp + used, per_fd, "%d ",
@ -1064,8 +1067,6 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval,
used += u < per_fd ? u : per_fd;
}
}
if (tmp[used-1] == ' ')
used--;
tmp[used++] = '}';
tmp[used++] = '\0';
} else
@ -1266,8 +1267,9 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval,
default:
sa = (struct sockaddr *)&ss;
asprintf(&tmp, "{ sa_len = %d, sa_family = %d, sa_data "
"= {%n%*s } }", (int)sa->sa_len, (int)sa->sa_family,
&i, 6 * (int)(sa->sa_len - ((char *)&sa->sa_data -
"= { %n%*s } }", (int)sa->sa_len,
(int)sa->sa_family, &i,
6 * (int)(sa->sa_len - ((char *)&sa->sa_data -
(char *)sa)), "");
if (tmp != NULL) {
p = tmp + i;
@ -1333,6 +1335,7 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval,
"output", tmpsize);
tmp[used++] = '{';
tmp[used++] = ' ';
for (i = 0; i < numevents; i++) {
u = snprintf(tmp + used, per_ke,
"%s%p,%s,%s,%d,%p,%p",
@ -1346,6 +1349,7 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval,
if (u > 0)
used += u < per_ke ? u : per_ke;
}
tmp[used++] = ' ';
tmp[used++] = '}';
tmp[used++] = '\0';
} else {