aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Kiernan2018-04-19 04:32:56 +0000
committerTom Rini2018-04-28 18:32:23 -0400
commite21c03be6d51ed8ab94885b6829cd0e719778a1e (patch)
treed655f67e9040194998a2c93e423eb8bfd33b841e
parent4f1eed7527e256edd10fab85d2651a35e530509f (diff)
Consolidate __assert_failed into one implementation
We had two implementations of __assert_failed which were almost identical, combine them into one. Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
-rw-r--r--lib/panic.c8
-rw-r--r--lib/tiny-printf.c9
-rw-r--r--lib/vsprintf.c8
3 files changed, 8 insertions, 17 deletions
diff --git a/lib/panic.c b/lib/panic.c
index 0efa1343445..bae8a359354 100644
--- a/lib/panic.c
+++ b/lib/panic.c
@@ -45,3 +45,11 @@ void panic(const char *fmt, ...)
#endif
panic_finish();
}
+
+void __assert_fail(const char *assertion, const char *file, unsigned int line,
+ const char *function)
+{
+ /* This will not return */
+ panic("%s:%u: %s: Assertion `%s' failed.", file, line, function,
+ assertion);
+}
diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c
index e29377e0004..5f7e27d76ed 100644
--- a/lib/tiny-printf.c
+++ b/lib/tiny-printf.c
@@ -383,12 +383,3 @@ int snprintf(char *buf, size_t size, const char *fmt, ...)
return ret;
}
-
-void __assert_fail(const char *assertion, const char *file, unsigned line,
- const char *function)
-{
- /* This will not return */
- printf("%s:%u: %s: Assertion `%s' failed.", file, line, function,
- assertion);
- hang();
-}
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 9f0ce8aa798..8514f504988 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -827,14 +827,6 @@ int vprintf(const char *fmt, va_list args)
}
#endif
-void __assert_fail(const char *assertion, const char *file, unsigned line,
- const char *function)
-{
- /* This will not return */
- panic("%s:%u: %s: Assertion `%s' failed.", file, line, function,
- assertion);
-}
-
char *simple_itoa(ulong i)
{
/* 21 digits plus null terminator, good for 64-bit or smaller ints */