Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
4b9c6310
Commit
4b9c6310
authored
May 18, 2006
by
osku
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ib_list_create_heap().
parent
448636a7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
1 deletion
+37
-1
include/ut0list.h
include/ut0list.h
+15
-1
ut/ut0list.c
ut/ut0list.c
+22
-0
No files found.
include/ut0list.h
View file @
4b9c6310
...
...
@@ -29,13 +29,25 @@ typedef struct ib_list_node_struct ib_list_node_t;
typedef
struct
ib_list_helper_struct
ib_list_helper_t
;
/********************************************************************
Create a new list. */
Create a new list using mem_alloc. Lists created with this function must be
freed with ib_list_free. */
ib_list_t
*
ib_list_create
(
void
);
/*=================*/
/* out: list */
/********************************************************************
Create a new list using the given heap. ib_list_free MUST NOT BE CALLED for
lists created with this function. */
ib_list_t
*
ib_list_create_heap
(
/*================*/
/* out: list */
mem_heap_t
*
heap
);
/* in: memory heap to use */
/********************************************************************
Free a list. */
...
...
@@ -110,6 +122,8 @@ ib_list_get_last(
struct
ib_list_struct
{
ib_list_node_t
*
first
;
/* first node */
ib_list_node_t
*
last
;
/* last node */
ibool
is_heap_list
;
/* TRUE if this list was
allocated through a heap */
};
/* A list node. */
...
...
ut/ut0list.c
View file @
4b9c6310
...
...
@@ -15,6 +15,26 @@ ib_list_create(void)
list
->
first
=
NULL
;
list
->
last
=
NULL
;
list
->
is_heap_list
=
FALSE
;
return
(
list
);
}
/********************************************************************
Create a new list using the given heap. ib_list_free MUST NOT BE CALLED for
lists created with this function. */
ib_list_t
*
ib_list_create_heap
(
/*================*/
/* out: list */
mem_heap_t
*
heap
)
/* in: memory heap to use */
{
ib_list_t
*
list
=
mem_heap_alloc
(
heap
,
sizeof
(
ib_list_t
));
list
->
first
=
NULL
;
list
->
last
=
NULL
;
list
->
is_heap_list
=
TRUE
;
return
(
list
);
}
...
...
@@ -27,6 +47,8 @@ ib_list_free(
/*=========*/
ib_list_t
*
list
)
/* in: list */
{
ut_a
(
!
list
->
is_heap_list
);
/* We don't check that the list is empty because it's entirely valid
to e.g. have all the nodes allocated from a single heap that is then
freed after the list itself is freed. */
...
...
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