X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Flibpspp%2Fabt.h;h=f97d957e5251c70aeb55190f4b313b6eefea0799;hb=af81cedbd19fc8a129acf19fb74815ca28c700f1;hp=0e5b25281e0ec5b94ad43a581f97d7a37f25f88a;hpb=5afa4c0d579f1ebff37b638a30ea397d58aca5f8;p=pspp diff --git a/src/libpspp/abt.h b/src/libpspp/abt.h index 0e5b25281e..f97d957e52 100644 --- a/src/libpspp/abt.h +++ b/src/libpspp/abt.h @@ -145,6 +145,7 @@ code and links to other resources, such as the original AA tree paper. */ +#include #include #include "libpspp/cast.h" @@ -186,6 +187,8 @@ struct abt void abt_init (struct abt *, abt_compare_func *, abt_reaugment_func *, const void *aux); +static inline bool abt_is_empty (const struct abt *); + struct abt_node *abt_insert (struct abt *, struct abt_node *); void abt_insert_after (struct abt *, const struct abt_node *, struct abt_node *); @@ -203,4 +206,12 @@ void abt_reaugmented (const struct abt *, struct abt_node *); struct abt_node *abt_changed (struct abt *, struct abt_node *); void abt_moved (struct abt *, struct abt_node *); +/* Returns true if ABT contains no nodes, false if ABT contains at least one + node. */ +static inline bool +abt_is_empty (const struct abt *abt) +{ + return abt->root == NULL; +} + #endif /* libpspp/abt.h */