MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / hist_enlargebuf

Function hist_enlargebuf

extern/editline/src/hist.c:193–211  ·  view source on GitHub ↗

hist_enlargebuf() * Enlarge history buffer to specified value. Called from el_enlargebufs(). * Return 0 for failure, 1 for success. */

Source from the content-addressed store, hash-verified

191 * Return 0 for failure, 1 for success.
192 */
193protected int
194/*ARGSUSED*/
195hist_enlargebuf(EditLine *el, size_t oldsz, size_t newsz)
196{
197 Char *newbuf;
198
199 newbuf = el_realloc(el->el_history.buf, newsz * sizeof(*newbuf));
200 if (!newbuf)
201 return 0;
202
203 (void) memset(&newbuf[oldsz], '\0', (newsz - oldsz) * sizeof(*newbuf));
204
205 el->el_history.last = newbuf +
206 (el->el_history.last - el->el_history.buf);
207 el->el_history.buf = newbuf;
208 el->el_history.sz = newsz;
209
210 return 1;
211}
212
213#ifdef WIDECHAR
214protected wchar_t *

Callers 1

ch_enlargebufsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected