3 ms·
It’s wrappers all the way down
- tropo 8y agoDear my... this is way leaner in C. return strrchr(str,',')+1; There are just a handful of branches unless your library goes nuts with vectorization. If you want to handle three forms of broken input: if(!str) return NULL; str = strrchr(str,','); if(!str) return NULL; if(!*++str) return NULL; return str;
- db48x 8y agoIt's only leaner in C if you know that the caller doesn't need a freshly-allocated string, and isn't going to free the pointer that you return.