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:
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user