X-Git-Url: https://git.deb.at/w?a=blobdiff_plain;f=database.c;h=138b7f356abf18d1287a4480e025e3459986d27f;hb=7d7ae6aab5fb6307328b7cfb193ebce3e2870624;hp=bd8877164e61675b85f3d3b4ca3749797d212ed6;hpb=f5a6c419271623d4e30d257e4bfde1b0b6d0fb79;p=pkg%2Fabook.git diff --git a/database.c b/database.c index bd88771..138b7f3 100644 --- a/database.c +++ b/database.c @@ -26,9 +26,10 @@ abook_field_list *fields_list = NULL; int fields_count = 0; list_item *database = NULL; -int items = 0; +static int items = 0; #define ITEM_SIZE (fields_count * sizeof(char *)) +#define LAST_ITEM (items - 1) #define INITIAL_LIST_CAPACITY 30 static int list_capacity = 0; @@ -660,6 +661,17 @@ is_valid_item(int item) return item <= LAST_ITEM && item >= 0; } +int +last_item() +{ + return LAST_ITEM; +} + +int +db_n_items() +{ + return items; +} int real_db_enumerate_items(struct db_enumerator e)