Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 3d4ad475 in mainline


Ignore:
Timestamp:
2012-08-17T17:58:32Z (9 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
b5f305b
Parents:
1de97fe6
Message:

isa: Do not allocate and copy name string.

ddf_fun_create does that for us.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/isa/isa.c

    r1de97fe6 r3d4ad475  
    308308        /* Get the name part of the rest of the line. */
    309309        strtok(line, ":");
    310 
    311         /* Allocate output buffer. */
    312         size_t size = str_size(line) + 1;
    313         char *name = malloc(size);
    314 
    315         if (name != NULL) {
    316                 /* Copy the result to the output buffer. */
    317                 str_cpy(name, size, line);
    318         }
    319 
    320         return name;
     310        return line;
    321311}
    322312
     
    524514{
    525515        char *line;
    526         char *fun_name = NULL;
    527516
    528517        /* Skip empty lines. */
     
    538527
    539528        /* Get device name. */
    540         fun_name = get_device_name(line);
     529        const char *fun_name = get_device_name(line);
    541530        if (fun_name == NULL)
    542531                return NULL;
    543532
    544533        isa_fun_t *fun = isa_fun_create(isa, fun_name);
    545         free(fun_name);
    546534        if (fun == NULL) {
    547535                return NULL;
Note: See TracChangeset for help on using the changeset viewer.