Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TP Introduction à la sécurité L2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Oumoul Kiramy Bah
TP Introduction à la sécurité L2
Commits
14eda941
Commit
14eda941
authored
3 years ago
by
Oumoul Kiramy Bah
Browse files
Options
Downloads
Patches
Plain Diff
definition des methodes dans list.c
parent
00b09b74
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/list.c
+50
-3
50 additions, 3 deletions
src/list.c
with
50 additions
and
3 deletions
src/list.c
+
50
−
3
View file @
14eda941
...
...
@@ -17,26 +17,73 @@ int list_is_empty(list_t l){
return
l
==
NULL
;
}
/*list_t list_push(list_t l, void* x){
list_t
list_push
(
list_t
l
,
void
*
x
){
list_t
N
=
malloc
(
sizeof
(
struct
cell_t
));
N
->
val
=
x
;
N
->
next
=
l
;
if
(
list_is_empty
(
l
))
N
->
id
=
1
;
else
N
->
id
=
l
->
id
+
1
;
return
N
;
}
list_t
list_tail
(
list_t
l
){
return
l
->
next
;
}
void
*
list_pop
(
list_t
*
l
){
list_t
tmp
=
(
*
l
)
->
next
;
void
*
v
=
(
*
l
)
->
val
;
free
(
*
l
);
*
l
=
tmp
;
return
v
;
}
void
*
list_top
(
list_t
l
){
return
l
->
val
;
}
void list_destroy(list_t l, void (*free)(void*)){
void
list_destroy
(
list_t
l
,
void
(
*
free_void
)(
void
*
)){
while
(
!
list_is_empty
(
l
))
free_void
(
list_pop
(
&
l
));
}
// return the found element or NULL
void
*
list_in
(
list_t
l
,
void
*
x
,
int
(
*
eq
)(
void
*
,
void
*
)){
if
(
list_is_empty
(
l
))
return
NULL
;
while
(
!
list_is_empty
(
l
)){
if
((
eq
)
(
l
->
val
,
x
))
return
l
->
val
;
else
l
=
l
->
next
;
}
return
NULL
;
}
unsigned
long
int
list_len
(
list_t
l
){
unsigned
long
int
taille
;
if
(
list_is_empty
(
l
))
return
0
;
else
return
l
->
id
;
}
*/
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