diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-03 13:39:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-03 13:39:28 +0000 |
commit | 924f5ea83e48277e014ebf0d19a27187cb93e2f7 (patch) | |
tree | 75920a275bba045f6d108204562c218a9a26ea15 /include/crm/common/results_internal.h | |
parent | Adding upstream version 2.1.7. (diff) | |
download | pacemaker-924f5ea83e48277e014ebf0d19a27187cb93e2f7.tar.xz pacemaker-924f5ea83e48277e014ebf0d19a27187cb93e2f7.zip |
Adding upstream version 2.1.8~rc1.upstream/2.1.8_rc1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'include/crm/common/results_internal.h')
-rw-r--r-- | include/crm/common/results_internal.h | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/include/crm/common/results_internal.h b/include/crm/common/results_internal.h index 09907e9..c2a3f60 100644 --- a/include/crm/common/results_internal.h +++ b/include/crm/common/results_internal.h @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 the Pacemaker project contributors + * Copyright 2020-2024 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -12,13 +12,26 @@ #include <glib.h> // GQuark -// Generic result code type +extern const size_t pcmk__n_rc; int pcmk__result_bounds(enum pcmk_result_type, int *lower, int *upper); -// Standard Pacemaker API return codes - -extern const size_t pcmk__n_rc; +/*! + * \internal + * \brief Abort without dumping core if a pointer is \c NULL + * + * This is intended to check for memory allocation failure, rather than for null + * pointers in general. + * + * \param[in] ptr Pointer to check + */ +#define pcmk__mem_assert(ptr) do { \ + if ((ptr) == NULL) { \ + crm_abort(__FILE__, __func__, __LINE__, "Out of memory", FALSE, \ + TRUE); \ + crm_exit(CRM_EX_OSERR); \ + } \ + } while (0) /* Error domains for use with g_set_error */ |