Ignore:
File:
1 edited

Legend:

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

    r13f2461 rd8de5d3  
    3737#include <atomic.h>
    3838#include <stacktrace.h>
     39#include <stdint.h>
    3940
    40 #define MSG_START       "Assertion failed ("
    41 #define MSG_FILE        ") in file \""
    42 #define MSG_LINE        "\", line "
    43 #define MSG_END         ".\n"
     41static atomic_t failed_asserts = {0};
    4442
    45 static atomic_t failed_asserts;
    46 
    47 void assert_abort(const char *cond, const char *file, const char *line)
     43void assert_abort(const char *cond, const char *file, unsigned int line)
    4844{
    4945        /*
    5046         * Send the message safely to klog. Nested asserts should not occur.
    5147         */
    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 
     48        klog_printf("Assertion failed (%s) in file \"%s\", line %u.\n",
     49            cond, file, line);
     50       
    6051        /*
    6152         * Check if this is a nested or parallel assert.
     
    6960         * assertions.
    7061         */
    71         printf(MSG_START "%s" MSG_FILE "%s" MSG_LINE "%s" MSG_END,
     62        printf("Assertion failed (%s) in file \"%s\", line %u.\n",
    7263            cond, file, line);
    7364        stacktrace_print();
    74 
     65       
    7566        abort();
    7667}
Note: See TracChangeset for help on using the changeset viewer.