Changeset 11b285d in mainline for kernel/generic/src/console


Ignore:
Timestamp:
2018-05-13T15:19:32Z (7 years ago)
Author:
Jiří Zárevúcky <jiri.zarevucky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ad896eb
Parents:
13db2044
git-author:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-05-13 14:59:01)
git-committer:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-05-13 15:19:32)
Message:

Use standard signature for malloc() in kernel.

The remaining instances of blocking allocation are replaced with
a new separate function named nfmalloc (short for non-failing malloc).

Location:
kernel/generic/src/console
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/console/cmd.c

    r13db2044 r11b285d  
    14651465                return true;
    14661466
    1467         uint64_t *data = (uint64_t *) malloc(sizeof(uint64_t) * cnt,
    1468             FRAME_ATOMIC);
     1467        uint64_t *data = (uint64_t *) malloc(sizeof(uint64_t) * cnt);
    14691468        if (data == NULL) {
    14701469                printf("Error allocating memory for statistics\n");
  • kernel/generic/src/console/console.c

    r13db2044 r11b285d  
    411411
    412412        if (size > 0) {
    413                 data = (char *) malloc(size + 1, FRAME_ATOMIC);
     413                data = (char *) malloc(size + 1);
    414414                if (!data)
    415415                        return (sys_errno_t) ENOMEM;
  • kernel/generic/src/console/kconsole.c

    r13db2044 r11b285d  
    219219        const char *hint;
    220220        const char *help;
    221         char *output = malloc(MAX_CMDLINE, 0);
     221        char *output = nfmalloc(MAX_CMDLINE);
    222222        size_t hints_to_show = MAX_TAB_HINTS - 1;
    223223        size_t total_hints_shown = 0;
     
    298298                end++;
    299299
    300         tmp = malloc(STR_BOUNDS(end - start + 1), FRAME_ATOMIC);
     300        tmp = malloc(STR_BOUNDS(end - start + 1));
    301301        if (!tmp)
    302302                return NULL;
     
    332332        wchar_t *current = history[history_pos];
    333333        current[0] = 0;
    334         char *tmp = malloc(STR_BOUNDS(MAX_CMDLINE), 0);
     334        char *tmp = nfmalloc(STR_BOUNDS(MAX_CMDLINE));
    335335
    336336        while (true) {
     
    810810                printf("Type \"exit\" to leave the console.\n");
    811811
    812         char *cmdline = malloc(STR_BOUNDS(MAX_CMDLINE), 0);
     812        char *cmdline = nfmalloc(STR_BOUNDS(MAX_CMDLINE));
    813813        while (true) {
    814814                wchar_t *tmp = clever_readline((char *) prompt, stdin);
Note: See TracChangeset for help on using the changeset viewer.