summaryrefslogtreecommitdiff
path: root/include/ouroboros/utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/ouroboros/utils.h')
-rw-r--r--include/ouroboros/utils.h24
1 files changed, 17 insertions, 7 deletions
diff --git a/include/ouroboros/utils.h b/include/ouroboros/utils.h
index de69bc94..93fbf402 100644
--- a/include/ouroboros/utils.h
+++ b/include/ouroboros/utils.h
@@ -1,10 +1,10 @@
/*
- * Ouroboros - Copyright (C) 2016 - 2020
+ * Ouroboros - Copyright (C) 2016 - 2024
*
* Handy utilities
*
- * Dimitri Staessens <dimitri.staessens@ugent.be>
- * Sander Vrijders <sander.vrijders@ugent.be>
+ * Dimitri Staessens <dimitri@ouroboros.rocks>
+ * Sander Vrijders <sander@ouroboros.rocks>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -20,15 +20,18 @@
* Foundation, Inc., http://www.fsf.org/about/contact/.
*/
-#ifndef OUROBOROS_UTILS_H
-#define OUROBOROS_UTILS_H
+#ifndef OUROBOROS_LIB_UTILS_H
+#define OUROBOROS_LIB_UTILS_H
#include <stdint.h>
#include <unistd.h>
+#include <string.h>
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define ABS(a) ((a) > 0 ? (a) : -(a))
+#define clrbuf(buf) do { memset(&(buf), 0, sizeof(buf)); } while (0);
+#define freebuf(buf) do { free((buf).data); clrbuf(buf); } while (0);
typedef struct {
uint8_t * data;
@@ -42,7 +45,14 @@ typedef struct {
int n_digits(unsigned i);
/* gets the application name */
-char * path_strip(char * src);
+char * path_strip(const char * src);
+
+/* functions for copying and destroying arguments list */
+size_t argvlen(const char ** argv);
+
+char ** argvdup(char ** argv);
+
+void argvfree(char ** argv);
/* destroy a ** */
#define freepp(type, ptr, len) \
@@ -54,4 +64,4 @@ char * path_strip(char * src);
free(ptr); \
} while (0);
-#endif /* OUROBOROS_UTILS_H */
+#endif /* OUROBOROS_LIB_UTILS_H */