Returns nonzero if the string |s| ends with the substring |sub| */
| 337 | |
| 338 | /* Returns nonzero if the string |s| ends with the substring |sub| */ |
| 339 | static int ends_with(const char *s, const char *sub) { |
| 340 | size_t slen = strlen(s); |
| 341 | size_t sublen = strlen(sub); |
| 342 | if (slen < sublen) |
| 343 | return 0; |
| 344 | return memcmp(s + slen - sublen, sub, sublen) == 0; |
| 345 | } |
| 346 | |
| 347 | /* Returns int value of hex string character |c| */ |
| 348 | static uint8_t hex_to_uint(uint8_t c) { |