Skip to content
Commit 66f92cf9 authored by Rusty Russell's avatar Rusty Russell
Browse files

strstarts: helper function for !strncmp(str, prefix, strlen(prefix))



Impact: minor new API

ksplice added a "starts_with" function, which seems like a common need.
When people open-code it they seem to use fixed numbers rather than strlen,
so it's quite a readability win (also, strncmp() almost always wants != 0
on it).

So here's strstarts().

Cc: Anders Kaseorg <andersk@mit.edu>
Cc: Jeff Arnold <jbarnold@mit.edu>
Cc: Tim Abbott <tabbott@mit.edu>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent aa0d3bb7
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment