refactor: started lnm library
All checks were successful
ci/woodpecker/push/build Pipeline was successful
All checks were successful
ci/woodpecker/push/build Pipeline was successful
This commit is contained in:
parent
1587b923c1
commit
20b6b593eb
7 changed files with 237 additions and 0 deletions
5
lnm/src/_include/lnm/loop_internal.h
Normal file
5
lnm/src/_include/lnm/loop_internal.h
Normal 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
1
lnm/src/loop/lnm_loop.c
Normal file
|
|
@ -0,0 +1 @@
|
|||
#include "lnm/loop.h"
|
||||
22
lnm/src/loop/lnm_loop_conn.c
Normal file
22
lnm/src/loop/lnm_loop_conn.c
Normal 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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue