aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/afl-common.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/afl-common.c b/src/afl-common.c
index 1628e517..078ffb9d 100644
--- a/src/afl-common.c
+++ b/src/afl-common.c
@@ -518,8 +518,12 @@ int parse_afl_kill_signal_env(u8 *afl_kill_signal_env, int default_signal) {
}
-#define HELPER_MIN3(a, b, c) \
- ((a) < (b) ? ((a) < (c) ? (a) : (c)) : ((b) < (c) ? (b) : (c)))
+static inline unsigned int helper_min3(unsigned int a, unsigned int b,
+ unsigned int c) {
+
+ return a < b ? (a < c ? a : c) : (b < c ? b : c);
+
+}
// from
// https://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance#C
@@ -539,7 +543,7 @@ static int string_distance_levenshtein(char *s1, char *s2) {
for (y = 1, lastdiag = x - 1; y <= s1len; y++) {
olddiag = column[y];
- column[y] = HELPER_MIN3(column[y] + 1, column[y - 1] + 1,
+ column[y] = helper_min3(column[y] + 1, column[y - 1] + 1,
lastdiag + (s1[y - 1] == s2[x - 1] ? 0 : 1));
lastdiag = olddiag;
@@ -551,8 +555,6 @@ static int string_distance_levenshtein(char *s1, char *s2) {
}
-#undef HELPER_MIN3
-
#define ENV_SIMILARITY_TRESHOLD 3
void print_suggested_envs(char *mispelled_env) {