comparison src/libvterm/src/vterm.c @ 20488:1d595fada804 v8.2.0798

patch 8.2.0798: libvterm code lags behind the upstream version Commit: https://github.com/vim/vim/commit/be593bf135f6967335b14ba188bd5f8f32175c75 Author: Bram Moolenaar <Bram@vim.org> Date: Tue May 19 21:20:04 2020 +0200 patch 8.2.0798: libvterm code lags behind the upstream version Problem: Libvterm code lags behind the upstream version. Solution: Include revisions 755 - 758.
author Bram Moolenaar <Bram@vim.org>
date Tue, 19 May 2020 21:30:07 +0200
parents 6a25d5086e1d
children 747a270eb1db
comparison
equal deleted inserted replaced
20487:f4ada29cdf4b 20488:1d595fada804
53 vt->parser.state = NORMAL; 53 vt->parser.state = NORMAL;
54 54
55 vt->parser.callbacks = NULL; 55 vt->parser.callbacks = NULL;
56 vt->parser.cbdata = NULL; 56 vt->parser.cbdata = NULL;
57 57
58 vt->parser.strbuffer_len = 500; // should be able to hold an OSC string
59 vt->parser.strbuffer_cur = 0;
60 vt->parser.strbuffer = vterm_allocator_malloc(vt, vt->parser.strbuffer_len);
61 if (vt->parser.strbuffer == NULL)
62 {
63 vterm_allocator_free(vt, vt);
64 return NULL;
65 }
66
67 vt->outfunc = NULL; 58 vt->outfunc = NULL;
68 vt->outdata = NULL; 59 vt->outdata = NULL;
69 60
70 vt->outbuffer_len = 200; 61 vt->outbuffer_len = 200;
71 vt->outbuffer_cur = 0; 62 vt->outbuffer_cur = 0;
72 vt->outbuffer = vterm_allocator_malloc(vt, vt->outbuffer_len); 63 vt->outbuffer = vterm_allocator_malloc(vt, vt->outbuffer_len);
73 if (vt->outbuffer == NULL) 64
65 vt->tmpbuffer_len = 64;
66 vt->tmpbuffer = vterm_allocator_malloc(vt, vt->tmpbuffer_len);
67
68 if (vt->tmpbuffer == NULL
69 || vt->outbuffer == NULL
70 || vt->tmpbuffer == NULL)
74 { 71 {
75 vterm_allocator_free(vt, vt->parser.strbuffer); 72 vterm_allocator_free(vt, vt->outbuffer);
73 vterm_allocator_free(vt, vt->tmpbuffer);
76 vterm_allocator_free(vt, vt); 74 vterm_allocator_free(vt, vt);
77 return NULL; 75 return NULL;
78 } 76 }
79 77
80 vt->tmpbuffer_len = 64;
81 vt->tmpbuffer = vterm_allocator_malloc(vt, vt->tmpbuffer_len);
82 if (vt->tmpbuffer == NULL)
83 {
84 vterm_allocator_free(vt, vt->parser.strbuffer);
85 vterm_allocator_free(vt, vt);
86 vterm_allocator_free(vt, vt->outbuffer);
87 return NULL;
88 }
89
90 return vt; 78 return vt;
91 } 79 }
92 80
93 void vterm_free(VTerm *vt) 81 void vterm_free(VTerm *vt)
94 { 82 {
96 vterm_screen_free(vt->screen); 84 vterm_screen_free(vt->screen);
97 85
98 if(vt->state) 86 if(vt->state)
99 vterm_state_free(vt->state); 87 vterm_state_free(vt->state);
100 88
101 vterm_allocator_free(vt, vt->parser.strbuffer);
102 vterm_allocator_free(vt, vt->outbuffer); 89 vterm_allocator_free(vt, vt->outbuffer);
103 vterm_allocator_free(vt, vt->tmpbuffer); 90 vterm_allocator_free(vt, vt->tmpbuffer);
104 91
105 vterm_allocator_free(vt, vt); 92 vterm_allocator_free(vt, vt);
106 } 93 }