aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
Commit message (Collapse)AuthorAge
* don't try to use st_gen (inode generation) numberGravatar Aaron Gyes2016-04-04
| | | | | | | | | 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
* remove unused special color "ignore"Gravatar Kurtis Rader2016-04-04
| | | | | | Resolve lint warning about unused method "rgb_color_t::ignore()". Fixes #2893
* fixes for cppcheck lint warningsGravatar Kurtis Rader2016-04-04
| | | | | | Refine the linting behavior. Fix several of the, mostly trivial, lint errors.
* convert atypical env_universal_common loggingGravatar Kurtis Rader2016-04-03
| | | | | | | | | | 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
* lint: remove or comment out unused functionsGravatar Kurtis Rader2016-04-03
| | | | | | 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".
* remove unused wgetopt() method found by lintingGravatar Kurtis Rader2016-04-02
|
* Remove an unnecessary c_str()Gravatar ridiculousfish2016-03-27
|
* Fix memory leaks at exit found in testsGravatar Andreas Nordal2016-03-27
| | | | | | | | | | 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.
* `fish --version` should write to stdoutGravatar Kurtis Rader2016-03-23
| | | | | | | | | 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.
* Fix memory leak, error message when failing to open input fileGravatar Andreas Nordal2016-03-22
| | | | | | | | | | | | | 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`.
* implement swap-selection-start-stop functionGravatar Federico Ferri2016-03-20
| | | | | | | | | 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.
* fix handling of non-ASCII chars in C localeGravatar Kurtis Rader2016-03-20
| | | | | | | | | | | | 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.
* env_universal_common: use uid_t in geteuid checksGravatar David Adam2016-03-18
| | | | | | | | | 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.
* parse_execution.cpp: Remove line continuationsGravatar Andreas Nordal2016-03-17
| | | | My IDE (Kdevelop 4.7.3) didn't tackle them.
* Improve error handling around fchownGravatar Jeff Kowalski2016-03-12
| | | | | | | | | 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
* Handle return values from fchownGravatar Jeff Kowalski2016-03-12
| | | | | | | | | | | 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.
* assume getopt/getopt_long is availableGravatar Kurtis Rader2016-03-08
| | | | | | | | | | | 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.
* expand_string should not return any results on errorGravatar ridiculousfish2016-03-05
| | | | Fixes #2796
* Save a few string allocations when importing environment variablesGravatar ridiculousfish2016-03-05
|
* Prefer the first, not last, of any env var duplicatesGravatar ridiculousfish2016-03-05
| | | | | If envp contains duplicate environment variables, use the first value, not the last value. Fixes #2784.
* A few fixes suggested by Coverity ScanGravatar ridiculousfish2016-03-03
|
* Tweak UTF8 decoding interfaceGravatar ridiculousfish2016-03-02
| | | | | | | | 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.
* reduce number of Unicode private-use charactersGravatar Kurtis Rader2016-02-28
| | | | | | | | | 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.
* Eliminate narrow_string_rep_tGravatar ridiculousfish2016-02-28
| | | | | | | | | | 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.
* Re-use the parse tree generated during error detection for executionGravatar ridiculousfish2016-02-28
| | | | | | | 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.
* Allow parse_execution_context to take ownership of a parse treeGravatar ridiculousfish2016-02-28
| | | | | | 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.
* Add missing #include guards in FISH_PAGER_HGravatar ridiculousfish2016-02-27
|
* Remove unused MESS_SIZE defineGravatar ridiculousfish2016-02-27
|
* Remove some unnecessary statics and a silly #define constGravatar ridiculousfish2016-02-27
|
* Mark a bunch of constructors as explicitGravatar ridiculousfish2016-02-27
| | | | This prevents undesired implicit conversions
* Make expand_argument_list a static functionGravatar ridiculousfish2016-02-27
| | | | It doesn't use any properties of parser_t
* Eliminate parser_t::show_errorsGravatar ridiculousfish2016-02-27
| | | | Errors are now unconditionally shown
* Eliminate parser_type_tGravatar ridiculousfish2016-02-27
| | | | It was never fully implemented and wasn't used for anything
* Allow -w option as short for --wraps in define_functionGravatar ridiculousfish2016-02-27
| | | | Fixes #2772
* Allow variable completion from just a $Gravatar ridiculousfish2016-02-27
| | | | | Previously there had to be some variable text, now you can tab complete from just a naked $.
* Save a few allocations in src/parse_execution.cppGravatar ridiculousfish2016-02-27
|
* Fix a subtle problem that caused lots of unnecessary memory allocationGravatar ridiculousfish2016-02-27
|
* Send BEL to terminal to flash/beep while trying to complete something not ↵Gravatar Aaron Gyes2016-02-25
| | | | completeable.
* Resume sorting completions from wildcard expansionsGravatar ridiculousfish2016-02-22
| | | | Ought to fix the wildcard expansion test on Linux
* Remove an unused variableGravatar ridiculousfish2016-02-22
|
* make fish compatible with pcre2 10.21Gravatar Michael Steed2016-02-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
* Miscellaneous cleanup and dead code removalGravatar ridiculousfish2016-02-19
| | | | Noticed by cppcheck
* Remove some newly dead codeGravatar ridiculousfish2016-02-18
| | | | out_suggested_cdpath is no longer required from is_potential_path
* Remove autosuggest_suggest_specialGravatar ridiculousfish2016-02-18
|
* Implement the cd "unique hierarchy" autosuggestion in expand.cppGravatar ridiculousfish2016-02-18
|
* Teach tests about changes to special autosuggestionsGravatar ridiculousfish2016-02-18
|
* Always env_set_pwd after chdir in the fish testsGravatar ridiculousfish2016-02-18
| | | | This avoids confusion between getcwd() and $PWD
* Additional work on unifying cd autosuggestions with completeGravatar ridiculousfish2016-02-18
|
* Complete to take a pointer to output completions, not a mutable refGravatar ridiculousfish2016-02-18
|
* Migrate sort_and_prioritize to complete.cppGravatar ridiculousfish2016-02-18
|