compiler-explorer / asm-parser

BSD 2-Clause "Simplified" License
27 stars 7 forks source link

Escape JSON keys #28

Closed AbrilRBS closed 2 years ago

AbrilRBS commented 2 years ago

JSON keys need to also be escaped.

Fixes compiler-explorer/compiler-explorer/issues/3963

partouf commented 2 years ago

I wonder if we should actually escape the char* interface, I don't know how optimized the escaping will be while the work doesn't actually needs to be done.

partouf commented 2 years ago

I wonder if we should actually escape the char* interface, I don't know how optimized the escaping will be while the work doesn't actually needs to be done.

Seems not at all, the std::string is always created https://godbolt.org/z/6Yn6nxhMv

partouf commented 2 years ago

can't make it constexpr because of the allocation, but we can make it static, and then it's mostly a no-op https://godbolt.org/z/zxs9YbY9s

partouf commented 2 years ago

OH oops, maybe not, it does something else in when using the actual workflow/cmake buildsettings https://godbolt.org/z/5qafKP4qb

partouf commented 2 years ago

Let's just remove the escaping for const char *, would have to resort to template shenanigans to make a compile-time checkable thing.