Commit Graph

281 Commits

Author SHA1 Message Date
David Adam
ac68c0c878 env_universal_common.cpp: pass correct flag to fcntl
Closes #2955.

(cherry picked from commit d5797c5439)
2016-04-27 20:46:12 +08:00
Kurtis Rader
df10b53c0c restyle builtin modules to match project style
Now that the IWYU cleanup has been merged compile all, not just a couple, of
the builtin modules independent of builtin.cpp. That is, no longer `#include
builtin_NAME.cpp` in builtin.cpp. This is more consistent, more in line with
what developers expect, and is likely to reduce mistakes.

Reduces lint errors from 384 to 336 (-13%). Line count from 6307 to 4988 (-21%).

Another step in resolving issue #2902.
2016-04-26 21:58:59 -07:00
Michael Steed
c2f9d60eb1 Update usage of pcre2_substitute() for pcre2-10.21
- Set PCRE2_SUBSTITUTE_OVERFLOW_LENGTH to get the required buffer length
  from pcre2 instead of guessing
- Set PCRE2_SUBSTITUTE_EXTENDED to enable extra goodies in the
  replacement string
2016-04-27 12:14:53 +08:00
Kurtis Rader
1f06e5f0b9 add better support for IWYU and fix things
Remove the "make iwyu" build target. Move the functionality into the
recently introduced lint.fish script. Fix a lot, but not all, of the
include-what-you-use errors. Specifically, it fixes all of the IWYU errors
on my OS X server but only removes some of them on my Ubuntu 14.04 server.

Fixes #2957
2016-04-26 15:02:22 -07:00
Kurtis Rader
bd4622a0d0 make comments Xcode friendly
The OS X Xcode IDE has a weird requirement that block comments preceding a
function or class definition must begin with three slashes rather than two if
you want the comment displayed in the "Quick Help" window.
2016-04-19 18:22:44 -07:00
Kurtis Rader
c93e38380a restyle autoload module to match project style
Reduces lint errors from 38 to 19 (-50%). Line count from 506 to 426 (-16%).

Another step in resolving issue #2902.
2016-04-18 22:06:31 -07:00
Kurtis Rader
a10a79c6d0 restyle builtin module to match project style
Reduces lint errors from 271 to 215 (-21%). Line count from 4304 to 3242 (-25%).

Another step in resolving issue #2902.
2016-04-18 21:06:10 -07:00
Kurtis Rader
61c0ca9dd9 restyle history code to match project style
Make the history code conform to the new style guide. Every change was
produced by clang-format (e.g., `make style`) with the exception of
comments which were manually reformatted.  That has to be done by hand
since clang-format leaves comments alone other than to reflow comment
lines to get them below the allowed line length.

The total number of lines is reduced by 313 lines (13%) in the two
affected files. Line count is generally a poor metric but in this
case it reflects an increase in information density without a loss in
readability. Furthermore, the standardization of braces, whitespace,
and comment style will make it easier for people to read the code.

This reduces the number of warnings by `make lint` from 168 to 87 (a 48%
decrease). Making it much easier to focus on the substantive lint issues.

Further improvements are possible. For example, many comments are not
very helpful (e.g., they point out the obvious) or provide insufficient
detail. But those are beyond the scope of this change.

This is the first step in resolving issue #2902.
2016-04-18 17:20:19 -07:00
Kurtis Rader
ea3d9c36a5 fix off by one error 2016-04-13 09:00:07 -07:00
Kurtis Rader
8e103c231e fish handling of readlink()
The readlink() function does not null terminate the path it returns.

Remove the OS X code that deals with a path buffer that is too short. For
one thing a loop isn't needed since we're told how big of a buffer
is required if the first _NSGetExecutablePath() call fails. But more
important it is so unlikely that the path will be longer than PATH_MAX
that if it is we should just give up.

Fixes 2931.
2016-04-12 19:03:07 -07:00
Kurtis Rader
9569f51e83 revert inadvertent file inclusion in prior commit
Commit 6431c0de16 was not meant to include
changes to fish.cpp.
2016-04-12 19:01:28 -07:00
Kurtis Rader
6431c0de16 fix bug in lint.fish helper script
I just noticed that depending on the state of your working tree there can be
one or more spaces after the modification token and the file name. If there is
more than one space that causes the `string split` to produce unexpected
output.
2016-04-12 18:32:20 -07:00
Kurtis Rader
46840ae375 another wcstring to wchar_t * change
In keeping with the change made by @ridiculousfish earlier today modify
the `keyword_description()` function to return a const wchar_t pointer.

Also, simplify the `token_type_description()` function to use the recently
introduced mapping array. This changes the wording of many of the token
type descriptions. However, I can't see this as being a problem since
the original descriptions (e.g., "token_redirection") are no clearer to
someone not acquainted with the implementation.
2016-04-10 19:29:23 -07:00
Kurtis Rader
59f0261dba enhance fish_indent to normalize keywords
Fish keywords can be quoted and split across lines. Prior to this change
`fish_indent` would retain such odd, obfuscated, formatting. This change
results in all keywords being converted to their canonical form.

This required fixing a bug: the keyword member of parse_node_t wasn't being
populated. This hadn't been noticed prior to now because it wasn't used.

Fixes #2921
2016-04-10 18:40:11 -07:00
ridiculousfish
7ad6a90ea2 Change parser_token_types from wcstring to const wchar_t *
Reduces allocations and startup time
2016-04-10 01:11:09 -07:00
Aaron Gyes
574851f092 Fix #2919 by removing the entire block.
This code represents only risk and does nothing useful for anything
that can compile fish.

In C++ situations where __STDC_VERSION__ is unset (as it should be),
fish was assuming we are on < C99 and setting it to __FUNCTION__.

Basically always, __PRETTY_FUNCTION__ ends up reaplaced by __FUNCTION__, this hurt
error message usefulness and richness.

__PRETTY_FUNCTION__: const thing::sub(int)
__FUNCTION__: sub
2016-04-09 12:40:04 -07:00
Jak Wings
2d5eaed745 fix handling of line continuation in keywords
This behavior is more consistent with line continuation in strings other
than keywords.

Fixes #2897
2016-04-08 21:05:46 -07:00
Kurtis Rader
6adc35c636 add missing special-case for ../
When I reviewed the fix for #952 I noted that "../" wasn't handled but in my
haste to merge it forgot to augment the pull-request.
2016-04-08 15:52:10 -07:00
ridiculousfish
e395a0eb69 Migrate PATH-completion logic from complete.cpp to expand.cpp
Prior to this fix, when completing a command that doesn't have a /, we
would prepend each component of PATH and then expand the whole thing. So
any special characters in the PATH would be interpreted when performing
tab completion.

With this fix, we pull the PATH resolution out of complete.cpp and
migrate it to expand.cpp. This unifies nicely with the CDPATH resolution
already in that file. This requires introducing a new expand flag
EXPAND_SPECIAL_FOR_COMMAND, which is analogous to EXPAND_SPECIAL_CD
(which is renamed to EXPAND_SPECIAL_FOR_CD). This flag tells expand to
resolve paths against PATH instead of the working directory.

Fixes #952
2016-04-07 20:15:32 -07:00
Aaron Gyes
790c7f80c7 Implement an --invert/-v for string match, like grep -v.
Only lines that do not match the pattern are shown.
2016-04-08 10:49:29 +08:00
ridiculousfish
155befe90e Complain less about "bogus" PATH entries
When determining the old path, get the existing value in any scope,
not just the set scope. Also only complain about absolute paths:
relative paths are expected to be invalid sometimes.
2016-04-07 15:44:56 -07:00
ridiculousfish
d2ae00ca44 Remove a dead function bool_from_env_var 2016-04-07 13:29:50 -07:00
Kurtis Rader
02f18cae0a fix setting of $argv for source w/no args
Fixes #139
2016-04-06 13:04:44 -07:00
Kurtis Rader
4ff8e6e781 change how redirections are formatted
Modify `fish_indent` to emit redirections without a space before the target of
the redirection; e.g., "2>&1" rather than "2>& 1" as the former is clearer to
humans.

Fixes #2899
2016-04-05 19:29:23 -07:00
Aaron Gyes
a4642f141f don't try to use st_gen (inode generation) number
Per discussion in pull-request #2891, it's not available on Linux (we just
fill it with zero), and unless run as root on OS X (or other BSD system) it
will be zero. Remove it from file_id_t. Also fix the initialization of the
file_id_t structure.

