Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pikelang
pike
Commits
cb694782
Commit
cb694782
authored
Feb 24, 2014
by
Arne Goedeke
Browse files
Options
Downloads
Patches
Plain Diff
allocator: add some function attributes
parent
44b03690
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/stack_allocator.c
+1
-0
1 addition, 0 deletions
src/stack_allocator.c
src/stack_allocator.h
+3
-0
3 additions, 0 deletions
src/stack_allocator.h
with
4 additions
and
0 deletions
src/stack_allocator.c
+
1
−
0
View file @
cb694782
#include
"stack_allocator.h"
#include
"stack_allocator.h"
MALLOC_FUNCTION
static
struct
chunk
*
alloc_chunk
(
size_t
size
)
{
static
struct
chunk
*
alloc_chunk
(
size_t
size
)
{
struct
chunk
*
c
=
(
struct
chunk
*
)
xalloc
(
sizeof
(
struct
chunk
)
+
size
);
struct
chunk
*
c
=
(
struct
chunk
*
)
xalloc
(
sizeof
(
struct
chunk
)
+
size
);
c
->
data
=
c
->
top
=
c
+
1
;
c
->
data
=
c
->
top
=
c
+
1
;
...
...
This diff is collapsed.
Click to expand it.
src/stack_allocator.h
+
3
−
0
View file @
cb694782
#include
"global.h"
#include
"global.h"
#include
"pike_memory.h"
struct
stack_allocator
{
struct
stack_allocator
{
struct
chunk
*
cur
;
struct
chunk
*
cur
;
...
@@ -31,6 +32,7 @@ static INLINE void sa_alloc_enlarge(struct stack_allocator * a, size_t size) {
...
@@ -31,6 +32,7 @@ static INLINE void sa_alloc_enlarge(struct stack_allocator * a, size_t size) {
stack_alloc_enlarge
(
a
,
size
);
stack_alloc_enlarge
(
a
,
size
);
}
}
MALLOC_FUNCTION
static
INLINE
void
*
sa_alloc_fast
(
struct
stack_allocator
*
a
,
size_t
size
)
{
static
INLINE
void
*
sa_alloc_fast
(
struct
stack_allocator
*
a
,
size_t
size
)
{
struct
chunk
*
c
=
a
->
cur
;
struct
chunk
*
c
=
a
->
cur
;
void
*
ret
=
c
->
top
;
void
*
ret
=
c
->
top
;
...
@@ -38,6 +40,7 @@ static INLINE void * sa_alloc_fast(struct stack_allocator * a, size_t size) {
...
@@ -38,6 +40,7 @@ static INLINE void * sa_alloc_fast(struct stack_allocator * a, size_t size) {
return
ret
;
return
ret
;
}
}
MALLOC_FUNCTION
static
INLINE
void
*
sa_alloc
(
struct
stack_allocator
*
a
,
size_t
size
)
{
static
INLINE
void
*
sa_alloc
(
struct
stack_allocator
*
a
,
size_t
size
)
{
sa_alloc_enlarge
(
a
,
size
);
sa_alloc_enlarge
(
a
,
size
);
return
sa_alloc_fast
(
a
,
size
);
return
sa_alloc_fast
(
a
,
size
);
...
...
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