aboutsummaryrefslogtreecommitdiff
path: root/src/param.h
diff options
context:
space:
mode:
authorAleksey Veresov <aleksey@veresov.pro>2019-09-13 18:50:34 +0300
committerAleksey Veresov <aleksey@veresov.pro>2019-09-13 18:50:34 +0300
commitad6188f911af896c9c77e9215bea3c5c2a4e6cc3 (patch)
tree158b4015ff302f72fe2bb8a0ee3d5441ffb66719 /src/param.h
downloadmagi-ad6188f911af896c9c77e9215bea3c5c2a4e6cc3.tar
magi-ad6188f911af896c9c77e9215bea3c5c2a4e6cc3.tar.xz
magi-ad6188f911af896c9c77e9215bea3c5c2a4e6cc3.zip
Project name and license are added. Minor changes.
Diffstat (limited to 'src/param.h')
-rw-r--r--src/param.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/param.h b/src/param.h
new file mode 100644
index 0000000..31b787a
--- /dev/null
+++ b/src/param.h
@@ -0,0 +1,43 @@
+#ifndef MAGI_INCLUDED_PARAM_H
+#define MAGI_INCLUDED_PARAM_H
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Parameter
+ */
+struct magi_param {
+ char *name; /* name: free(name) is valid. */
+ char *data; /* data: free(data) is valid. */
+};
+
+/* Null is valid "struct magi_param_list *" object. */
+struct magi_param_list {
+ struct magi_param_list *next;
+ struct magi_param item;
+};
+
+/*
+ * Adds *item to the begining of *list, item and list are dereferencable;
+ * Returns null in case of error.
+ */
+int magi_param_list_add(
+ struct magi_param_list **list,
+ struct magi_param *item
+);
+
+/*
+ * Searchs for first node in list: node.name == name, name is C-string;
+ * Returns node itself if succeed, otherwise result is null.
+ */
+struct magi_param *magi_param_list_get(
+ struct magi_param_list *list,
+ const char *name
+);
+
+/*
+ * Destroys list; list is not valid after destruction.
+ */
+void magi_param_list_destroy(struct magi_param_list *list);
+
+
+#endif