Fixes #2891
2016-04-04 20:17:05 -07:00
Kurtis Rader
8f33b55ccc remove unused special color "ignore"
Resolve lint warning about unused method "rgb_color_t::ignore()".

Fixes #2893
2016-04-04 16:55:40 -07:00
Kurtis Rader
47f1a92cc4 fixes for cppcheck lint warnings
Refine the linting behavior.

Fix several of the, mostly trivial, lint errors.
2016-04-04 14:34:28 -07:00
Kurtis Rader
411d573ba9 convert atypical env_universal_common logging
This is a quick and dirty conversion of the atypical, and undocumented,
logging done by env_universal_common.cpp to the usual `debug()` pattern. I
didn't want to drop the messages because they could be useful when
debugging future issues. So I simply converted them to the lowest debug
level using the normal debug() function.

Fixes #2887
2016-04-03 20:23:43 -07:00
Kurtis Rader
9dd6873e58 lint: remove or comment out unused functions
Cppcheck has identified a lot of unused functions. This removes funcs that
are unlikely to ever be used. Others that might be useful for debugging I've
commented out with "#if 0".
2016-04-03 19:02:46 -07:00
Kurtis Rader
3f1fc332e7 remove unused wgetopt() method found by linting 2016-04-02 22:18:31 -07:00
ridiculousfish
bb5608e920 Remove an unnecessary c_str() 2016-03-27 18:01:19 -07:00
Andreas Nordal
6495bd470d Fix memory leaks at exit found in tests
This fixes all memory leaks found by compiling with
clang++ -g -fsanitize=address and running the tests.

Method:
Ensure that memory is freed by the destructor of its respective container,
either by storing objects directly instead of by pointer, or implementing
the required destructor.
2016-03-27 17:40:48 -07:00
Kurtis Rader
de1258e09b fish --version should write to stdout
When explicitly asking for the fish version string the information
should go to stdout rather than stderr. Also, there is no reason to use
exit_without_destructors() rather than exit() in that code path. We
actually want the side-effects of exit() such as flushing stdout and
there aren't any threads or other things that could cause a normal exit
to fail when that function is run.
2016-03-23 11:42:17 -07:00
Andreas Nordal
2a4a539d86 Fix memory leak, error message when failing to open input file
The early return skipped all cleanup.
This problem is a case for the classic "goto fail" paradigm, but this
change instead makes a few adjustments to take advantage of a previously
unused level of indentation to conditionally execute the success path.

The error message now prints the filename instead of "open",
which should be more idiomatic.

Tip:
This patch makes sense if viewed with `git show --ignore-space-change`.
2016-03-22 11:43:58 -07:00
Federico Ferri
168a156e58 implement swap-selection-start-stop function
The swap-selection-start-stop function goes to the other end of the highlighted text, the equivalent of `o' for vim visual mode.

Add binding to the swap-selection-start-stop function, `o' when in visual
mode.

Document swap-selection-start-stop, begin-selection, end-selection, kill-selection.
2016-03-20 19:22:04 -07:00
Kurtis Rader
c2f1df1d4a fix handling of non-ASCII chars in C locale
The relevant standards allow the mbtowc/mbrtowc functions to reject
non-ASCII characters (i.e., chars with the high bit set) when the locale
is C or POSIX.  The BSD libraries (e.g., on OS X) don't do this but
the GNU libraries (e.g., on Linux) do. Like most programs we need the
C/POSIX locales to allow arbitrary bytes. So explicitly check if we're
in a single-byte locale (which would also include ISO-8859 variants)
and simply pass-thru the chars without encoding or decoding.

Fixes #2802.
2016-03-20 18:47:38 -07:00
David Adam
03460a3928 env_universal_common: use uid_t in geteuid checks
The u_int typedef fails to compile on all platforms (e.g. Windows). It
is part of the code imported from tmux.

Update it to the SUS-standard uid_t.

Closes #2821.
2016-03-18 15:53:29 -07:00
Andreas Nordal
f20e8420a8 parse_execution.cpp: Remove line continuations
My IDE (Kdevelop 4.7.3) didn't tackle them.
2016-03-17 16:37:52 -07:00
Jeff Kowalski
a7012648fe Improve error handling around fchown
Address the feedback from the prior commit:
- Change the sense of return value testing to match more common
comparison idiom
- Test result of fchmod as well as fchown
- Change sense of return value testing around wrename as well
- Include errno where possible in error message
2016-03-12 12:26:01 -08:00
Jeff Kowalski
46b9f263ac Handle return values from fchown
The function fchown is annotated with warn_unused_result.  As
formerly used in the code, it would emit a compiler warning
```warning: ignoring return value of ‘fchown’, declared with
attribute warn_unused_result [-Wunused-result]```

