Commit graph

7940 commits

Author SHA1 Message Date
Fabian Homborg
5acbd32c2e Fix "Unknown argument -s" error in fish_vi_key_bindings
This was caused by it prepending "-s" to argv always,
and later checking $argv[1].

As it turns out, that is kinda superfluous, so we can just add "-s" to
the `bind` calls.

Also adjust the tests so the vi-bindings are enabled via the function,
which would have caught this.

Fixes #4494.
2017-12-21 16:17:21 +01:00
Fabian Homborg
884092d13b CHANGELOG 4610 2017-12-20 14:36:13 +01:00
Fabian Homborg
f9d883dd74 Add and use str2wcstring(string, size_t)
This is just for convenience.
2017-12-20 14:31:29 +01:00
Fabian Homborg
2de38ef7bf [string] Chunk reads
Profiling with callgrind revealed that about 60% of the time in a `something | string match` call
was actually spent in `string_get_arg_stdin()`,
because it was calling `read` one byte at a time.

This makes it read in chunks similar to builtin read.

This increases performance for `getent hosts | string match -v '0.0.0.0*'` from about 300ms to about 30ms (i.e. 90%).
At that point it's _actually_ quicker than `grep`.

To improve performance even more, we'd have to cut down on str2wcstring.

Fixes #4604.
2017-12-20 14:30:41 +01:00
ridiculousfish
ec2b38053e
Merge pull request #4612 from ridiculousfish/muparser-no-except
Muparser Exceptectomy

