Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
6f8a67f0
Commit
6f8a67f0
authored
May 15, 2007
by
Markus Amsler
Committed by
Alexandre Julliard
May 15, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dbghelp: Late init hash_table.
parent
8bc839a8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
5 deletions
+22
-5
dbghelp_private.h
dlls/dbghelp/dbghelp_private.h
+1
-0
storage.c
dlls/dbghelp/storage.c
+21
-5
No files found.
dlls/dbghelp/dbghelp_private.h
View file @
6f8a67f0
...
...
@@ -83,6 +83,7 @@ struct hash_table
unsigned
num_elts
;
unsigned
num_buckets
;
struct
hash_table_elt
**
buckets
;
struct
pool
*
pool
;
};
void
hash_table_init
(
struct
pool
*
pool
,
struct
hash_table
*
ht
,
...
...
dlls/dbghelp/storage.c
View file @
6f8a67f0
...
...
@@ -52,21 +52,27 @@ void pool_destroy(struct pool* pool)
#ifdef USE_STATS
unsigned
alloc
,
used
,
num
;
for
(
alloc
=
used
=
num
=
0
,
arena
=
pool
->
first
;
arena
;
arena
=
arena
->
next
)
alloc
=
used
=
num
=
0
;
arena
=
pool
->
first
;
while
(
arena
)
{
alloc
+=
pool
->
arena_size
;
used
+=
arena
->
current
-
(
char
*
)
arena
;
num
++
;
arena
=
arena
->
next
;
}
if
(
alloc
==
0
)
alloc
=
1
;
/* avoid division by zero */
FIXME
(
"STATS: pool %p has allocated %u kbytes, used %u kbytes in %u arenas,
\n
"
"
\t\t\t\t
non-allocation ratio: %.2f%%
\n
"
,
pool
,
alloc
>>
10
,
used
>>
10
,
num
,
100
.
0
-
(
float
)
used
/
(
float
)
alloc
*
100
.
0
);
#endif
for
(
arena
=
pool
->
first
;
arena
;
arena
=
next
)
arena
=
pool
->
first
;
while
(
arena
)
{
next
=
arena
->
next
;
HeapFree
(
GetProcessHeap
(),
0
,
arena
);
arena
=
next
;
}
pool_init
(
pool
,
0
);
}
...
...
@@ -310,10 +316,9 @@ unsigned hash_table_hash(const char* name, unsigned num_buckets)
void
hash_table_init
(
struct
pool
*
pool
,
struct
hash_table
*
ht
,
unsigned
num_buckets
)
{
ht
->
num_elts
=
0
;
ht
->
buckets
=
pool_alloc
(
pool
,
num_buckets
*
sizeof
(
struct
hash_table_elt
*
));
assert
(
ht
->
buckets
);
ht
->
num_buckets
=
num_buckets
;
memset
(
ht
->
buckets
,
0
,
num_buckets
*
sizeof
(
struct
hash_table_elt
*
));
ht
->
pool
=
pool
;
ht
->
buckets
=
NULL
;
}
void
hash_table_destroy
(
struct
hash_table
*
ht
)
...
...
@@ -358,6 +363,13 @@ void hash_table_add(struct hash_table* ht, struct hash_table_elt* elt)
unsigned
hash
=
hash_table_hash
(
elt
->
name
,
ht
->
num_buckets
);
struct
hash_table_elt
**
p
;
if
(
!
ht
->
buckets
)
{
ht
->
buckets
=
pool_alloc
(
ht
->
pool
,
ht
->
num_buckets
*
sizeof
(
struct
hash_table_elt
*
));
assert
(
ht
->
buckets
);
memset
(
ht
->
buckets
,
0
,
ht
->
num_buckets
*
sizeof
(
struct
hash_table_elt
*
));
}
/* in some cases, we need to get back the symbols of same name in the order
* in which they've been inserted. So insert new elements at the end of the list.
*/
...
...
@@ -372,6 +384,8 @@ void* hash_table_find(const struct hash_table* ht, const char* name)
unsigned
hash
=
hash_table_hash
(
name
,
ht
->
num_buckets
);
struct
hash_table_elt
*
elt
;
if
(
!
ht
->
buckets
)
return
NULL
;
for
(
elt
=
ht
->
buckets
[
hash
];
elt
;
elt
=
elt
->
next
)
if
(
!
strcmp
(
name
,
elt
->
name
))
return
elt
;
return
NULL
;
...
...
@@ -396,6 +410,8 @@ void hash_table_iter_init(const struct hash_table* ht,
void
*
hash_table_iter_up
(
struct
hash_table_iter
*
hti
)
{
if
(
!
hti
->
ht
->
buckets
)
return
NULL
;
if
(
hti
->
element
)
hti
->
element
=
hti
->
element
->
next
;
while
(
!
hti
->
element
&&
hti
->
index
<
hti
->
last
)
hti
->
element
=
hti
->
ht
->
buckets
[
++
hti
->
index
];
...
...
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