mirror of
https://github.com/NixOS/nix.git
synced 2025-12-22 00:41:08 +01:00
Use hybrid C / Pascal strings in the evaluator
Replace the null-terminated C-style strings in Value with hybrid C / Pascal strings, where the length is stored in the allocation before the data, and there is still a null byte at the end for the sake of C interopt. Co-Authored-By: Taeer Bar-Yam <taeer@bar-yam.me> Co-Authored-By: Sergei Zimmerman <sergei@zimmerman.foo>
This commit is contained in:
parent
8c113f80f3
commit
3bf8c76072
14 changed files with 279 additions and 100 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#include "nix/expr/primops.hh"
|
||||
#include "nix/expr/eval-inline.hh"
|
||||
#include "nix/expr/static-string-data.hh"
|
||||
|
||||
#include "expr-config-private.hh"
|
||||
|
||||
|
|
@ -136,7 +137,7 @@ static void prim_fromTOML(EvalState & state, const PosIdx pos, Value ** args, Va
|
|||
normalizeDatetimeFormat(t);
|
||||
#endif
|
||||
auto attrs = state.buildBindings(2);
|
||||
attrs.alloc("_type").mkStringNoCopy("timestamp");
|
||||
attrs.alloc("_type").mkStringNoCopy("timestamp"_sds);
|
||||
std::ostringstream s;
|
||||
s << t;
|
||||
auto str = s.view();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue