ded
ded copied to clipboard
Simplify the lexer_starts_with function
It became harder to understand.
It became harder to understand.
Hmm, maybe you are right but to me I can read it in simple english: if the prefix's length is zero or the the length of the rest of the string (after the cursor) is more than the prefix length and if the string starts with the prefix. If the string were NULL terminated the second condition could be removed but I checked and it does not seem to be. Plus the previous function implemented the libc function strncmp. Thanks for the review!