Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SeFHT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
josc941e
SeFHT
Commits
d384d160
Commit
d384d160
authored
2 years ago
by
Jonathan Schöbel
Browse files
Options
Downloads
Patches
Plain Diff
add Validator to Data
Data takes hold of the appropiate Validator.
parent
7c9a245e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/data.c
+28
-0
28 additions, 0 deletions
src/data.c
src/data.h
+3
-0
3 additions, 0 deletions
src/data.h
with
31 additions
and
0 deletions
src/data.c
+
28
−
0
View file @
d384d160
...
...
@@ -23,6 +23,7 @@
#include
<errno.h>
#include
<stdbool.h>
#include
<stdlib.h>
#include
<string.h>
...
...
@@ -30,10 +31,14 @@
#include
"error.h"
#include
"log.h"
#include
"validator.h"
#include
"data.h"
static
inline
bool
init_validator
(
struct
SH_Data
*
data
,
struct
SH_Error
*
error
);
static
inline
void
init_pages
(
struct
SH_Data
*
data
);
struct
SH_Data
*
...
...
@@ -54,6 +59,7 @@ SH_Data_new (struct SH_Error * error)
return
NULL
;
}
if
(
!
init_validator
(
data
,
error
))
return
NULL
;
init_pages
(
data
);
if
(
error
!=
NULL
)
...
...
@@ -64,11 +70,13 @@ SH_Data_new (struct SH_Error * error)
return
data
;
}
static
inline
void
free_validator
(
struct
SH_Data
*
data
);
static
inline
void
free_pages
(
struct
SH_Data
*
data
);
void
SH_Data_free
(
struct
SH_Data
*
data
,
struct
SH_Error
*
error
)
{
free_validator
(
data
);
free_pages
(
data
);
free
(
data
);
...
...
@@ -81,6 +89,26 @@ SH_Data_free (struct SH_Data * data, struct SH_Error * error)
return
;
}
static
inline
bool
init_validator
(
struct
SH_Data
*
data
,
struct
SH_Error
*
error
)
{
data
->
validator
=
SH_Validator_new
(
error
);
if
(
data
->
validator
==
NULL
)
{
return
FALSE
;
}
return
TRUE
;
}
static
inline
void
free_validator
(
struct
SH_Data
*
data
)
{
SH_Validator_free
(
data
->
validator
,
NULL
);
return
;
}
static
inline
void
init_pages
(
struct
SH_Data
*
data
)
{
...
...
This diff is collapsed.
Click to expand it.
src/data.h
+
3
−
0
View file @
d384d160
...
...
@@ -29,6 +29,8 @@
#include
"error.h"
#include
"validator.h"
typedef
unsigned
int
page_t
;
#define PAGE_ERR 0
...
...
@@ -44,6 +46,7 @@ struct SH_Page
struct
SH_Data
{
struct
SH_Validator
*
validator
;
unsigned
int
page_n
;
struct
SH_Page
*
pages
;
page_t
last_page
;
...
...
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