aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/history.cpp
Commit message (Collapse)AuthorAge
* history --merge to properly interleave itemsGravatar ridiculousfish2016-06-23
| | | | Fixes #2312
* Lint CleanupGravatar Aaron Gyes2016-06-14
| | | | | | | This remove some stores that clang assures me are very dead. And an assert() for an unlikely NULL pointer dereference I can't quite figure out.
* fix random lint issuesGravatar Kurtis Rader2016-05-29
| | | | | | | | This only eliminates errors reported by `make lint`. It shouldn't cause any functional changes. This change does remove several functions that are unused. It also removes the `desc_arr` variable which is both unused and out of date with reality.
* fix some style bogosities that crept inGravatar Kurtis Rader2016-05-27
|
* add (or restore) config.h to all filesGravatar David Adam2016-05-18
| | | | | | | | The autoconf-generated config.h contains a number of directives which may alter the behaviour of system headers on certain platforms. Always include it in every C++ file as the first include. Closes #2993.
* lint: low hanging fruit in history.cppGravatar Kurtis Rader2016-05-05
|
* lint cleanup: eliminate "redundant" errorsGravatar Kurtis Rader2016-05-04
| | | | | This removes some pointless parentheses but the primary focus is removing redundancies like unnecessary "else" clauses.
* restyle switch blocks to match project styleGravatar Kurtis Rader2016-05-03
| | | | | | | | | | | | | | | I missed restyling a few "switch" blocks to make them consistent with the rest of the code base. This fixes that oversight. This should be the final step in restyling the C++ code to have a consistent style. This also includes a few trivial cleanups elsewhere. I also missed restyling the "complete" module when working my way from a to z so this final change includes restyling that module. Total lint errors decreased 36%. Cppcheck errors went from 47 to 24. Oclint P2 errors went from 819 to 778. Oclint P3 errors went from 3252 to 1842. Resolves #2902.
* add better support for IWYU and fix thingsGravatar Kurtis Rader2016-04-26
| | | | | | | | | 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
* make comments Xcode friendlyGravatar Kurtis Rader2016-04-19
| | | | | | 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.
* restyle history code to match project styleGravatar Kurtis Rader2016-04-18
| | | | | | | | | | | | | | | | | | | | | | | 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.
* 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.
* 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.
* 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.
* A few fixes suggested by Coverity ScanGravatar ridiculousfish2016-03-03
|
* Mark a bunch of constructors as explicitGravatar ridiculousfish2016-02-27
| | | | This prevents undesired implicit conversions
* Fix usage of history_filenameGravatar Jeff Kowalski2015-10-16
|
* Migrate fish_history from config to data dirGravatar Jeff Kowalski2015-10-16
| | | | | | | | | New implementation of migration code within the history_t class will copy the contents of the old fish_history found in the config directory to its new location in the data directory. The old file is left intact. This is done only in the event that a fish_history is not already found in the data directory ($XDG_DATA_HOME/fish or ~/.local/share/fish).
* Access fish_history from $XDG_DATA_HOMEGravatar Jeff Kowalski2015-10-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add new functions path_get_data and path_create_data which parallel existing functions path_get_config and path_create_data. The new functions refer to XDG_DATA_HOME, if it is defined, or ./local/share if not. Modify history_filename to use the new function path_get_data. As a consequence, fish_history will now be located in XDG_DATA_HOME, not XDG_CONFIG_HOME. Note that these changes mirror what is already used in fish-shell/share/tools/create_manpage_completions.py, which stores the completions in XDG_DATA_HOME This change matches recommendations in the xdg basedir spec at http://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html ($XDG_DATA_HOME defines the base directory relative to which user specific data files should be stored. If $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used.) It addresses suggestions from the following issues: 1. Don't put history in $XDG_CONFIG_HOME (closes #744) https://github.com/fish-shell/fish-shell/issues/744 2. Fish is placing non-config files in $XDG_CONFIG_HOME #1257 https://github.com/fish-shell/fish-shell/issues/1257 3. Move non-config data out of $XDG_CONFIG_HOME #1669 https://github.com/fish-shell/fish-shell/issues/1669
* Preserve existing file permissions when rewriting a history fileGravatar ridiculousfish2015-09-26
| | | | Fixes #2335
* Merge branch 'master' into iwyuGravatar David Adam2015-07-26
|
* Migrate source files into src/ directoryGravatar ridiculousfish2015-07-24
This change moves source files into a src/ directory, and puts object files into an obj/ directory. The Makefile and xcode project are updated accordingly. Fixes #1866