This removes large pieces of muParser that fish does not use, such as its optimizer. It also switches muParser from throwing exceptions to propagating errors explicitly.
2017-12-19 09:34:32 -08:00
ridiculousfish
873ea0f0df [muparser] Remove OnDetectVar and Diff
These are unused and useless.
2017-12-18 23:01:18 -08:00
ridiculousfish
2c317a2585 [muparser] Remove muParserFixes.h
This appears to be random pragmas for ICC only.
2017-12-18 23:01:18 -08:00
ridiculousfish
886341fdea [muparser] Remove ParserCallback m_bAllowOpti flag
muParser can no longer optimize, so this is unused.
2017-12-18 23:01:18 -08:00
ridiculousfish
e728bf45de [muparser] Remove m_strFormula from the ParserError 2017-12-18 23:01:18 -08:00
ridiculousfish
409173e0f0 [muparser] Default ParserError's constructors
No need to define these explicitly when the defaults will do.
2017-12-18 23:01:18 -08:00
ridiculousfish
e9c106b881 [muparser] Delete ParserByteCode copy and assignment ctors
These are not used.
2017-12-18 23:01:18 -08:00
ridiculousfish
8b0d2ff641 [muparser] Remove muParserTemplateMagic.h
This header is now empty
2017-12-18 23:01:18 -08:00
ridiculousfish
1f456c71f7 [muparser] Remove MathImpl
This layer of indirection is silly.
2017-12-18 23:01:18 -08:00
ridiculousfish
f0de6e0852 [muparser] Remove struct TypeInfo
The STL's facilities are totally sufficient here.
2017-12-18 23:01:18 -08:00
ridiculousfish
364f58fcfa Remove some deleted muparser headers from Xcode build 2017-12-18 23:01:18 -08:00
ridiculousfish
fd60a7cff7 [muparser] Remove unused fields from SToken 2017-12-18 23:01:17 -08:00
ridiculousfish
732b32c8b4 [muparser] Clean up constructors and other miscellaneous 2017-12-18 23:01:17 -08:00
ridiculousfish
e675a66504 [muparser] Remove some unused "optimized" opcodes 2017-12-18 23:01:17 -08:00
ridiculousfish
3f21fb64de [muparser] Remove additional unused functions 2017-12-18 23:01:17 -08:00
ridiculousfish
ab95f94048 [muparser] Remove m_nIfElseCounter instance variable
No idea why this isn't just a local.
2017-12-18 23:01:17 -08:00
ridiculousfish
4452d9ce18 [muparser] Remove m_pParseFormula function pointer
This is a very strange design that determines whether initialization
needs to be performed by reassigning a function pointer. A misguided
optimization? Just check explicitly.
2017-12-18 23:01:17 -08:00
ridiculousfish
3ed9c851a3 [muparser] Remove some OpenMP / "bulk mode" detritus 2017-12-18 23:01:17 -08:00
ridiculousfish
fdefabdb1d [muparser] Remove fun_type overloads that have four or more parameters
Supporting these is rather excessive.
2017-12-18 23:01:17 -08:00
ridiculousfish
bb9e15675e [muparser] Remove muParserDLL.h and muParserDLL.cpp
This is a C interface (?) which fish does not use and is not needed.
2017-12-18 23:01:17 -08:00
ridiculousfish
128aacaf87 [muparser] Disable muparser shared lib build
fish does not use its shared library, only the static one
2017-12-18 23:01:17 -08:00
ridiculousfish
554382a286 [muparser] Remove 'AllowOpt' parameters
This parameter was used as a hint to optimize functions invoked
with constants, but is no longer used.
2017-12-18 23:01:17 -08:00
ridiculousfish
452211ebf5 Disable exception handling in autotools build
Now that muparser no longer relies on exceptions, we can disable them
again.
2017-12-18 23:01:17 -08:00
ridiculousfish
3099d46736 Disable exception handling in CMake build
Now that muparser no longer relies on exceptions, we can disable them
again.
2017-12-18 23:01:17 -08:00
ridiculousfish
8b16fccebf Disable exception handling in Xcode build
Now that muparser no longer relies on exceptions, we can disable them
again.
2017-12-18 23:01:17 -08:00
ridiculousfish
11e6cfeb82 [math] Remove exception handling in builtin_math
This handles errors explicitly instead of catching them.
2017-12-18 23:01:16 -08:00
ridiculousfish
5d2cf3f666 [muparser] Remove getOrThrow()
This is no longer used or needed
2017-12-18 23:01:16 -08:00
ridiculousfish
2f2f4b4287 [muparser] ParserBase::Eval to return an error instead of throwing 2017-12-18 23:01:16 -08:00
ridiculousfish
11d729d09c [muparser] DefineFun() to return an error instead of throwing 2017-12-18 23:01:16 -08:00
ridiculousfish
6f14d55612 [muparser] Convert more exception handling into explicit errors 2017-12-18 23:01:16 -08:00
ridiculousfish
d3822e4cb3 [muparser] Propogate and check for lots more errors 2017-12-18 23:01:16 -08:00
ridiculousfish
0be08e4683 [muparser] DefinePostfixOprt and DefineInfixOprt to return errors
Return errors explicitly instead of throwing.
2017-12-18 23:01:16 -08:00
ridiculousfish
f3a9773849 [muparser] Make some error handling in ParserBase explicit
Return ParserError instead of throwing exceptions
2017-12-18 23:01:16 -08:00
ridiculousfish
62bedde23d [muparser] Clean up error handling in ParserTokenReader 2017-12-18 23:01:16 -08:00
ridiculousfish
91c28449aa [muparser] Parser mathematical functions to return errors instead of throw
Remove exceptions from Parser functions such as sqrt, min, and others.
2017-12-18 23:01:16 -08:00
ridiculousfish
bceef6c125 [muparser] ParserInt::IsBinVal to return false on overflow
Instead of throwing an exception, simply return false. It is too
complicated to thread the error return through this function and
ParserInt is unused by fish anyways.
2017-12-18 23:01:16 -08:00
ridiculousfish
67a6f756f2 Add some math tests for invalid inputs 2017-12-18 23:01:16 -08:00
ridiculousfish
3faccc8b3e [muparser] Remove querying variables and constants
fish does not need to query variables and constants from muparser.
This simplifies the code.
2017-12-18 23:01:16 -08:00
ridiculousfish
234808bc32 [muparser] ApplyRemainingOprt to return explicit errors 2017-12-18 23:01:16 -08:00
ridiculousfish
60d9c9fa00 [muparser] More functions to return errors
Return OptionalError for more functions, allowing for explicit error
handling.
2017-12-18 23:01:16 -08:00
ridiculousfish
d97bb3425f [muparser] Clean up ParserTokenReader constructor 2017-12-18 23:01:16 -08:00
ridiculousfish
83799832bc [muparser] Make ParserTokenReader non-copyable
There's no reason to copy these.
2017-12-18 23:01:16 -08:00
ridiculousfish
3b1b5b30ca [muparser] Clean up ParserToken::GetFuncAddr 2017-12-18 23:01:16 -08:00
ridiculousfish
c4c89dff4e [muparser] Clean up ParserCallback interface
Remove Clone() method and mark some functions as defaulted.
2017-12-18 23:01:15 -08:00
ridiculousfish
9443a4bf2d [muparser] Remove copy and assignment
There is no reason for muParsers to be copyable or assignable.
Also remove some dead code and switch an auto_ptr to unique_ptr.
2017-12-18 23:01:15 -08:00
ridiculousfish
65f4963542 [muparser] Eliminate MUP_FAIL and MUP_ASSERT
Replace MUP_ASSERT with assert(). MUP_FAIL was unused.
2017-12-18 23:01:15 -08:00