Skip to content

Commit 6c98a43

Browse files
committed
more fun with DALI_ENFORCE
Signed-off-by: Krzysztof Lecki <[email protected]>
1 parent dabd0ee commit 6c98a43

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

dali/c_api/c_api.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ int PopCurrBatchSize(batch_size_map_t *batch_size_map, int max_batch_size,
9797
*/
9898
dali::InputOperatorNoCopyMode GetExternalSourceCopyMode(unsigned int flags) {
9999
dali::InputOperatorNoCopyMode no_copy_mode = dali::InputOperatorNoCopyMode::DEFAULT;
100-
DALI_ENFORCE(!((flags & DALI_ext_force_copy) && (flags & DALI_ext_force_no_copy)),
100+
dali::DALI_ENFORCE(!((flags & DALI_ext_force_copy) && (flags & DALI_ext_force_no_copy)),
101101
"External Source cannot be forced to use DALI_ext_force_copy and "
102102
"DALI_ext_force_no_copy at the same time.");
103103
if (flags & DALI_ext_force_copy) {
@@ -722,7 +722,7 @@ void daliLoadLibrary(const char* lib_path) {
722722

723723
void daliGetReaderMetadata(daliPipelineHandle_t pipe_handle, const char *reader_name,
724724
daliReaderMetadata* meta) {
725-
DALI_ENFORCE(meta, "Provided pointer to meta cannot be NULL.");
725+
dali::DALI_ENFORCE(meta, "Provided pointer to meta cannot be NULL.");
726726
dali::Pipeline* pipeline = (*pipe_handle)->pipeline.get();
727727
dali::ReaderMeta returned_meta = pipeline->GetReaderMeta(reader_name);
728728
meta->epoch_size = returned_meta.epoch_size;
@@ -827,7 +827,7 @@ void daliGetSerializedCheckpoint(
827827
daliPipelineHandle_t pipe_handle,
828828
const daliExternalContextCheckpoint *external_context,
829829
char **checkpoint, size_t *n) {
830-
DALI_ENFORCE(external_context, "Provided pointer to external context cannot be NULL.");
830+
dali::DALI_ENFORCE(external_context, "Provided pointer to external context cannot be NULL.");
831831
auto &pipeline = (*pipe_handle)->pipeline;
832832
dali::ExternalContextCheckpoint ctx{};
833833
if (external_context->pipeline_data.data) {
@@ -845,7 +845,7 @@ void daliGetSerializedCheckpoint(
845845
std::string cpt = pipeline->SerializedCheckpoint(ctx);
846846
*n = cpt.size();
847847
*checkpoint = reinterpret_cast<char *>(daliAlloc(cpt.size()));
848-
DALI_ENFORCE(*checkpoint, "Failed to allocate memory");
848+
dali::DALI_ENFORCE(*checkpoint, "Failed to allocate memory");
849849
memcpy(*checkpoint, cpt.c_str(), *n);
850850
}
851851

@@ -862,7 +862,7 @@ void daliRestoreFromSerializedCheckpoint(
862862
daliPipelineHandle *pipe_handle,
863863
const char *checkpoint, size_t n,
864864
daliExternalContextCheckpoint *external_context) {
865-
DALI_ENFORCE(external_context != nullptr,
865+
dali::DALI_ENFORCE(external_context != nullptr,
866866
"Null external context provided.");
867867
auto &pipeline = (*pipe_handle)->pipeline;
868868
auto ctx = pipeline->RestoreFromSerializedCheckpoint({checkpoint, n});

include/dali/core/error_handling.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ inline dali::string GetStacktrace() {
231231
// #define DALI_ENFORCE(...) GET_MACRO(__VA_ARGS__, ENFRC_2, ENFRC_1)(__VA_ARGS__)
232232

233233
template <typename T>
234-
void DALI_ENFORCE(T condition, const std::string &error_string = "",
234+
void DALI_ENFORCE(const T &condition, const std::string &error_string = "",
235235
source_location loc = source_location::current()) {
236236
if (!condition) {
237237
throw DALIException(error_string, make_string("[", loc.source_file(), ":", loc.line(), "]"),

0 commit comments

Comments
 (0)