vsnprintf man page claims:
"If an output error is encountered, a negative value is returned."
That means we has to call vsnprintf twice at most to have whole output
written to a string. But in case of error we return an empty string.
The code also optimizes an expected common case of outputting single
line with a small stack allocated buffer. If the stack buffer is too
small then it uses std::string::resize to allocate exactly enough memory
and writes directly to std::string.
Second call could use vsprintf because memory is known to be large
enough. But I think that difference isn't detectable outside micro
benchmarks.
YCM flag function returning None result an error from YCM python code
everytime a file is opened. The None return can happen if database
lookup fails for any reason. To let YCM have resonable flags without
database entry the .ycm_extra_conf.py can include default fallback
flags.
Changes include
* table.getn(obj) -> #obj
* Making sure string.rep gets an integer parameter
* Optimized profiling hooks (call profiler cost from factor 40 to 10)
* Specialized parameter name lookup code for c++ __index metamod calls
* Collect source lines in time sampling variant
* Simplified prevent to always filter all children
Pepperfish Profiler can produce time sampled profiles and call entry
exit profiles. Code is verbatim copy from the lua wiki [1]. This commit
won't work alone but it exists to give author credit correctly to
Daniel.
[1] http://lua-users.org/wiki/PepperfishProfiler
Authors:
Daniel Silverstone <dsilvers@pepperfish.net>
Tom Spilman <tom@sickheadgames.com>
Ben Wilhelm <zorba-pepperfish@pavlovian.net>
First, simplifies the quoting of the environment variables. Then sets
startup-with-shell to off so that gdb does not start bash first; if it
starts bash ld will see the LD_PRELOAD and try to load libdfhack.so
into the bash process, which is not what we want.
We could instead use an exec-wrapper, but that would be a slightly
larger change and we don't need any of the convenience features that
using a shell gives us (argument expansion and redirects, basically).