浏览代码

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>
Alex Kiernan 6 年之前
父节点
当前提交
e21c03be6d
共有 3 个文件被更改,包括 8 次插入17 次删除
  1. 8 0
      lib/panic.c
  2. 0 9
      lib/tiny-printf.c
  3. 0 8
      lib/vsprintf.c

+ 8 - 0
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);
+}

+ 0 - 9
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();
-}

+ 0 - 8
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 */