Changeset a7199c2 in mainline


Ignore:
Timestamp:
2010-07-13T21:12:11Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c0e9f3f
Parents:
b62d5614
Message:

Reduce kconsole stack space consumption by about 2.5KiB by using dynamically
allocated buffers. This fixes a couple of problems seen when running some
kconsole commands on e.g. amd64 in which the 4KiB stack was just too small.

File:
1 edited

Legend:

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

    rb62d5614 ra7199c2  
    210210        link_t *pos = NULL;
    211211        const char *hint;
    212         char output[MAX_CMDLINE];
     212        char *output = malloc(MAX_CMDLINE, 0);
    213213       
    214214        output[0] = 0;
     
    235235                str_cpy(input, size, output);
    236236       
     237        free(output);
    237238        return found;
    238239}
     
    245246        wchar_t *current = history[history_pos];
    246247        current[0] = 0;
     248        char *tmp = malloc(STR_BOUNDS(MAX_CMDLINE), 0);
    247249       
    248250        while (true) {
     
    289291                                beg++;
    290292                       
    291                         char tmp[STR_BOUNDS(MAX_CMDLINE)];
    292293                        wstr_to_str(tmp, position - beg + 1, current + beg);
    293294                       
     
    415416        }
    416417       
     418        free(tmp);
    417419        return current;
    418420}
     
    688690                printf("Type \"exit\" to leave the console.\n");
    689691       
     692        char *cmdline = malloc(STR_BOUNDS(MAX_CMDLINE), 0);
    690693        while (true) {
    691694                wchar_t *tmp = clever_readline((char *) prompt, stdin);
     
    694697                        continue;
    695698               
    696                 char cmdline[STR_BOUNDS(MAX_CMDLINE)];
    697699                wstr_to_str(cmdline, STR_BOUNDS(MAX_CMDLINE), tmp);
    698700               
     
    706708                (void) cmd_info->func(cmd_info->argv);
    707709        }
     710        free(cmdline);
    708711}
    709712
Note: See TracChangeset for help on using the changeset viewer.