Skip to content

Commit

Permalink
Use internal includes for assertFailed, so it can be included more po…
Browse files Browse the repository at this point in the history
…rtably.
  • Loading branch information
vkoskiv committed Jan 28, 2020
1 parent ff5f285 commit a49fdce
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
16 changes: 16 additions & 0 deletions src/utils/assert.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// assert.c
// C-ray
//
// Created by Valtteri on 28.1.2020.
// Copyright © 2020 Valtteri Koskivuori. All rights reserved.
//

#include <stdio.h>
#include <stdlib.h>
#include "assert.h"

void assertFailed(const char *file, const char *func, int line, const char *expr) {
printf("ASSERTION FAILED: In %s in function %s on line %i, expression \"%s\"\n", file, func, line, expr);
abort();
}
5 changes: 1 addition & 4 deletions src/utils/assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@

#pragma once

static void assertFailed(const char *file, const char *func, int line, const char *expr) {
printf("ASSERTION FAILED: In %s in function %s on line %i, expression \"%s\"\n", file, func, line, expr);
abort();
}
void assertFailed(const char *file, const char *func, int line, const char *expr);

#define ASSERT(expr) \
if ((expr)) \
Expand Down

0 comments on commit a49fdce

Please sign in to comment.