From ad6188f911af896c9c77e9215bea3c5c2a4e6cc3 Mon Sep 17 00:00:00 2001 From: Aleksey Veresov Date: Fri, 13 Sep 2019 18:50:34 +0300 Subject: Project name and license are added. Minor changes. --- src/field.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/field.h (limited to 'src/field.h') diff --git a/src/field.h b/src/field.h new file mode 100644 index 0000000..5d4cdb5 --- /dev/null +++ b/src/field.h @@ -0,0 +1,45 @@ +#ifndef MAGI_INCLUDED_FIELD_H +#define MAGI_INCLUDED_FIELD_H + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Form Field + */ +struct magi_field { + char *name; /* name: free(name) is valid. */ + char *data; /* data: free(data) is valid. */ + int len; /* Length of data. */ + struct magi_param_list *params; /* Only used if field is for file. */ +}; + +/* Null is valid "struct magi_field_list *" object. */ +struct magi_field_list { + struct magi_field_list *next; + struct magi_field item; +}; + +/* + * Adds *item to the begining of *list, item and list are dereferencable; + * Returns null in case of error. + */ +int magi_field_list_add( + struct magi_field_list **list, + struct magi_field *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_field *magi_field_list_get( + struct magi_field_list *list, + const char *name +); + +/* + * Destroys list; list is not valid after destruction. + */ +void magi_field_list_destroy(struct magi_field_list *list); + + +#endif -- cgit v1.2.3