Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libloc
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
libloc
Commits
35bb3a32
Commit
35bb3a32
authored
Oct 02, 2019
by
Michael Tremer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libloc: Add function to set country code to database enumerator
Signed-off-by:
Michael Tremer
<
michael.tremer@ipfire.org
>
parent
2538ed9a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
0 deletions
+21
-0
src/database.c
src/database.c
+19
-0
src/libloc.sym
src/libloc.sym
+1
-0
src/loc/database.h
src/loc/database.h
+1
-0
No files found.
src/database.c
View file @
35bb3a32
...
...
@@ -69,6 +69,7 @@ struct loc_database_enumerator {
// Search string
char
*
string
;
char
country_code
[
3
];
// Index of the AS we are looking at
unsigned
int
as_index
;
...
...
@@ -610,6 +611,24 @@ LOC_EXPORT int loc_database_enumerator_set_string(struct loc_database_enumerator
return
0
;
}
LOC_EXPORT
int
loc_database_enumerator_set_country_code
(
struct
loc_database_enumerator
*
enumerator
,
const
char
*
country_code
)
{
// Set empty country code
if
(
!
country_code
||
!*
country_code
)
{
*
enumerator
->
country_code
=
'\0'
;
return
0
;
}
// Country codes must be two characters
if
(
strlen
(
country_code
)
!=
2
)
return
-
EINVAL
;
for
(
unsigned
int
i
=
0
;
i
<
3
;
i
++
)
{
enumerator
->
country_code
[
i
]
=
country_code
[
i
];
}
return
0
;
}
LOC_EXPORT
struct
loc_as
*
loc_database_enumerator_next_as
(
struct
loc_database_enumerator
*
enumerator
)
{
struct
loc_database
*
db
=
enumerator
->
db
;
struct
loc_as
*
as
;
...
...
src/libloc.sym
View file @
35bb3a32
...
...
@@ -54,6 +54,7 @@ global:
loc_database_enumerator_new;
loc_database_enumerator_next_as;
loc_database_enumerator_ref;
loc_database_enumerator_set_country_code;
loc_database_enumerator_set_string;
loc_database_enumerator_unref;
...
...
src/loc/database.h
View file @
35bb3a32
...
...
@@ -49,6 +49,7 @@ struct loc_database_enumerator* loc_database_enumerator_ref(struct loc_database_
struct
loc_database_enumerator
*
loc_database_enumerator_unref
(
struct
loc_database_enumerator
*
enumerator
);
int
loc_database_enumerator_set_string
(
struct
loc_database_enumerator
*
enumerator
,
const
char
*
string
);
int
loc_database_enumerator_set_country_code
(
struct
loc_database_enumerator
*
enumerator
,
const
char
*
country_code
);
struct
loc_as
*
loc_database_enumerator_next_as
(
struct
loc_database_enumerator
*
enumerator
);
#endif
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