summaryrefslogtreecommitdiff
path: root/src/shared.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared.c')
-rw-r--r--src/shared.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/shared.c b/src/shared.c
index c02414b..40732f0 100644
--- a/src/shared.c
+++ b/src/shared.c
@@ -1,3 +1,14 @@
1/**
2 * @file shared.c
3 * @author syxhe (https://t.me/syxhe)
4 * @brief *Implementing `shared.h`*
5 * @version 0.1
6 * @date 2025-06-09
7 *
8 * @copyright Copyright (c) 2025
9 *
10 */
11
1#include "shared.h" 12#include "shared.h"
2 13
3#include <stdlib.h> 14#include <stdlib.h>
@@ -201,7 +212,6 @@ int cleanup_init(cleanup *loc, fcallback callbacks[], void *arguments[], int siz
201 return 0; 212 return 0;
202} 213}
203 214
204// registers if flag is NOT set
205int cleanup_register(cleanup *loc, fcallback cb, void *arg) { 215int cleanup_register(cleanup *loc, fcallback cb, void *arg) {
206 if(!loc || !cb) ERRRET(EINVAL, -1); 216 if(!loc || !cb) ERRRET(EINVAL, -1);
207 if(loc->used >= loc->size || loc->used < 0) ERRRET(ENOMEM, -1); 217 if(loc->used >= loc->size || loc->used < 0) ERRRET(ENOMEM, -1);
@@ -213,6 +223,7 @@ int cleanup_register(cleanup *loc, fcallback cb, void *arg) {
213 return 0; 223 return 0;
214} 224}
215 225
226// registers if flag is NOT set
216int cleanup_cndregister(cleanup *loc, fcallback cb, void *arg, unsigned char flag) { 227int cleanup_cndregister(cleanup *loc, fcallback cb, void *arg, unsigned char flag) {
217 if(flag) return 0; 228 if(flag) return 0;
218 return cleanup_register(loc, cb, arg); 229 return cleanup_register(loc, cb, arg);