Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
lyskom-server-ceder-1616-generations-topgit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Per Cederqvist
lyskom-server-ceder-1616-generations-topgit
Commits
cdfa1181
Commit
cdfa1181
authored
33 years ago
by
Per Cederqvist
Browse files
Options
Downloads
Patches
Plain Diff
Cosmetic changes.
Added dump_smalloc_counts().
parent
4592a03b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/server/ram-smalloc.c
+14
-7
14 additions, 7 deletions
src/server/ram-smalloc.c
with
14 additions
and
7 deletions
src/server/ram-smalloc.c
+
14
−
7
View file @
cdfa1181
...
...
@@ -14,6 +14,7 @@
#include
"smalloc.h"
#include
"lyskomd.h"
#include
"log.h"
#include
"exp.h"
static
u_long
no_of_allocated_blocks
=
0
;
...
...
@@ -21,11 +22,10 @@ static u_long no_of_allocated_blocks = 0;
* "safe" malloc. Handles the case when malloc returns NULL.
* smalloc cannot fail.
*/
void
*
EXPORT
void
*
smalloc
(
size_t
size
)
{
unsigned
int
*
p
;
p
=
(
unsigned
int
*
)
malloc
(
size
+
2
*
sizeof
(
unsigned
int
)
+
2
);
if
(
p
==
NULL
)
...
...
@@ -42,7 +42,7 @@ smalloc(size_t size)
}
void
EXPORT
void
sfree
(
void
*
ptr
)
/* it is legal to sfree a NULL pointer */
{
unsigned
int
*
ip
;
...
...
@@ -76,7 +76,7 @@ sfree(void * ptr) /* it is legal to sfree a NULL pointer */
}
}
extern
void
*
EXPORT
void
*
srealloc
(
void
*
ptr
,
size_t
size
)
/* Never fails. It is legal to */
{
/* realloc the NULL ptr. */
unsigned
int
*
ip
;
...
...
@@ -131,7 +131,7 @@ static void **tmp_alloc_table = NULL;
static
int
tmp_alloc_table_size
=
0
;
/* Size */
static
int
tmp_alloc_table_use
=
0
;
/* Used size */
void
*
EXPORT
void
*
tmp_alloc
(
u_long
size
)
{
if
(
tmp_alloc_table_size
<=
tmp_alloc_table_use
)
...
...
@@ -153,7 +153,7 @@ tmp_alloc(u_long size)
* Free all core which is allocated with tmp_alloc(). This is called from
* end_of_atomic().
*/
void
EXPORT
void
free_tmp
(
void
)
{
int
i
;
...
...
@@ -167,7 +167,7 @@ free_tmp(void)
tmp_alloc_table_use
=
0
;
}
void
EXPORT
void
free_all_tmp
(
void
)
{
free_tmp
();
...
...
@@ -175,3 +175,10 @@ free_all_tmp(void)
tmp_alloc_table
=
NULL
;
tmp_alloc_table_size
=
0
;
}
EXPORT
void
dump_smalloc_counts
(
FILE
*
stat_file
)
{
fprintf
(
stat_file
,
"Allocated blocks (grand total): %lu
\n
"
,
no_of_allocated_blocks
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment