LOC_DATABASE_NEW(3)

NAME
loc_database_new - Create a new libloc context

SYNOPSIS

#include <libloc/libloc.h>
#include <libloc/database.h>

struct loc_database;

int loc_database_new(struct loc_ctx* ctx, struct loc_database** database, FILE* f);

Reference Counting:

struct loc_database* loc_database_ref(struct loc_database* db);

struct loc_database* loc_database_unref(struct loc_database* db);

Access some data:

time_t loc_database_created_at(struct loc_database* db);

const char* loc_database_get_vendor(struct loc_database* db);

const char* loc_database_get_description(struct loc_database* db);

const char* loc_database_get_license(struct loc_database* db);

DESCRIPTION

loc_database_new() opens a new database from the given file descriptor. The file descriptor can be closed after this operation because the function is creating its own copy.

If the database could be opened successfully, zero is returned. Otherwise a non-zero return code will indicate an error and errno will be set appropriately.

Various meta-data about the database can be retrieved with loc_database_created_at(), loc_database_get_vendor(), loc_database_get_description(), and loc_database_get_license().

SEE ALSO

libloc(3)

AUTHORS

Michael Tremer