lab.nexedi.com will be down from Thursday, 20 March 2025, 07:30:00 UTC for a duration of approximately 2 hours

Commit 201bfcd9 authored by Stefan Schantl's avatar Stefan Schantl Committed by Michael Tremer

perl: Add get_country_name() function.

This function can be used to get the stored name for a given country
code.
Signed-off-by: default avatarStefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: default avatarMichael Tremer <michael.tremer@ipfire.org>
parent 5d902be8
......@@ -243,6 +243,28 @@ lookup_asn(db, address)
#
# Get functions
#
SV*
get_country_name(db, ccode)
struct loc_database* db;
char* ccode;
CODE:
RETVAL = &PL_sv_undef;
// Lookup country code
struct loc_country *country;
int err = loc_database_get_country(db, &country, ccode);
if(!err) {
// Extract the name for the given country code.
const char* country_name = loc_country_get_name(country);
RETVAL = newSVpv(country_name, strlen(country_name));
loc_country_unref(country);
}
OUTPUT:
RETVAL
SV*
get_continent_code(db, ccode)
struct loc_database* db;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment