[rb-general] BUILD_PATH_PREFIX_MAP format spec, draft #1
infinity0 at debian.org
Sun Jan 22 10:43:00 CET 2017
> Ximin Luo wrote:
>> case ':':
>> case '=':
>> return 0; // invalid, should have been escaped
>> case '%':
>> if (!(x = *++src) || !(x = *++src))
>> return 0; // invalid, past end of string
>> sscanf(x, "%2hhx", &c); // could be more efficient but my C-foo is low
>> if (errno != 0)
>> return 0; // invalid, not valid hex
>> *dest = c;
>> *dest = *src;
> I'm afraid I'm still extremely bullish on this encoding question to the
> point where it's even difficult to analyse the rest of the draft. :/
> Whilst I can see the technical merit of allowing colons, requiring such
> code just seems like an *awfully* bad smell for a specification we want
> people to actually implement.
Nobody has come up with even slightly-detailed explanations of why this is the case, and I don't accept vague opinions as holding any weight.
Given everything else that needs to be done to implement the rest of the spec, this really does not increase the overall code complexity by much. The rest of the C code I didn't paste is 150+ lines to define the data structure, apply a splitting, and parse it for example.
I'm not going to change this part of the spec - at least unless GCC absolutely refuse to implement it. So please everyone stop repeating the same thing. Say something different at least.
':' occurs in Windows drive letters and defining the separator character as os.pathsep (';' on Windows) would be annoying as well, especially when it comes to trying to transfer these values between platforms.
More information about the rb-general