This commit notes the return value and emits appropriate error/logging
messages if the call fails, creating more traceable results and
satisfying the compiler.
2016-03-12 11:21:52 -08:00
Kurtis Rader
6a16bdb808 assume getopt/getopt_long is available
There is no longer a good reason to detect whether or not getopt_long()
is available. All UNIX implementations we're likely to run on have it. And
if we ever find one that doesn't the right thing to do is not fallback to
getopt() but to include the getopt_long() source in our package like we
do with the pcre2 library. Since it's licensed under LGPL we can legally
do so if it becomes necessary.

This partially addresses issue #2790.
2016-03-08 13:38:57 -08:00
ridiculousfish
6bee85fefa expand_string should not return any results on error
Fixes #2796
2016-03-05 21:50:05 -08:00
ridiculousfish
a37d4d809e Save a few string allocations when importing environment variables 2016-03-05 19:07:00 -08:00
ridiculousfish
3044697baa Prefer the first, not last, of any env var duplicates
If envp contains duplicate environment variables, use the
first value, not the last value. Fixes #2784.
2016-03-05 19:02:50 -08:00
ridiculousfish
1e7c3fe709 A few fixes suggested by Coverity Scan 2016-03-03 18:49:24 -08:00
ridiculousfish
58d56f91f3 Tweak UTF8 decoding interface
Previously, when decoding UTF-8, we would first run through the
array to compute the correct size, then allocate a buffer of that size,
then run through the array again to fill the buffer, and then copy it
into a std::wstring. With this fix we can copy it into the string
directly, reducing allocations and only requiring a single pass.
2016-03-02 11:24:23 -08:00
Kurtis Rader
f2246dfb34 reduce number of Unicode private-use characters
This narrows the range of Unicode codepoints fish reserves for its own
use from U+E000 thru U+F8FE (6399 codepoints) to U+F600 thru U+F73F (320
codepoints). This is still not ideal since fish shouldn't be using any
Unicode private-use codepoints but it's a step in the right direction.

This partially addresses issue #2684.
2016-02-28 18:36:34 -08:00
ridiculousfish
9151ec7092 Eliminate narrow_string_rep_t
This was used to cache a narrow string representation
of commands, so that if certain system calls returned errors
after fork, we could output error messages without allocating
memory. But in practice these errors are very uncommon, as are
commands that have wide characters. It is simpler to do a best-effort
output of the wide string, instead of caching a narrow string
unconditionally.
2016-02-28 01:38:28 -08:00
ridiculousfish
3633c51ad8 Re-use the parse tree generated during error detection for execution
Prior to this fix, read_ni would use parse_util_detect_errors
to lint the script to run, and then parser_t::eval() to execute it.
Both functions would parse the script into a parse tree. This allows
us to re-use the parse tree, improving perfomance.
2016-02-28 00:44:20 -08:00
ridiculousfish
e3970f9cbb Allow parse_execution_context to take ownership of a parse tree
Introduces a new template moved_ref which is like an rvalue reference.
This allows passing around objects while being explicit that the
receiver may acquire ownership. This will help reduce some allocations.
2016-02-28 00:33:11 -08:00
ridiculousfish
077757a30b Add missing #include guards in FISH_PAGER_H 2016-02-27 20:04:57 -08:00
ridiculousfish
211d626152 Remove unused MESS_SIZE define 2016-02-27 19:46:28 -08:00
ridiculousfish
e8aab9183e Remove some unnecessary statics and a silly #define const 2016-02-27 19:45:43 -08:00
ridiculousfish
10f3ea0008 Mark a bunch of constructors as explicit
This prevents undesired implicit conversions
2016-02-27 19:38:15 -08:00
ridiculousfish
88a785e321 Make expand_argument_list a static function
It doesn't use any properties of parser_t
2016-02-27 18:40:54 -08:00
ridiculousfish
d628fe0dea Eliminate parser_t::show_errors
Errors are now unconditionally shown
2016-02-27 18:37:59 -08:00
ridiculousfish
cbd3fa6b01 Eliminate parser_type_t
It was never fully implemented and wasn't used for anything
2016-02-27 18:25:58 -08:00
ridiculousfish
584cca59bf Allow -w option as short for --wraps in define_function
Fixes #2772
2016-02-27 17:47:23 -08:00
ridiculousfish
6cb48c6380 Allow variable completion from just a $
Previously there had to be some variable text, now you can
tab complete from just a naked $.
2016-02-27 16:51:44 -08:00
ridiculousfish
99be3ee96f Save a few allocations in src/parse_execution.cpp 2016-02-27 16:51:32 -08:00
ridiculousfish
c1c35e0f21 Fix a subtle problem that caused lots of unnecessary memory allocation 2016-02-27 16:51:28 -08:00
Aaron Gyes
c79ade9627 Send BEL to terminal to flash/beep while trying to complete something not completeable. 2016-02-25 08:18:27 +08:00
ridiculousfish
6c401bc587 Resume sorting completions from wildcard expansions
Ought to fix the wildcard expansion test on Linux
2016-02-22 03:37:39 -08:00
ridiculousfish
35160db268 Remove an unused variable 2016-02-22 03:37:03 -08:00
Michael Steed
5b0996fd80 make fish compatible with pcre2 10.21
pcre2_substitute() now sets the output buffer length to PCRE2_UNSET (~0)
if the output buffer is determined to be too small. This change keeps
track of the buffer size separately where pcre2 can't touch it.

