diff options
author | sr | 2013-07-09 19:14:34 +0200 |
---|---|---|
committer | sr | 2013-07-09 19:14:34 +0200 |
commit | 09a25c819fc6784f2ac61a37fbe36b408d838cec (patch) | |
tree | 9a20f292c6ad5e8cebd2d62172bb470c6bcd0984 /src/server/helper.h | |
parent | Rewriting.... (diff) | |
download | dnbd3-09a25c819fc6784f2ac61a37fbe36b408d838cec.tar.gz dnbd3-09a25c819fc6784f2ac61a37fbe36b408d838cec.tar.xz dnbd3-09a25c819fc6784f2ac61a37fbe36b408d838cec.zip |
Rewrite in progres....
Diffstat (limited to 'src/server/helper.h')
-rw-r--r-- | src/server/helper.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/server/helper.h b/src/server/helper.h index 5145905..1df86e8 100644 --- a/src/server/helper.h +++ b/src/server/helper.h @@ -81,6 +81,16 @@ static inline int recv_data(int client_sock, void *buffer_out, int len) return 0; } +static inline int strend(char *string, char *suffix) +{ + if (string == NULL) return FALSE; + if (suffix == NULL || *suffix == '\0') return TRUE; + const size_t len1 = strlen(string); + const size_t len2 = strlen(suffix); + if (len2 > len1) return FALSE; + return strcmp(string + len1 - len2, suffix) == 0; +} + // one byte in the map covers 8 4kib blocks, so 32kib per byte // "+ (1 << 15) - 1" is required to account for the last bit of // the image that is smaller than 32kib |