Changeset 92f9baca in mainline for uspace/lib/libfs/libfs.c


Ignore:
Timestamp:
2008-05-25T19:49:29Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
fa832eb
Parents:
64b67c3
Message:

Optimize conditions in libfs_lookup(). Perform primitive comparisons in the
left-hand subexpression and potentially expensive calls to libfs operations in
the right-hand subexpression.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libfs/libfs.c

    r64b67c3 r92f9baca  
    156156                next++;         /* eat slash */
    157157       
    158         while (ops->has_children(cur) && next <= last) {
     158        while (next <= last && ops->has_children(cur)) {
    159159                /* collect the component */
    160160                len = 0;
     
    198198                                if (nodep) {
    199199                                        if (!ops->link(cur, nodep, component)) {
    200                                                 if (lflag & L_CREATE)
    201                                                         (void)ops->destroy(nodep);
     200                                                if (lflag & L_CREATE) {
     201                                                        (void)ops->destroy(
     202                                                            nodep);
     203                                                }
    202204                                                ipc_answer_0(rid, ENOSPC);
    203205                                        } else {
     
    233235
    234236        /* handle miss: excessive components */
    235         if (!ops->has_children(cur) && next <= last) {
     237        if (next <= last && !ops->has_children(cur)) {
    236238                if (lflag & (L_CREATE | L_LINK)) {
    237239                        if (!ops->is_directory(cur)) {
Note: See TracChangeset for help on using the changeset viewer.