-RoteTerm *rote_vt_create(int rows, int cols) {
- RoteTerm *rt;
- int i, j;
-
- if (rows <= 0 || cols <= 0) return NULL;
-
- if (! (rt = (RoteTerm*) malloc(sizeof(RoteTerm))) ) return NULL;
- memset(rt, 0, sizeof(RoteTerm));
-
- /* record dimensions */
- rt->rows = rows;
- rt->cols = cols;
-
- /* default mode is replace */
- rt->insert = false;
-
- /* create the cell matrix */
- rt->cells = (RoteCell**) malloc(sizeof(RoteCell*) * rt->rows);
- for (i = 0; i < rt->rows; i++) {
- /* create row */
- rt->cells[i] = (RoteCell*) malloc(sizeof(RoteCell) * rt->cols);
-
- /* fill row with spaces */
- for (j = 0; j < rt->cols; j++) {
- rt->cells[i][j].ch = 0x20; /* a space */
- rt->cells[i][j].attr = 0x70; /* white text, black background */
- }
- }
-
- /* allocate dirtiness array */
- rt->line_dirty = (bool*) malloc(sizeof(bool) * rt->rows);
-
- /* initialization of other public fields */
- rt->crow = rt->ccol = 0;
- rt->curattr = 0x70; /* white text over black background */
-
- /* allocate private data */
- rt->pd = (RoteTermPrivate*) malloc(sizeof(RoteTermPrivate));
- memset(rt->pd, 0, sizeof(RoteTermPrivate));
-
- rt->pd->pty = -1; /* no pty for now */
-
- /* initial scrolling area is the whole window */
- rt->pd->scrolltop = 0;
- rt->pd->scrollbottom = rt->rows - 1;
-
- #ifdef DEBUG
- fprintf(stderr, "Created a %d x %d terminal.\n", rt->rows, rt->cols);
- #endif
-
- return rt;
-}
+RoteTerm *rote_vt_create(int rows, int cols)
+{
+ RoteTerm *rt;
+ int i, j;
+
+ if (rows <= 0 || cols <= 0)
+ return NULL;
+
+ rt = (RoteTerm*)calloc(sizeof(RoteTerm), 1);
+ if (!rt)
+ return NULL;
+
+ /* record dimensions */
+ rt->rows = rows;
+ rt->cols = cols;
+
+ /* default mode is replace */
+ rt->insert = false;
+
+ /* create the cell matrix */
+ rt->cells = (RoteCell**) malloc(sizeof(RoteCell*) * rt->rows);
+ for (i = 0; i < rt->rows; i++) {
+ /* create row */
+ rt->cells[i] = (RoteCell*) malloc(sizeof(RoteCell) * rt->cols);
+
+ /* fill row with spaces */
+ for (j = 0; j < rt->cols; j++) {
+ rt->cells[i][j].ch = 0x20; /* a space */
+ rt->cells[i][j].attr = 0x70; /* white text, black background */
+ }
+ }