1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-02 15:53:12 +02:00

core: add function hdata_count

This commit is contained in:
Sébastien Helleu
2024-06-11 10:15:03 +02:00
parent 24e023d467
commit 8945b7bf33
3 changed files with 37 additions and 0 deletions
+21
View File
@@ -656,6 +656,27 @@ end:
return ret_pointer;
}
/*
* Returns number of item in this hdata, starting at "pointer".
*/
int
hdata_count (struct t_hdata *hdata, void *pointer)
{
int count;
if (!hdata || !pointer)
return 0;
count = 0;
while (pointer)
{
count++;
pointer = hdata_move (hdata, pointer, 1);
}
return count;
}
/*
* Extracts index from name of a variable.
*
+1
View File
@@ -122,6 +122,7 @@ extern void *hdata_search (struct t_hdata *hdata, void *pointer,
const char *search, struct t_hashtable *pointers,
struct t_hashtable *extra_vars,
struct t_hashtable *options, int move);
extern int hdata_count (struct t_hdata *hdata, void *pointer);
extern void hdata_get_index_and_name (const char *name, int *index,
const char **ptr_name);
extern char hdata_char (struct t_hdata *hdata, void *pointer,