aboutsummaryrefslogtreecommitdiffstats
path: root/src/locate.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-24 15:56:30 +0100
committerMax Kellermann <max@duempel.org>2009-01-24 15:56:30 +0100
commitba7c9962663d2e80a6320ca097c06a0849218d27 (patch)
tree797807ad8df6a95b967945299e2160465e0df6f9 /src/locate.h
parente1001491240f5925d5f75673552e297c3244e107 (diff)
downloadmpd-ba7c9962663d2e80a6320ca097c06a0849218d27.tar.gz
mpd-ba7c9962663d2e80a6320ca097c06a0849218d27.tar.xz
mpd-ba7c9962663d2e80a6320ca097c06a0849218d27.zip
locate: added struct locate_item_list
Instead of passing two parameters around (number of items, array of items), combine both in a variable size struct.
Diffstat (limited to 'src/locate.h')
-rw-r--r--src/locate.h24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/locate.h b/src/locate.h
index 7442cb3a3..d0083a426 100644
--- a/src/locate.h
+++ b/src/locate.h
@@ -34,6 +34,17 @@ struct locate_item {
char *needle;
};
+/**
+ * An array of struct locate_item objects.
+ */
+struct locate_item_list {
+ /** number of items */
+ unsigned length;
+
+ /** this is a variable length array */
+ struct locate_item items[1];
+};
+
int
locate_parse_type(const char *str);
@@ -41,12 +52,19 @@ locate_parse_type(const char *str);
struct locate_item *
locate_item_new(const char *type_string, const char *needle);
+/**
+ * Allocates a new struct locate_item_list, and initializes all
+ * members with zero bytes.
+ */
+struct locate_item_list *
+locate_item_list_new(unsigned length);
+
/* return number of items or -1 on error */
-int
-locate_item_list_parse(char *argv[], int argc, struct locate_item **arrayRet);
+struct locate_item_list *
+locate_item_list_parse(char *argv[], int argc);
void
-locate_item_list_free(int count, struct locate_item *array);
+locate_item_list_free(struct locate_item_list *list);
void
locate_item_free(struct locate_item *item);