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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
0f3305c9
Commit
0f3305c9
authored
Dec 15, 2002
by
vva@eagle.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding check for duplicated symbols
parent
558ee89e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
6 deletions
+53
-6
BitKeeper/etc/logging_ok
BitKeeper/etc/logging_ok
+1
-0
sql/gen_lex_hash.cc
sql/gen_lex_hash.cc
+52
-6
No files found.
BitKeeper/etc/logging_ok
View file @
0f3305c9
...
...
@@ -90,6 +90,7 @@ tonu@x153.internalnet
tonu@x3.internalnet
venu@myvenu.com
venu@work.mysql.com
vva@eagle.mysql.r18.ru
vva@genie.(none)
walrus@mysql.com
wax@mysql.com
...
...
sql/gen_lex_hash.cc
View file @
0f3305c9
...
...
@@ -200,18 +200,20 @@ 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
);
for
(
cur
=
symbols
;
cur
<
end
;
cur
++
)
cur
->
length
=
(
uchar
)
strlen
(
cur
->
name
);
end
=
sql_functions
+
array_elements
(
sql_functions
);
for
(
cur
=
sql_functions
;
cur
<
end
;
cur
++
)
cur
->
length
=
(
uchar
)
strlen
(
cur
->
name
);
}
void
generate_find_structs
()
{
root_by_len
=
0
;
max_len
=
0
;
insert_symbols
();
...
...
@@ -351,6 +353,45 @@ static int get_options(int argc, char **argv)
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
)
{
MY_INIT
(
argv
[
0
]);
...
...
@@ -376,6 +417,11 @@ int main(int argc,char **argv)
a perfect
\n
hash function */
\n\n
"
);
printf
(
"#include
\"
lex.h
\"\n\n
"
);
calc_length
();
if
(
check_duplicates
())
exit
(
1
);
generate_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