diff options
Diffstat (limited to 'include/asterisk')
-rw-r--r-- | include/asterisk/calendar.h | 1 | ||||
-rw-r--r-- | include/asterisk/vector.h | 54 |
2 files changed, 54 insertions, 1 deletions
diff --git a/include/asterisk/calendar.h b/include/asterisk/calendar.h index da4af01ef..e9dcd8809 100644 --- a/include/asterisk/calendar.h +++ b/include/asterisk/calendar.h @@ -129,6 +129,7 @@ struct ast_calendar { int autoreminder; /*!< If set, override any calendar_tech specific notification times and use this time (in mins) */ int notify_waittime; /*!< Maxiumum time to allow for a notification attempt */ int refresh; /*!< When to refresh the calendar events */ + int fetch_again_at_reload; /*!< To reload the calendar content when the module is reloaded */ int timeframe; /*!< Span (in mins) of calendar data to pull with each request */ pthread_t thread; /*!< The thread that the calendar is loaded/updated in */ ast_cond_t unload; diff --git a/include/asterisk/vector.h b/include/asterisk/vector.h index be9091272..c74f0a89b 100644 --- a/include/asterisk/vector.h +++ b/include/asterisk/vector.h @@ -354,6 +354,32 @@ AST_VECTOR_REMOVE(vec, idx, 1) /*! + * \brief Remove all elements from a vector that matches the given comparison + * + * \param vec Vector to remove from. + * \param value Value to pass into comparator. + * \param cmp Comparator function/macros (called as \c cmp(elem, value)) + * \param cleanup How to cleanup a removed element macro/function. + * + * \return the number of deleted elements. + */ +#define AST_VECTOR_REMOVE_ALL_CMP_UNORDERED(vec, value, cmp, cleanup) ({ \ + int count = 0; \ + size_t idx; \ + typeof(value) __value = (value); \ + for (idx = 0; idx < (vec)->current; ) { \ + if (cmp((vec)->elems[idx], __value)) { \ + cleanup((vec)->elems[idx]); \ + AST_VECTOR_REMOVE_UNORDERED((vec), idx); \ + ++count; \ + } else { \ + ++idx; \ + } \ + } \ + count; \ +}) + +/*! * \brief Remove an element from a vector that matches the given comparison * * \param vec Vector to remove from. @@ -380,6 +406,32 @@ }) /*! + * \brief Remove all elements from a vector that matches the given comparison while maintaining order + * + * \param vec Vector to remove from. + * \param value Value to pass into comparator. + * \param cmp Comparator function/macros (called as \c cmp(elem, value)) + * \param cleanup How to cleanup a removed element macro/function. + * + * \return the number of deleted elements. + */ +#define AST_VECTOR_REMOVE_ALL_CMP_ORDERED(vec, value, cmp, cleanup) ({ \ + int count = 0; \ + size_t idx; \ + typeof(value) __value = (value); \ + for (idx = 0; idx < (vec)->current; ) { \ + if (cmp((vec)->elems[idx], __value)) { \ + cleanup((vec)->elems[idx]); \ + AST_VECTOR_REMOVE_ORDERED((vec), idx); \ + ++count; \ + } else { \ + ++idx; \ + } \ + } \ + count; \ +}) + +/*! * \brief Remove an element from a vector that matches the given comparison while maintaining order * * \param vec Vector to remove from. @@ -397,7 +449,7 @@ for (idx = 0; idx < (vec)->current; ++idx) { \ if (cmp((vec)->elems[idx], __value)) { \ cleanup((vec)->elems[idx]); \ - AST_VECTOR_REMOVE_ORDERED((vec), idx); \ + AST_VECTOR_REMOVE_ORDERED((vec), idx); \ res = 0; \ break; \ } \ |