mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Simplify string comparison
This is based on Linus' idea on the mailing list. Treat NULL strings and empty strings as identical. Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
024420a60d
commit
0c836ebc47
3 changed files with 12 additions and 15 deletions
6
dive.h
6
dive.h
|
|
@ -7,6 +7,7 @@
|
|||
#include <math.h>
|
||||
#include <zip.h>
|
||||
#include <sqlite3.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Windows has no MIN/MAX macros - so let's just roll our own */
|
||||
#define MIN(x, y) ({ \
|
||||
|
|
@ -23,6 +24,11 @@
|
|||
|
||||
#define IS_FP_SAME(_a, _b) (fabs((_a) - (_b)) < 0.000001 * MAX(fabs(_a), fabs(_b)))
|
||||
|
||||
static inline int same_string(const char *a, const char *b)
|
||||
{
|
||||
return !strcmp(a ? : "", b ? : "");
|
||||
}
|
||||
|
||||
#include <libxml/tree.h>
|
||||
#include <libxslt/transform.h>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue