Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
3cec07d5
Commit
3cec07d5
authored
Feb 02, 1997
by
Richard Kenner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(hash_delete): Step through the hash nodes versus using hash_next to
increase efficiency. From-SVN: r13593
parent
eb0bc1e9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
5 deletions
+18
-5
gcc/objc/hash.c
+18
-5
No files found.
gcc/objc/hash.c
View file @
3cec07d5
/* Hash tables for Objective C internal structures
/* Hash tables for Objective C internal structures
Copyright (C) 1993, 1996 Free Software Foundation, Inc.
Copyright (C) 1993, 1996
, 1997
Free Software Foundation, Inc.
This file is part of GNU CC.
This file is part of GNU CC.
...
@@ -80,11 +80,24 @@ void
...
@@ -80,11 +80,24 @@ void
hash_delete
(
cache_ptr
cache
)
hash_delete
(
cache_ptr
cache
)
{
{
node_ptr
node
;
node_ptr
node
;
node_ptr
next_node
;
unsigned
int
i
;
/* Purge all key/value pairs from the table. */
/* Purge all key/value pairs from the table. */
while
((
node
=
hash_next
(
cache
,
NULL
)))
/* Step through the nodes one by one and remove every node WITHOUT
hash_remove
(
cache
,
node
->
key
);
using hash_next. this makes hash_delete much more efficient. */
for
(
i
=
0
;
i
<
cache
->
size
;
i
++
)
{
if
((
node
=
cache
->
node_table
[
i
]))
{
/* an entry in the hash table has been found, now step through the
nodes next in the list and free them. */
while
((
next_node
=
node
->
next
))
{
hash_remove
(
cache
,
node
->
key
);
node
=
next_node
;
}
hash_remove
(
cache
,
node
->
key
);
}
}
/* Release the array of nodes and the cache itself. */
/* Release the array of nodes and the cache itself. */
objc_free
(
cache
->
node_table
);
objc_free
(
cache
->
node_table
);
...
@@ -242,7 +255,7 @@ hash_value_for_key (cache_ptr cache, const void *key)
...
@@ -242,7 +255,7 @@ hash_value_for_key (cache_ptr cache, const void *key)
do
{
do
{
if
((
*
cache
->
compare_func
)(
node
->
key
,
key
))
{
if
((
*
cache
->
compare_func
)(
node
->
key
,
key
))
{
retval
=
node
->
value
;
retval
=
node
->
value
;
break
;
break
;
}
else
}
else
node
=
node
->
next
;
node
=
node
->
next
;
}
while
(
!
retval
&&
node
);
}
while
(
!
retval
&&
node
);
...
...
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