diff options
author | tron <tron@openttd.org> | 2007-01-13 15:00:16 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2007-01-13 15:00:16 +0000 |
commit | abb644771af78103d1e8b8f5582e8a56c9dcfbfe (patch) | |
tree | 9bb1adc7db26f0d3e419320319b33f692cbcb593 /src/string.h | |
parent | fc78ef95e16e890c917da7a52f7ab1d8f5773a05 (diff) | |
download | openttd-abb644771af78103d1e8b8f5582e8a56c9dcfbfe.tar.xz |
(svn r8097) Replace strlen() {==,!=,>} 0 by the more concise {,!}StrEmpty(). Additionally the test takes O(1) instead of O(n) now
Diffstat (limited to 'src/string.h')
-rw-r--r-- | src/string.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/string.h b/src/string.h index c3bc45280..6b9924d63 100644 --- a/src/string.h +++ b/src/string.h @@ -47,6 +47,9 @@ typedef enum CharSetFilter { void strtolower(char *str); +static inline bool StrEmpty(const char* s) { return s[0] == '\0'; } + + /** Get the length of a string, within a limited buffer */ static inline int ttd_strnlen(const char *str, int maxlen) { |