Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
6
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
C
crowbx
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
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
Jacob Vosmaer
crowbx
Commits
fa3be74a
Commit
fa3be74a
authored
Apr 27, 2020
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use bool return type for list predicates
parent
f72b6993
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
list.c
list.c
+2
-2
list.h
list.h
+3
-2
No files found.
list.c
View file @
fa3be74a
...
...
@@ -53,8 +53,8 @@ uint8_t l_last(struct list *l) {
}
void
l_flush
(
struct
list
*
l
)
{
l
->
len
=
0
;
}
uint8_t
l_empty
(
struct
list
*
l
)
{
return
l
->
len
==
0
;
}
uint8_t
l_contains
(
struct
list
*
l
,
uint8_t
x
)
{
return
l_index
(
l
,
x
)
<
l
->
sup
;
}
bool
l_empty
(
struct
list
*
l
)
{
return
l
->
len
==
0
;
}
bool
l_contains
(
struct
list
*
l
,
uint8_t
x
)
{
return
l_index
(
l
,
x
)
<
l
->
sup
;
}
uint8_t
l_index
(
struct
list
*
l
,
uint8_t
x
)
{
for
(
uint8_t
i
=
0
;
i
<
l
->
len
;
i
++
)
{
...
...
list.h
View file @
fa3be74a
...
...
@@ -2,6 +2,7 @@
#define LIST_H
#include <stdint.h>
#include <stdbool.h>
struct
list
{
uint8_t
len
;
...
...
@@ -23,8 +24,8 @@ void l_delete(struct list *l, uint8_t x);
uint8_t
l_first
(
struct
list
*
l
);
uint8_t
l_last
(
struct
list
*
l
);
void
l_flush
(
struct
list
*
l
);
uint8_t
l_empty
(
struct
list
*
l
);
uint8_t
l_contains
(
struct
list
*
l
,
uint8_t
x
);
bool
l_empty
(
struct
list
*
l
);
bool
l_contains
(
struct
list
*
l
,
uint8_t
x
);
uint8_t
l_index
(
struct
list
*
l
,
uint8_t
x
);
uint8_t
l_popr
(
struct
list
*
l
);
...
...
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