From b248298b34deb98c19133c0d743ddcc1ce24d9e0 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 18 May 2014 02:04:37 +0200 Subject: m doc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/mds-server/mds-server.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mds-server/mds-server.c b/src/mds-server/mds-server.c index 2f53a12..93849ff 100644 --- a/src/mds-server/mds-server.c +++ b/src/mds-server/mds-server.c @@ -1028,14 +1028,19 @@ void add_intercept_condition(client_t* client, char* condition, int64_t priority return; } + /* Split header and value apart. */ if ((value = strchr(header, ':')) != NULL) { *value = '\0'; /* NUL-terminate header. */ value += 2; /* Skip over delimiter. */ } + /* Calcuate header hash (comparison optimisation) */ hash = string_hash(header); + /* Remove of update condition of already registered, + also look for non-modifying condition to swap position + with for optimisation. */ for (i = 0; i < n; i++) { if (conds[i].header_hash == hash) @@ -1046,7 +1051,7 @@ void add_intercept_condition(client_t* client, char* condition, int64_t priority /* Remove the condition from the list. */ memmove(conds + i, conds + i + 1, --n - i); client->interception_conditions_count--; - /* Diminish the list. */ + /* Shrink the list. */ if (n == 0) { free(conds); -- cgit v1.2.3-70-g09d2