LOC_DATABASE_NEW(3)

✨ NAME ✨

loc_database_new β€” Create a new libloc context (bestie, it's giving database energy πŸ’…)


🌸 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 πŸ’–

okay so loc_database_new() opens a brand new database from the file descriptor you hand it. and bestie, the file descriptor can be closed right after this operation because the function is literally making its own copy. no cap. 🫢

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. so if something goes sideways, check that errno β€” it's giving error-handling realness. 😭

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(). lowkey obsessed with how many getters there are. πŸ’…


πŸŽ€ SEE ALSO πŸŽ€

libloc(3)


πŸ‘‘ AUTHORS πŸ‘‘

Michael Tremer


and that's the tea, bestie! πŸ’– LOC_DATABASE_NEW(3) out β€” slay and read your manuals responsibly. βœ¨πŸŽ€

πŸ“¦ where this page comes from