Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
5e454f6d
Commit
5e454f6d
authored
Dec 16, 2002
by
vva@eagle.mysql.r18.ru
Browse files
Options
Browse Files
Download
Plain Diff
Merge vvagin@work.mysql.com:/home/bk/mysql-4.1
into eagle.mysql.r18.ru:/home/vva/work/sanya_bug/4.1
parents
e82b91e1
0f3305c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
6 deletions
+52
-6
sql/gen_lex_hash.cc
sql/gen_lex_hash.cc
+52
-6
No files found.
sql/gen_lex_hash.cc
View file @
5e454f6d
...
@@ -200,19 +200,21 @@ void insert_sql_functions()
...
@@ -200,19 +200,21 @@ void insert_sql_functions()
}
}
}
}
void
generate_find_structs
()
void
calc_length
()
{
{
root_by_len
=
0
;
max_len
=
0
;
size_t
i
;
SYMBOL
*
cur
,
*
end
=
symbols
+
array_elements
(
symbols
);
SYMBOL
*
cur
,
*
end
=
symbols
+
array_elements
(
symbols
);
for
(
cur
=
symbols
;
cur
<
end
;
cur
++
)
for
(
cur
=
symbols
;
cur
<
end
;
cur
++
)
cur
->
length
=
(
uchar
)
strlen
(
cur
->
name
);
cur
->
length
=
(
uchar
)
strlen
(
cur
->
name
);
end
=
sql_functions
+
array_elements
(
sql_functions
);
end
=
sql_functions
+
array_elements
(
sql_functions
);
for
(
cur
=
sql_functions
;
cur
<
end
;
cur
++
)
for
(
cur
=
sql_functions
;
cur
<
end
;
cur
++
)
cur
->
length
=
(
uchar
)
strlen
(
cur
->
name
);
cur
->
length
=
(
uchar
)
strlen
(
cur
->
name
);
}
void
generate_find_structs
()
{
root_by_len
=
0
;
max_len
=
0
;
insert_symbols
();
insert_symbols
();
root_by_len2
=
root_by_len
;
root_by_len2
=
root_by_len
;
...
@@ -351,6 +353,45 @@ static int get_options(int argc, char **argv)
...
@@ -351,6 +353,45 @@ static int get_options(int argc, char **argv)
return
(
0
);
return
(
0
);
}
}
int
check_dup_symbols
(
SYMBOL
*
s1
,
SYMBOL
*
s2
)
{
if
(
s1
->
length
!=
s2
->
length
||
strncmp
(
s1
->
name
,
s2
->
name
,
s1
->
length
))
return
0
;
const
char
*
err_tmpl
=
"
\n
gen_lex_hash fatal error : \
Unfortunately gen_lex_hash can not generate a hash,
\n
since \
your lex.h has duplicate definition for a symbol
\"
%s
\"\n\n
"
;
printf
(
err_tmpl
,
s1
->
name
);
fprintf
(
stderr
,
err_tmpl
,
s1
->
name
);
return
1
;
}
int
check_duplicates
()
{
SYMBOL
*
cur1
,
*
cur2
,
*
s_end
,
*
f_end
;
s_end
=
symbols
+
array_elements
(
symbols
);
f_end
=
sql_functions
+
array_elements
(
sql_functions
);
for
(
cur1
=
symbols
;
cur1
<
s_end
;
cur1
++
)
{
for
(
cur2
=
cur1
+
1
;
cur2
<
s_end
;
cur2
++
)
if
(
check_dup_symbols
(
cur1
,
cur2
))
return
1
;
for
(
cur2
=
sql_functions
;
cur2
<
f_end
;
cur2
++
)
if
(
check_dup_symbols
(
cur1
,
cur2
))
return
1
;
}
for
(
cur1
=
sql_functions
;
cur1
<
f_end
;
cur1
++
)
for
(
cur2
=
cur1
+
1
;
cur2
<
f_end
;
cur2
++
)
if
(
check_dup_symbols
(
cur1
,
cur2
))
return
1
;
return
0
;
}
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
{
MY_INIT
(
argv
[
0
]);
MY_INIT
(
argv
[
0
]);
...
@@ -376,6 +417,11 @@ int main(int argc,char **argv)
...
@@ -376,6 +417,11 @@ int main(int argc,char **argv)
a perfect
\n
hash function */
\n\n
"
);
a perfect
\n
hash function */
\n\n
"
);
printf
(
"#include
\"
lex.h
\"\n\n
"
);
printf
(
"#include
\"
lex.h
\"\n\n
"
);
calc_length
();
if
(
check_duplicates
())
exit
(
1
);
generate_find_structs
();
generate_find_structs
();
print_find_structs
();
print_find_structs
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment