summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authormonty@mysql.com <>2005-04-28 00:41:39 +0300
committermonty@mysql.com <>2005-04-28 00:41:39 +0300
commitb40756c27edef870cddd756116c6c1e3de12aa19 (patch)
tree7fb8cb0e958d8b306b4dc2a7ed2c3de1d6d5beca /mysys
parentbdb1441a65017348b8e481b4e1aaaed713086017 (diff)
parent126e32afc4890a509e72b04a3c9070539b92a131 (diff)
downloadmariadb-git-b40756c27edef870cddd756116c6c1e3de12aa19.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/my/mysql-4.1
Diffstat (limited to 'mysys')
-rw-r--r--mysys/default.c62
-rw-r--r--mysys/mf_keycache.c11
2 files changed, 42 insertions, 31 deletions
diff --git a/mysys/default.c b/mysys/default.c
index 63323f15fd5..4ee2041bc39 100644
--- a/mysys/default.c
+++ b/mysys/default.c
@@ -402,33 +402,48 @@ static int search_default_file_with_ext(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
continue;
/* Configuration File Directives */
- if ((*ptr == '!') && (recursion_level < max_recursion_level))
+ if ((*ptr == '!'))
{
+ if (recursion_level >= max_recursion_level)
+ {
+ for (end= ptr + strlen(ptr) - 1;
+ my_isspace(&my_charset_latin1, *(end - 1));
+ end--)
+ {}
+ end[0]= 0;
+ fprintf(stderr,
+ "Warning: skipping '%s' directive as maximum include"
+ "recursion level was reached in file %s at line %d\n",
+ ptr, name, line);
+ continue;
+ }
+
/* skip over `!' and following whitespace */
for (++ptr; my_isspace(&my_charset_latin1, ptr[0]); ptr++)
{}
- if ((!strncmp(ptr, includedir_keyword, sizeof(includedir_keyword) - 1))
- && my_isspace(&my_charset_latin1, ptr[sizeof(includedir_keyword) - 1]))
+ if ((!strncmp(ptr, includedir_keyword,
+ sizeof(includedir_keyword) - 1)) &&
+ my_isspace(&my_charset_latin1, ptr[sizeof(includedir_keyword) - 1]))
{
/* skip over "includedir" and following whitespace */
for (ptr+= sizeof(includedir_keyword) - 1;
my_isspace(&my_charset_latin1, ptr[0]); ptr++)
{}
- /* trim trailing whitespace from directory name */
- end= ptr + strlen(ptr) - 1;
- /* fgets() stores the newline character in the buffer */
- if ((end[0] == '\n') || (end[0] == '\r') ||
- my_isspace(&my_charset_latin1, end[0]))
- {
- for (; my_isspace(&my_charset_latin1, *(end - 1)); end--)
- {}
- end[0]= 0;
- }
+ /*
+ trim trailing whitespace from directory name
+ The -1 below is for the newline added by fgets()
+ Note that my_isspace() is true for \r and \n
+ */
+ for (end= ptr + strlen(ptr) - 1;
+ my_isspace(&my_charset_latin1, *(end - 1));
+ end--)
+ {}
+ end[0]= 0;
/* print error msg if there is nothing after !includedir directive */
- if (end == ptr)
+ if (end <= ptr)
{
fprintf(stderr,
"error: Wrong !includedir directive in config "
@@ -468,8 +483,8 @@ static int search_default_file_with_ext(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
my_dirend(search_dir);
}
- else if ((!strncmp(ptr, include_keyword, sizeof(include_keyword) - 1))
- && my_isspace(&my_charset_latin1, ptr[sizeof(include_keyword) - 1]))
+ else if ((!strncmp(ptr, include_keyword, sizeof(include_keyword) - 1)) &&
+ my_isspace(&my_charset_latin1, ptr[sizeof(include_keyword)-1]))
{
/* skip over `include' and following whitespace */
for (ptr+= sizeof(include_keyword) - 1;
@@ -477,12 +492,13 @@ static int search_default_file_with_ext(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
{}
/* trim trailing whitespace from filename */
- end= ptr + strlen(ptr) - 1;
- for (; my_isspace(&my_charset_latin1, *(end - 1)) ; end--)
+ for (end= ptr + strlen(ptr) - 1;
+ my_isspace(&my_charset_latin1, *(end - 1));
+ end--)
{}
end[0]= 0;
- if (end == ptr)
+ if (end <= ptr)
{
fprintf(stderr,
"error: Wrong !include directive in config "
@@ -497,14 +513,6 @@ static int search_default_file_with_ext(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
continue;
}
- else
- if (recursion_level >= max_recursion_level)
- {
- fprintf(stderr,
- "warning: skipping !include directive as maximum include"
- "recursion level was reached in file %s at line %d\n",
- name, line);
- }
if (*ptr == '[') /* Group name */
{
diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c
index 9feaf8dcd57..cee1b7eb4e9 100644
--- a/mysys/mf_keycache.c
+++ b/mysys/mf_keycache.c
@@ -1025,8 +1025,8 @@ static void reg_requests(KEY_CACHE *keycache, BLOCK_LINK *block, int count)
for a too long time (this time is determined by parameter age_threshold).
*/
-static inline void unreg_request(KEY_CACHE *keycache,
- BLOCK_LINK *block, int at_end)
+static void unreg_request(KEY_CACHE *keycache,
+ BLOCK_LINK *block, int at_end)
{
if (! --block->requests)
{
@@ -1045,10 +1045,13 @@ static inline void unreg_request(KEY_CACHE *keycache,
}
link_block(keycache, block, hot, (my_bool)at_end);
block->last_hit_time= keycache->keycache_time;
- if (++keycache->keycache_time - keycache->used_ins->last_hit_time >
+ keycache->keycache_time++;
+
+ block= keycache->used_ins;
+ /* Check if we should link a hot block to the warm block */
+ if (block && keycache->keycache_time - block->last_hit_time >
keycache->age_threshold)
{
- block= keycache->used_ins;
unlink_block(keycache, block);
link_block(keycache, block, 0, 0);
if (block->temperature != BLOCK_WARM)