summaryrefslogtreecommitdiffstats
path: root/cmd-server-info.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-08-08 13:29:27 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-08-08 13:29:27 +0000
commit5e01b6d663abc086847c9bec145edeb9cd91530a (patch)
treea8708ca5f4a199352452945133a6fc11af807e08 /cmd-server-info.c
parente89e70e71575417195285a3ea55c430654f9fc21 (diff)
Change the way the grid is stored, previously it was:
- a two-dimensional array of cells; - a two-dimensional array of utf8 data; - an array of line lengths. Now it is a single array of a new struct grid_line each of which represents a line and containts the length and an array of cells and an array of utf8 data. This will make it easier to add additional per-line members, such as flags.
Diffstat (limited to 'cmd-server-info.c')
-rw-r--r--cmd-server-info.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/cmd-server-info.c b/cmd-server-info.c
index ce038e12..a79f2520 100644
--- a/cmd-server-info.c
+++ b/cmd-server-info.c
@@ -57,6 +57,7 @@ cmd_server_info_exec(unused struct cmd *self, struct cmd_ctx *ctx)
struct tty_term_code_entry *ent;
struct utsname un;
struct grid *gd;
+ struct grid_line *gl;
u_int i, j, k;
char out[80];
char *tim;
@@ -120,15 +121,16 @@ cmd_server_info_exec(unused struct cmd *self, struct cmd_ctx *ctx)
lines = ulines = size = usize = 0;
gd = wp->base.grid;
for (k = 0; k < gd->hsize + gd->sy; k++) {
- if (gd->data[k] != NULL) {
+ gl = &gd->linedata[k];
+ if (gl->celldata != NULL) {
lines++;
- size += gd->size[k] *
- sizeof (**gd->data);
+ size += gl->cellsize *
+ sizeof *gl->celldata;
}
- if (gd->udata[k] != NULL) {
+ if (gl->utf8data != NULL) {
ulines++;
- usize += gd->usize[k] *
- sizeof (**gd->udata);
+ usize += gl->utf8size *
+ sizeof *gl->utf8data;
}
}
ctx->print(ctx, "%6u: %s %lu %d %u/%u, %zu "