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
6f18718f
Commit
6f18718f
authored
Sep 22, 1996
by
Richard Kenner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace use of __objc_xcalloc and free with objc_calloc and objc_free.
From-SVN: r12761
parent
ed40285f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
9 deletions
+7
-9
gcc/objc/hash.c
+7
-9
No files found.
gcc/objc/hash.c
View file @
6f18718f
...
@@ -39,8 +39,6 @@ Boston, MA 02111-1307, USA. */
...
@@ -39,8 +39,6 @@ Boston, MA 02111-1307, USA. */
#define EXPANSION(cache) \
#define EXPANSION(cache) \
((cache)->size * 2)
((cache)->size * 2)
void
*
__objc_xcalloc
(
size_t
,
size_t
);
cache_ptr
cache_ptr
hash_new
(
unsigned
int
size
,
hash_func_type
hash_func
,
hash_new
(
unsigned
int
size
,
hash_func_type
hash_func
,
compare_func_type
compare_func
)
compare_func_type
compare_func
)
...
@@ -53,13 +51,13 @@ hash_new (unsigned int size, hash_func_type hash_func,
...
@@ -53,13 +51,13 @@ hash_new (unsigned int size, hash_func_type hash_func,
/* Allocate the cache structure. calloc insures
/* Allocate the cache structure. calloc insures
its initialization for default values. */
its initialization for default values. */
cache
=
(
cache_ptr
)
__objc_x
calloc
(
1
,
sizeof
(
struct
cache
));
cache
=
(
cache_ptr
)
objc_
calloc
(
1
,
sizeof
(
struct
cache
));
assert
(
cache
);
assert
(
cache
);
/* Allocate the array of buckets for the cache.
/* Allocate the array of buckets for the cache.
calloc initializes all of the pointers to NULL. */
calloc initializes all of the pointers to NULL. */
cache
->
node_table
cache
->
node_table
=
(
node_ptr
*
)
__objc_x
calloc
(
size
,
sizeof
(
node_ptr
));
=
(
node_ptr
*
)
objc_
calloc
(
size
,
sizeof
(
node_ptr
));
assert
(
cache
->
node_table
);
assert
(
cache
->
node_table
);
cache
->
size
=
size
;
cache
->
size
=
size
;
...
@@ -89,8 +87,8 @@ hash_delete (cache_ptr cache)
...
@@ -89,8 +87,8 @@ hash_delete (cache_ptr cache)
hash_remove
(
cache
,
node
->
key
);
hash_remove
(
cache
,
node
->
key
);
/* Release the array of nodes and the cache itself. */
/* Release the array of nodes and the cache itself. */
free
(
cache
->
node_table
);
objc_free
(
cache
->
node_table
);
free
(
cache
);
objc_free
(
cache
);
}
}
...
@@ -98,7 +96,7 @@ void
...
@@ -98,7 +96,7 @@ void
hash_add
(
cache_ptr
*
cachep
,
const
void
*
key
,
void
*
value
)
hash_add
(
cache_ptr
*
cachep
,
const
void
*
key
,
void
*
value
)
{
{
size_t
indx
=
(
*
(
*
cachep
)
->
hash_func
)(
*
cachep
,
key
);
size_t
indx
=
(
*
(
*
cachep
)
->
hash_func
)(
*
cachep
,
key
);
node_ptr
node
=
(
node_ptr
)
__objc_x
calloc
(
1
,
sizeof
(
struct
cache_node
));
node_ptr
node
=
(
node_ptr
)
objc_
calloc
(
1
,
sizeof
(
struct
cache_node
));
assert
(
node
);
assert
(
node
);
...
@@ -171,7 +169,7 @@ hash_remove (cache_ptr cache, const void *key)
...
@@ -171,7 +169,7 @@ hash_remove (cache_ptr cache, const void *key)
/* Special case. First element is the key/value pair to be removed. */
/* Special case. First element is the key/value pair to be removed. */
if
((
*
cache
->
compare_func
)(
node
->
key
,
key
))
{
if
((
*
cache
->
compare_func
)(
node
->
key
,
key
))
{
cache
->
node_table
[
indx
]
=
node
->
next
;
cache
->
node_table
[
indx
]
=
node
->
next
;
free
(
node
);
objc_free
(
node
);
}
else
{
}
else
{
/* Otherwise, find the hash entry. */
/* Otherwise, find the hash entry. */
...
@@ -182,7 +180,7 @@ hash_remove (cache_ptr cache, const void *key)
...
@@ -182,7 +180,7 @@ hash_remove (cache_ptr cache, const void *key)
if
((
*
cache
->
compare_func
)(
node
->
key
,
key
))
{
if
((
*
cache
->
compare_func
)(
node
->
key
,
key
))
{
prev
->
next
=
node
->
next
,
removed
=
YES
;
prev
->
next
=
node
->
next
,
removed
=
YES
;
free
(
node
);
objc_free
(
node
);
}
else
}
else
prev
=
node
,
node
=
node
->
next
;
prev
=
node
,
node
=
node
->
next
;
}
while
(
!
removed
&&
node
);
}
while
(
!
removed
&&
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