Changeset e8d3c6f5 in mainline for uspace/lib/c/generic


Ignore:
Timestamp:
2018-01-13T00:38:49Z (8 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
36f0738
Parents:
9ba415e
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-01-12 23:46:12)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-01-13 00:38:49)
Message:

Align <assert.h> with standards, remove it from libposix,
and do not let malloc() use printf() with corrupted heap.

Location:
uspace/lib/c/generic
Files:
2 edited

Legend:

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

    r9ba415e re8d3c6f5  
    4141static atomic_t failed_asserts = {0};
    4242
    43 void assert_abort(const char *cond, const char *file, unsigned int line)
     43void __helenos_assert_quick_abort(const char *cond, const char *file, unsigned int line)
     44{
     45        /*
     46         * Send the message safely to kio. Nested asserts should not occur.
     47         */
     48        kio_printf("Assertion failed (%s) in file \"%s\", line %u.\n",
     49            cond, file, line);
     50       
     51        /* Sometimes we know in advance that regular printf() would likely fail. */
     52        abort();
     53}
     54
     55void __helenos_assert_abort(const char *cond, const char *file, unsigned int line)
    4456{
    4557        /*
  • uspace/lib/c/generic/malloc.c

    r9ba415e re8d3c6f5  
    3333/** @file
    3434 */
     35
     36#define _HELENOS_SOURCE
    3537
    3638#include <malloc.h>
     
    196198static futex_t malloc_futex = FUTEX_INITIALIZER;
    197199
    198 #ifndef NDEBUG
    199 
    200 #define malloc_assert(expr) \
    201         do { \
    202                 if (!(expr)) {\
    203                         heap_unlock(); \
    204                         assert_abort(#expr, __FILE__, __LINE__); \
    205                 } \
    206         } while (0)
    207 
    208 #else /* NDEBUG */
    209 
    210 #define malloc_assert(expr)
    211 
    212 #endif /* NDEBUG */
    213 
     200#define malloc_assert(expr) safe_assert(expr)
    214201
    215202#ifdef FUTEX_UPGRADABLE
Note: See TracChangeset for help on using the changeset viewer.