summaryrefslogtreecommitdiff
path: root/src/mod_access.c
diff options
context:
space:
mode:
authorStefan Bühler <stbuehler@web.de>2015-02-08 19:10:44 +0000
committerStefan Bühler <stbuehler@web.de>2015-02-08 19:10:44 +0000
commitad3e93ea96d1cbaab00d07245dbd02f790060f85 (patch)
treeff1dab6ccb2f2cd95c2c668b290ed3b1ffc6022b /src/mod_access.c
parentadfa06de996944b495b878540464dd6e74563052 (diff)
downloadlighttpd1.4-ad3e93ea96d1cbaab00d07245dbd02f790060f85.tar.gz
lighttpd1.4-ad3e93ea96d1cbaab00d07245dbd02f790060f85.zip
Use buffer API to read and modify "used" member
- a lot of code tried to handle manually adding terminating zeroes and keeping track of the correct "used" count. Replaced all "external" usages with simple wrapper functions: * buffer_string_is_empty (used <= 1), buffer_is_empty (used == 0); prefer buffer_string_is_empty * buffer_string_set_length * buffer_string_length * CONST_BUF_LEN() macro - removed "static" buffer hacks (buffers pointing to constant/stack memory instead of malloc()ed data) - buffer_append_strftime(): refactor buffer+strftime uses - li_tohex(): no need for a buffer for binary-to-hex conversion: the output data length is easy to predict - remove "-Winline" from extra warnings: the "inline" keyword just supresses the warning about unused but defined (static) functions; don't care whether it actually gets inlined or not. From: Stefan Bühler <stbuehler@web.de> git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2979 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'src/mod_access.c')
-rw-r--r--src/mod_access.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mod_access.c b/src/mod_access.c
index 7b88e192..a6c25a47 100644
--- a/src/mod_access.c
+++ b/src/mod_access.c
@@ -125,11 +125,11 @@ URIHANDLER_FUNC(mod_access_uri_handler) {
int s_len;
size_t k;
- if (con->uri.path->used == 0) return HANDLER_GO_ON;
+ if (buffer_is_empty(con->uri.path)) return HANDLER_GO_ON;
mod_access_patch_connection(srv, con, p);
- s_len = con->uri.path->used - 1;
+ s_len = buffer_string_length(con->uri.path);
if (con->conf.log_request_handling) {
log_error_write(srv, __FILE__, __LINE__, "s",
@@ -138,12 +138,12 @@ URIHANDLER_FUNC(mod_access_uri_handler) {
for (k = 0; k < p->conf.access_deny->used; k++) {
data_string *ds = (data_string *)p->conf.access_deny->data[k];
- int ct_len = ds->value->used - 1;
+ int ct_len = buffer_string_length(ds->value);
int denied = 0;
if (ct_len > s_len) continue;
- if (ds->value->used == 0) continue;
+ if (buffer_is_empty(ds->value)) continue;
/* if we have a case-insensitive FS we have to lower-case the URI here too */