refactor: started lnm library
All checks were successful
ci/woodpecker/push/build Pipeline was successful

This commit is contained in:
Jef Roosens 2023-11-21 09:36:58 +01:00
parent 1587b923c1
commit 20b6b593eb
Signed by: Jef Roosens
GPG key ID: B75D4F293C7052DB
7 changed files with 237 additions and 0 deletions

View file

@ -0,0 +1,5 @@
#include "lnm/loop.h"
lnm_err lnm_loop_conn_init(lnm_loop_conn **out, lnm_loop *l);
void lnm_loop_conn_free(lnm_loop *l, lnm_loop_conn *conn);

1
lnm/src/loop/lnm_loop.c Normal file
View file

@ -0,0 +1 @@
#include "lnm/loop.h"

View file

@ -0,0 +1,22 @@
#include "lnm/loop_internal.h"
lnm_err lnm_loop_conn_init(lnm_loop_conn **out, lnm_loop *l) {
lnm_loop_conn *conn = calloc(1, sizeof(lnm_loop_conn));
if (conn == NULL) {
return lnm_err_failed_alloc;
}
void *ctx;
LNM_RES2(l->ctx_init(&ctx, l->gctx), free(conn));
conn->ctx = ctx;
*out = conn;
return lnm_err_ok;
}
void lnm_loop_conn_free(lnm_loop *l, lnm_loop_conn *conn) {
l->ctx_free(conn->ctx);
free(conn);
}