[OpenSIPS-Devel] [OpenSIPS/opensips] f975e3: Code quality: Use str_match() instead of !str_strc...
Liviu Chircu
noreply at github.com
Fri Jun 26 10:34:31 EST 2020
Branch: refs/heads/3.1
Home: https://github.com/OpenSIPS/opensips
Commit: f975e3f7b26e06ac95c183a43b6abdfe3ebb0d3b
https://github.com/OpenSIPS/opensips/commit/f975e3f7b26e06ac95c183a43b6abdfe3ebb0d3b
Author: Liviu Chircu <liviu at opensips.org>
Date: 2020-06-26 (Fri, 26 Jun 2020)
Changed paths:
M cachedb/cachedb_dict.c
M lib/test/test_csv.c
M modules/acc/acc_extra.c
M modules/acc/acc_logic.c
M modules/dialog/dlg_handlers.c
M modules/json/json.c
M modules/mid_registrar/save.c
M modules/qrouting/qr_mi.c
M modules/qrouting/qr_stats.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)
More information about the Devel
mailing list