summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2019-06-04 23:18:23 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2019-06-06 02:48:43 -0400
commit72d4fe745170d190fba9eb94db0939938438bc5b (patch)
treec5dfd9082166edf81bb8f1746ba57972b168ef79
parentfc42ec12d96157173a549a0b9706f4b869b0f431 (diff)
downloadlighttpd1.4-72d4fe745170d190fba9eb94db0939938438bc5b.tar.gz
lighttpd1.4-72d4fe745170d190fba9eb94db0939938438bc5b.zip
[core] mark some more funcs w/ __attribute_pure__
-rw-r--r--src/buffer.h24
-rw-r--r--src/chunk.h3
2 files changed, 23 insertions, 4 deletions
diff --git a/src/buffer.h b/src/buffer.h
index 29535a81..f6fe00ef 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -102,8 +102,10 @@ void li_tohex_uc(char *buf, size_t buf_len, const char *s, size_t s_len);
* unset "string" (buffer) config options are initialized to used == 0,
* while setting an empty string leads to used == 1
*/
+__attribute_pure__
static inline int buffer_is_empty(const buffer *b);
/* NULL buffer, empty buffer (used == 0) or empty string (used == 1) */
+__attribute_pure__
static inline int buffer_string_is_empty(const buffer *b);
__attribute_pure__
@@ -118,9 +120,16 @@ int buffer_eq_icase_slen(const buffer * const b, const char * const s, const siz
__attribute_pure__
int buffer_eq_slen(const buffer * const b, const char * const s, const size_t slen);
+__attribute_pure__
int buffer_is_equal(const buffer *a, const buffer *b);
+
+__attribute_pure__
int buffer_is_equal_right_len(const buffer *a, const buffer *b, size_t len);
+
+__attribute_pure__
int buffer_is_equal_string(const buffer *a, const char *s, size_t b_len);
+
+__attribute_pure__
int buffer_is_equal_caseless_string(const buffer *a, const char *s, size_t b_len);
void buffer_substr_replace (buffer *b, size_t offset, size_t len, const buffer *replace);
@@ -156,30 +165,37 @@ void buffer_to_upper(buffer *b);
char hex2int(unsigned char c);
char int2hex(char i);
+__attribute_pure__
static inline int light_isdigit(int c);
-static inline int light_isxdigit(int c);
-static inline int light_isalpha(int c);
-static inline int light_isalnum(int c);
-
static inline int light_isdigit(int c) {
return (c >= '0' && c <= '9');
}
+__attribute_pure__
+static inline int light_isxdigit(int c);
static inline int light_isxdigit(int c) {
return light_isdigit(c) || (c |= 32, c >= 'a' && c <= 'f');
}
+__attribute_pure__
+static inline int light_isalpha(int c);
static inline int light_isalpha(int c) {
return (c |= 32, c >= 'a' && c <= 'z');
}
+__attribute_pure__
+static inline int light_isalnum(int c);
static inline int light_isalnum(int c) {
return light_isdigit(c) || light_isalpha(c);
}
+__attribute_pure__
static inline size_t buffer_string_length(const buffer *b); /* buffer string length without terminating 0 */
+
+__attribute_pure__
static inline size_t buffer_string_space(const buffer *b); /* maximum length of string that can be stored without reallocating */
+
static inline void buffer_append_slash(buffer *b); /* append '/' no non-empty strings not ending in '/' */
void buffer_append_path_len(buffer *b, const char *a, size_t alen); /* join strings with '/', if '/' not present */
diff --git a/src/chunk.h b/src/chunk.h
index ef0a6dbe..4c6b7e47 100644
--- a/src/chunk.h
+++ b/src/chunk.h
@@ -100,10 +100,13 @@ int chunkqueue_steal_with_tempfiles(struct server *srv, chunkqueue *dest, chunkq
int chunkqueue_open_file_chunk(struct server *srv, chunkqueue *cq);
+__attribute_pure__
off_t chunkqueue_length(chunkqueue *cq);
+
void chunkqueue_free(chunkqueue *cq);
void chunkqueue_reset(chunkqueue *cq);
+__attribute_pure__
static inline int chunkqueue_is_empty(const chunkqueue *cq);
static inline int chunkqueue_is_empty(const chunkqueue *cq) {
return NULL == cq->first;