Changeset a35b458 in mainline for boot/genarch/src/ofw_tree.c


Ignore:
Timestamp:
2018-03-02T20:10:49Z (7 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:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • boot/genarch/src/ofw_tree.c

    r3061bc1 ra35b458  
    6565        if (addr)
    6666                addr[size] = '\0';
    67        
     67
    6868        return addr;
    6969}
     
    9898                current_node->property = NULL;
    9999                current_node->device = NULL;
    100                
     100
    101101                /*
    102102                 * Get the disambigued name.
     
    105105                if (len == (size_t) -1)
    106106                        return;
    107                
     107
    108108                path[len] = '\0';
    109                
     109
    110110                /* Find last slash */
    111111                size_t i;
    112112                for (i = len; (i > 0) && (path[i - 1] != '/'); i--);
    113                
     113
    114114                /* Do not include the slash */
    115115                len -= i;
    116                
     116
    117117                /* Add space for trailing '\0' */
    118118                char *da_name = ofw_tree_space_alloc(len + 1);
    119119                if (!da_name)
    120120                        return;
    121                
     121
    122122                memcpy(da_name, &path[i], len);
    123123                da_name[len] = '\0';
    124124                current_node->da_name = (char *) balloc_rebase(da_name);
    125                
     125
    126126                /*
    127127                 * Recursively process the potential child node.
     
    137137                        }
    138138                }
    139                
     139
    140140                /*
    141141                 * Count properties.
     
    146146                        memcpy(name, name2, OFW_TREE_PROPERTY_MAX_NAMELEN);
    147147                }
    148                
     148
    149149                if (!current_node->properties)
    150150                        return;
    151                
     151
    152152                /*
    153153                 * Copy properties.
     
    157157                if (!property)
    158158                        return;
    159                
     159
    160160                name[0] = '\0';
    161161                for (i = 0; ofw_next_property(current, name, name2) == 1; i++) {
    162162                        if (i == current_node->properties)
    163163                                break;
    164                        
     164
    165165                        memcpy(name, name2, OFW_TREE_PROPERTY_MAX_NAMELEN);
    166166                        memcpy(property[i].name, name, OFW_TREE_PROPERTY_MAX_NAMELEN);
    167167                        property[i].name[OFW_TREE_PROPERTY_MAX_NAMELEN - 1] = '\0';
    168                        
     168
    169169                        size_t size = ofw_get_proplen(current, name);
    170170                        property[i].size = size;
    171                        
     171
    172172                        if (size) {
    173173                                void *buf = ofw_tree_space_alloc(size);
     
    182182                                property[i].value = NULL;
    183183                }
    184                
     184
    185185                /* Just in case we ran out of memory. */
    186186                current_node->properties = i;
    187187                current_node->property = (ofw_tree_property_t *) balloc_rebase(property);
    188                
     188
    189189                /*
    190190                 * Iteratively process the next peer node.
     
    207207                        }
    208208                }
    209                
     209
    210210                /*
    211211                 * No more peers on this level.
     
    225225        if (root)
    226226                ofw_tree_node_process(root, NULL, ofw_root);
    227        
     227
    228228        /*
    229229         * The firmware client interface does not automatically include the
     
    241241                }
    242242        }
    243        
     243
    244244        return (ofw_tree_node_t *) balloc_rebase(root);
    245245}
Note: See TracChangeset for help on using the changeset viewer.