summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bfstd.c3
-rw-r--r--src/color.c3
-rw-r--r--src/ctx.c3
-rw-r--r--src/dstring.c4
-rw-r--r--src/eval.c6
-rw-r--r--src/parse.c4
-rw-r--r--src/stat.c6
7 files changed, 15 insertions, 14 deletions
diff --git a/src/bfstd.c b/src/bfstd.c
index 932f2c4..91383a2 100644
--- a/src/bfstd.c
+++ b/src/bfstd.c
@@ -3,6 +3,7 @@
#include "bfstd.h"
#include "config.h"
+#include "diag.h"
#include "xregex.h"
#include <assert.h>
#include <errno.h>
@@ -95,7 +96,7 @@ FILE *xfopen(const char *path, int flags) {
strcpy(mode, "r+b");
break;
default:
- assert(!"Invalid access mode");
+ bfs_bug("Invalid access mode");
errno = EINVAL;
return NULL;
}
diff --git a/src/color.c b/src/color.c
index eeadf98..43ea9a4 100644
--- a/src/color.c
+++ b/src/color.c
@@ -5,6 +5,7 @@
#include "bfstd.h"
#include "bftw.h"
#include "config.h"
+#include "diag.h"
#include "dir.h"
#include "dstring.h"
#include "expr.h"
@@ -1085,7 +1086,7 @@ static int cvbuff(CFILE *cfile, const char *format, va_list args) {
return 0;
invalid:
- assert(!"Invalid format string");
+ bfs_bug("Invalid format string");
errno = EINVAL;
return -1;
}
diff --git a/src/ctx.c b/src/ctx.c
index ff4a2a7..c4b2fb2 100644
--- a/src/ctx.c
+++ b/src/ctx.c
@@ -11,7 +11,6 @@
#include "stat.h"
#include "trie.h"
#include "xtime.h"
-#include <assert.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
@@ -38,7 +37,7 @@ const char *debug_flag_name(enum debug_flags flag) {
break;
}
- assert(!"Unrecognized debug flag");
+ bfs_bug("Unrecognized debug flag");
return "???";
}
diff --git a/src/dstring.c b/src/dstring.c
index 05efb10..2c9869d 100644
--- a/src/dstring.c
+++ b/src/dstring.c
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: 0BSD
#include "dstring.h"
-#include <assert.h>
+#include "diag.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
@@ -184,7 +184,7 @@ int dstrvcatf(char **str, const char *format, va_list args) {
tail = *str + len;
ret = vsnprintf(tail, tail_len + 1, format, copy);
if (ret < 0 || (size_t)ret != tail_len) {
- assert(!"Length of formatted string changed");
+ bfs_bug("Length of formatted string changed");
goto fail;
}
}
diff --git a/src/eval.c b/src/eval.c
index 7444ec9..6cad3a9 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -142,7 +142,7 @@ bool bfs_expr_cmp(const struct bfs_expr *expr, long long n) {
return n > expr->num;
}
- assert(!"Invalid comparison mode");
+ bfs_bug("Invalid comparison mode");
return false;
}
@@ -476,7 +476,7 @@ bool eval_flags(const struct bfs_expr *expr, struct bfs_eval *state) {
return (flags & set) || (flags & clear) != clear;
}
- assert(!"Invalid comparison mode");
+ bfs_bug("Invalid comparison mode");
return false;
}
@@ -626,7 +626,7 @@ bool eval_perm(const struct bfs_expr *expr, struct bfs_eval *state) {
return !(mode & target) == !target;
}
- assert(!"Invalid comparison mode");
+ bfs_bug("Invalid comparison mode");
return false;
}
diff --git a/src/parse.c b/src/parse.c
index 55f1e74..807892c 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -638,7 +638,7 @@ static const char *parse_int(const struct parser_state *state, char **arg, const
break;
default:
- assert(!"Invalid int size");
+ bfs_bug("Invalid int size");
goto bad;
}
@@ -3492,7 +3492,7 @@ static const char *bftw_strategy_name(enum bftw_strategy strategy) {
return "eds";
}
- assert(!"Invalid strategy");
+ bfs_bug("Invalid strategy");
return "???";
}
diff --git a/src/stat.c b/src/stat.c
index 50ea345..590a1d6 100644
--- a/src/stat.c
+++ b/src/stat.c
@@ -4,7 +4,7 @@
#include "stat.h"
#include "bfstd.h"
#include "config.h"
-#include <assert.h>
+#include "diag.h"
#include <errno.h>
#include <fcntl.h>
#include <string.h>
@@ -57,7 +57,7 @@ const char *bfs_stat_field_name(enum bfs_stat_field field) {
return "modification time";
}
- assert(!"Unrecognized stat field");
+ bfs_bug("Unrecognized stat field");
return "???";
}
@@ -340,7 +340,7 @@ const struct timespec *bfs_stat_time(const struct bfs_stat *buf, enum bfs_stat_f
case BFS_STAT_MTIME:
return &buf->mtime;
default:
- assert(!"Invalid stat field for time");
+ bfs_bug("Invalid stat field for time");
errno = EINVAL;
return NULL;
}