aboutsummaryrefslogtreecommitdiff
path: root/cmd-server-info.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-08-09 17:28:24 +0000
committerTiago Cunha <tcunha@gmx.com>2009-08-09 17:28:24 +0000
commit37b0bcd7c15b6dac69ac8cb1c0d9d6a4fd5c54c0 (patch)
tree7422f55fe913126e060f60cf8c8d892236bc3dd6 /cmd-server-info.c
parent5b56ea181649793918779dd2684c671072ce4bc9 (diff)
downloadrtmux-37b0bcd7c15b6dac69ac8cb1c0d9d6a4fd5c54c0.tar.gz
rtmux-37b0bcd7c15b6dac69ac8cb1c0d9d6a4fd5c54c0.tar.bz2
rtmux-37b0bcd7c15b6dac69ac8cb1c0d9d6a4fd5c54c0.zip
Sync OpenBSD patchset 226:
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 contains 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.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/cmd-server-info.c b/cmd-server-info.c
index 368302d5..f0c5fff4 100644
--- a/cmd-server-info.c
+++ b/cmd-server-info.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-server-info.c,v 1.23 2009-07-28 23:04:29 tcunha Exp $ */
+/* $Id: cmd-server-info.c,v 1.24 2009-08-09 17:28:23 tcunha Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -56,6 +56,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 "