diff options
author | Dave Davenport <qball@gmpclient.org> | 2017-09-29 08:32:09 +0200 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2017-09-29 08:40:25 +0200 |
commit | ebffe5503d1709f00d4d7d85f0db4f8fe1dc4f42 (patch) | |
tree | c35dca4f2e9abeb271eeca3560b2ef83d3ff2831 /source/history.c | |
parent | a1ea3e268f92e9edcce6a794d98929effb036675 (diff) |
Implement support for specifying negated match
- Prepending - inverts the matching result.
- Fix logic window/drun browser.
- Breaks API as argument token_match callback changed.
- Update tests.
Fixes: #665
Diffstat (limited to 'source/history.c')
-rw-r--r-- | source/history.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/history.c b/source/history.c index 56f2ffba..6b4a9794 100644 --- a/source/history.c +++ b/source/history.c @@ -80,6 +80,7 @@ static void __history_write_element_list ( FILE *fd, _element **list, unsigned i static _element ** __history_get_element_list ( FILE *fd, unsigned int *length ) { + unsigned int real_length = 0; _element **retv = NULL; if ( length == NULL ) { @@ -108,8 +109,12 @@ static _element ** __history_get_element_list ( FILE *fd, unsigned int *length ) if ( ( l - ( start - buffer ) ) < 2 ) { continue; } - // Resize and check. - retv = g_realloc ( retv, ( *length + 2 ) * sizeof ( _element* ) ); + if ( real_length < (*length+2) ) + { + real_length += 15; + // Resize and check. + retv = g_realloc ( retv, ( real_length ) * sizeof ( _element* ) ); + } retv[( *length )] = g_malloc ( sizeof ( _element ) ); |