Branch: refs/heads/2.4 Home: https://github.com/OpenSIPS/opensips Commit: 1525893e2e3ee2002d48de0fb42284affae4acf1 https://github.com/OpenSIPS/opensips/commit/1525893e2e3ee2002d48de0fb42284affae4acf1 Author: Liviu Chircu <li...@opensips.org> Date: 2020-11-04 (Wed, 04 Nov 2020)
Changed paths: M cachedb/cachedb_dict.c M lib/test/test_csv.c M modules/acc/acc_extra.c M modules/mid_registrar/save.c M modules/registrar/lookup.c M modules/statistics/statistics.c Log Message: ----------- Code quality: Use str_match() instead of !str_strcmp() Reasons behind this change: - better performance: str_strcmp() includes lots of redundant checks and performs worse than the simplistic str_match() - safer code: although by making this change we increase the chance of a segfault (if either "a" or "b" strings are NULL), the crash will immediately indicate the coding bug and will be easy to troubleshoot. By the same argument, nobody complains that memset() or strcmp() include zero NULL checks: they don't have to! - more meaningful code: logically speaking, in most cases, the programmer simply intends to _match_ two strings, rather than to order them lexicographically... (cherry picked from commit 765a84b293db8ec3da960c0ae61f725f3519bfd9) (cherry picked from commit d004a6c5e35b7dac783b52dd95fa11d6ad2d13c2) _______________________________________________ Devel mailing list Devel@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/devel