Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/assert.c

    rd8de5d3 r13f2461  
    3737#include <atomic.h>
    3838#include <stacktrace.h>
    39 #include <stdint.h>
    4039
    41 static atomic_t failed_asserts = {0};
     40#define MSG_START       "Assertion failed ("
     41#define MSG_FILE        ") in file \""
     42#define MSG_LINE        "\", line "
     43#define MSG_END         ".\n"
    4244
    43 void assert_abort(const char *cond, const char *file, unsigned int line)
     45static atomic_t failed_asserts;
     46
     47void assert_abort(const char *cond, const char *file, const char *line)
    4448{
    4549        /*
    4650         * Send the message safely to klog. Nested asserts should not occur.
    4751         */
    48         klog_printf("Assertion failed (%s) in file \"%s\", line %u.\n",
    49             cond, file, line);
    50        
     52        klog_write(MSG_START, str_size(MSG_START));
     53        klog_write(cond, str_size(cond));
     54        klog_write(MSG_FILE, str_size(MSG_FILE));
     55        klog_write(file, str_size(file));
     56        klog_write(MSG_LINE, str_size(MSG_LINE));
     57        klog_write(line, str_size(line));
     58        klog_write(MSG_END, str_size(MSG_END));
     59
    5160        /*
    5261         * Check if this is a nested or parallel assert.
     
    6069         * assertions.
    6170         */
    62         printf("Assertion failed (%s) in file \"%s\", line %u.\n",
     71        printf(MSG_START "%s" MSG_FILE "%s" MSG_LINE "%s" MSG_END,
    6372            cond, file, line);
    6473        stacktrace_print();
    65        
     74
    6675        abort();
    6776}
Note: See TracChangeset for help on using the changeset viewer.