- /*
- * Set up line pointer array and line space.
- */
- if ((win->lines = malloc (nl * sizeof(__LINE *))) == NULL) {
- free(win);
- return NULL;
- }
- if ((win->lspace = malloc (nl * sizeof(__LINE))) == NULL) {
- free (win);
- free (win->lines);
- return NULL;
- }
-
- /*
- * Allocate window space in one chunk.
- */
- if ((win->wspace = malloc(nc * nl * sizeof(__LDATA))) == NULL) {
- free(win->lines);
- free(win->lspace);
- free(win);
- return NULL;
- }
-
- /*
- * Point line pointers to line space, and lines themselves into
- * window space.
- */
- for (lp = win->lspace, i = 0; i < nl; i++, lp++) {
- win->lines[i] = lp;
- lp->line = &win->wspace[i * nc];
- lp->firstchp = &lp->firstch;
- lp->lastchp = &lp->lastch;
- lp->firstch = 0;
- lp->lastch = 0;
+ /* Don't allocate space if it's a subwindow */
+ if (!sub) {
+ /*
+ * Set up line pointer array and line space.
+ */
+ if ((win->lines = malloc (nl * sizeof(__LINE *))) == NULL) {
+ free(win);
+ return NULL;
+ }
+ if ((win->lspace = malloc (nl * sizeof(__LINE))) == NULL) {
+ free (win);
+ free (win->lines);
+ return NULL;
+ }
+
+ /*
+ * Allocate window space in one chunk.
+ */
+ if ((win->wspace =
+ malloc(nc * nl * sizeof(__LDATA))) == NULL) {
+ free(win->lines);
+ free(win->lspace);
+ free(win);
+ return NULL;
+ }
+
+ /*
+ * Point line pointers to line space, and lines themselves into
+ * window space.
+ */
+ for (lp = win->lspace, i = 0; i < nl; i++, lp++) {
+ win->lines[i] = lp;
+ lp->line = &win->wspace[i * nc];
+ lp->firstchp = &lp->firstch;
+ lp->lastchp = &lp->lastch;
+ lp->firstch = 0;
+ lp->lastch = 0;
+ }