A better fix would be to let pcre2 tell fish what size buffer it needs.
This can be done with PCRE2_SUBSTITUTE_OVERFLOW_LENGTH, but this
requires pcre2 10.21 or later (released January 12), which may be too
new to introduce as a dependency at this point.

Fixes #2743
2016-02-21 19:32:08 -08:00
ridiculousfish
947f659f96 Miscellaneous cleanup and dead code removal
Noticed by cppcheck
2016-02-19 15:45:31 -08:00
ridiculousfish
43e1c0a2bf Remove some newly dead code
out_suggested_cdpath is no longer required from is_potential_path
2016-02-18 17:00:26 -08:00
ridiculousfish
99e18d9cef Remove autosuggest_suggest_special 2016-02-18 17:00:26 -08:00
ridiculousfish
718d9baead Implement the cd "unique hierarchy" autosuggestion in expand.cpp 2016-02-18 17:00:26 -08:00
ridiculousfish
e2f4584220 Teach tests about changes to special autosuggestions 2016-02-18 17:00:26 -08:00
ridiculousfish
4138073a2f Always env_set_pwd after chdir in the fish tests
This avoids confusion between getcwd() and $PWD
2016-02-18 17:00:26 -08:00
ridiculousfish
1907323afc Additional work on unifying cd autosuggestions with complete 2016-02-18 17:00:26 -08:00
ridiculousfish
c39b94949b Complete to take a pointer to output completions, not a mutable ref 2016-02-18 17:00:26 -08:00
ridiculousfish
31bc88d16f Migrate sort_and_prioritize to complete.cpp 2016-02-18 17:00:26 -08:00
ridiculousfish
5dbf40ca75 Switch autosuggest_suggest_special to returning a completion_t 2016-02-18 17:00:26 -08:00
ridiculousfish
2d68b25025 Early work towards moving the cd special autosuggestion into completions
This will simplify some code and make the cd autosuggestion smarter
2016-02-18 17:00:25 -08:00
Aaron Gyes
0395c33982 Stop always returning STATUS_BUILTIN_ERROR on --merge. 2016-02-16 12:06:50 -08:00
ridiculousfish
81cdceddd3 Remove a debug() guarded by a surprising get_is_interactive
get_is_interactive can crash if proc_init has not been called.

Fixes #2280
2016-02-16 01:51:27 -08:00
ridiculousfish
5b506499c1 Use contains instead of string ==
Fix a few typos too
2016-02-15 13:27:00 -08:00
Andreas Nordal
62b76b26b4 Reinstate failglob behaviour for most commands
Expand globs to zero arguments (nullglob) only for set, for and count.

The warning about failing globs, and setting the accompanying $status,
now happens regardless of mode, interactive or not.

