Changeset 7bb6b06 in mainline for kernel/generic/src/sysinfo/sysinfo.c


Ignore:
Timestamp:
2006-09-10T21:21:39Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9a5b556
Parents:
208fa65
Message:

Small improvements here and there.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/sysinfo/sysinfo.c

    r208fa65 r7bb6b06  
    7979       
    8080        if (subtree == NULL) {
    81                         sysinfo_item_t *item = malloc(sizeof(sysinfo_item_t), 0);
    82                         int i = 0, j;
    83                        
    84                         ASSERT(item);
    85                         *psubtree = item;
    86                         item->next = NULL;
    87                         item->val_type = SYSINFO_VAL_UNDEFINED;
    88                         item->subinfo.table = NULL;
    89 
    90                         while (name[i] && (name[i] != '.'))
    91                                 i++;
    92                        
    93                         item->name = malloc(i, 0);
    94                         ASSERT(item->name);
    95 
    96                         for (j = 0; j < i; j++)
    97                                 item->name[j] = name[j];
    98                         item->name[j] = 0;
    99                        
    100                         if (name[i]) { /* =='.' */
    101                                 item->subinfo_type = SYSINFO_SUBINFO_TABLE;
    102                                 return sysinfo_create_path(name + i + 1, &(item->subinfo.table));
    103                         }
    104                         item->subinfo_type = SYSINFO_SUBINFO_NONE;
    105                         return item;
     81                sysinfo_item_t *item = malloc(sizeof(sysinfo_item_t), 0);
     82                int i = 0, j;
     83                       
     84                ASSERT(item);
     85                *psubtree = item;
     86                item->next = NULL;
     87                item->val_type = SYSINFO_VAL_UNDEFINED;
     88                item->subinfo.table = NULL;
     89
     90                while (name[i] && (name[i] != '.'))
     91                        i++;
     92                       
     93                item->name = malloc(i, 0);
     94                ASSERT(item->name);
     95
     96                for (j = 0; j < i; j++)
     97                        item->name[j] = name[j];
     98                item->name[j] = 0;
     99                       
     100                if (name[i]) { /* =='.' */
     101                        item->subinfo_type = SYSINFO_SUBINFO_TABLE;
     102                        return sysinfo_create_path(name + i + 1, &(item->subinfo.table));
     103                }
     104                item->subinfo_type = SYSINFO_SUBINFO_NONE;
     105                return item;
    106106        }
    107107
Note: See TracChangeset for help on using the changeset viewer.