It is assumed that the above commands are the common cases where
nullglob behaviour is desirable.
More importantly, doing this with `set` is a real feature enabler,
since the resulting empty array can be passed on to any command.

The previous behaviour was actually all nullglob (since commit
cab115c8b9), but this was undocumented;
the failglob warning was still printed in interactive mode,
and the documentation was bragging about failglob behaviour.
2016-02-15 13:13:28 -08:00
ridiculousfish
3345f5d0d0 Remove an unnecessary typecast 2016-02-10 11:38:05 -08:00
ridiculousfish
28837a8b30 Remove a stale comment about const 2016-02-10 11:37:26 -08:00
Jon Eyolfson
96e688ea91 Remove const from _wgetopt_internal's argv argument
The argv argument may be modified on calls to exchange within the function and should not be const qualified (it's not true from the caller's point of view).
2016-02-10 11:35:47 -08:00
Andy Lutomirski
bc9e3c7546 fish_tests: Explicitly cast -2 to wchar_t
On arm, wchar_t is unsigned, and C++11 and newer disallow implicit
narrowing conversions inside braces.  Use an explicit conversion to
fix the build on GCC 6 and up, which defaults to C++11.
2016-02-08 13:48:28 -08:00
ridiculousfish
c4d0612e5c Factor expand_string into multiple stages
Breaks up a big ugly function into separable stages
with a common interface.
2016-02-05 01:22:46 -08:00
ridiculousfish
992dfcc4ce expand_string to return an enum instead of int 2016-02-05 00:00:38 -08:00
ridiculousfish
1e6492ef93 Bits of cleanup of expand_string
Remove some unnecessary variables, make some things not pointers
2016-02-04 23:57:21 -08:00
ridiculousfish
25ad8866c9 Merge change for lengthened and configurable escape key timeout 2016-02-04 13:56:49 -08:00
Kurtis Rader
2646d51a0b change default escape timeout
This changes the default escape timeout for the default keybindings (emacs
mode) to 300ms and the default for vi keybindings to 10ms.

I couldn't resist fixing a few nits in the fish_vi_key_bindings.fish file
since I was touching it to set the escape timeout.
2016-02-04 13:39:19 -08:00
Kurtis Rader
1d446b74ff when sourcing config.fish do not redirect stderr
All versions of fish prior to this change silently discarded anything written
to stderr while source a config.fish file. Apparently just to avoid having
the source command display an error if the file did not exist. This can mask
real problems. So instead this change explicitly checks whether the file is
readable and silently skips sourcing it if it isn't.

Resolves issue #2702.
2016-02-04 12:52:50 -08:00
ridiculousfish
dae0f63e5b Prefer special autosuggestions to match case
Fixes #2672
2016-02-04 12:46:52 -08:00
ridiculousfish
0779c89a65 Autosuggestions to follow same prioritization as tab completions
Partial fix for #2672
2016-02-04 12:46:51 -08:00
ridiculousfish
df8c4ce835 Use vector instead of deque in input_function_push_args
deque is a memory hog last I checked
2016-02-02 18:13:40 -08:00
ridiculousfish
b4a44deb7b Merge branch 'fix-jump' of git://github.com/cpick/fish-shell into cpick-fix-jump 2016-02-02 17:00:27 -08:00
ridiculousfish
60a477a303 Don't crash when autosuggesting cd'ing into a directory with ~
Fixes #2696
2016-02-02 16:47:39 -08:00
ridiculousfish
f8da754884 Work around some bogus static analyzer warnings 2016-02-02 15:39:46 -08:00
Kurtis Rader
4b9fece9f4 allow configuring the escape delay timeout
Introduce a "fish_escape_delay_ms" variable to allow the user to configure the
delay used when seeing a bare escape before assuming no other characters will
be received that might match a bound character sequence. This is primarily
useful for vi mode so that a bare escape character (i.e., keystroke) can
switch to vi "insert" to "normal" mode in a timely fashion.
2016-01-17 17:45:30 -08:00
ridiculousfish
766176443d Clean up completion removal
Rather than passing a triple of short, long, is_old, pass an option
as a string and then a type
2016-01-16 22:42:14 -08:00
ridiculousfish
3552d073f6 Mark a bit of code as unreachable 2016-01-16 16:03:09 -08:00
ridiculousfish
49d3042bd3 Simplify locking in complete.cpp 2016-01-16 16:00:57 -08:00