Roxen.git / server / base_server / module.pike

version» Context lines:

Roxen.git/server/base_server/module.pike:1174:   {    TRACE_ENTER(sprintf("unregister_lock(%O, lock(%O), X).", path, lock->locktoken),    this);    mixed auth_user = id && authenticated_user_id (path, id);    path = resource_id (path, id);    DAVLock removed_lock;    if (lock->recursive) {    if (id) {    removed_lock = m_delete(prefix_locks[path], auth_user);    } else { -  foreach(prefix_locks[path]; mixed user; DAVLock l) { +  foreach(prefix_locks[path]||([]); mixed user; DAVLock l) {    if (l == lock) {    removed_lock = m_delete(prefix_locks[path], user);    }    }    }    if (!sizeof (prefix_locks[path])) m_delete (prefix_locks, path);    }    else if (file_locks[path]) {    if (id) {    removed_lock = m_delete (file_locks[path], auth_user);    } else { -  foreach(file_locks[path]; mixed user; DAVLock l) { +  foreach(file_locks[path]||([]); mixed user; DAVLock l) {    if (l == lock) {    removed_lock = m_delete(file_locks[path], user);    }    }    }    if (!sizeof (file_locks[path])) m_delete (file_locks, path);    } -  ASSERT_IF_DEBUG (lock /*%O*/ == removed_lock /*%O*/, lock, removed_lock); +  // NB: The lock may have already been removed in the !id case. +  ASSERT_IF_DEBUG (!(id || removed_lock) || +  (lock /*%O*/ == removed_lock /*%O*/), +  lock, removed_lock);    TRACE_LEAVE("Ok.");    return 0;   }      //! Register @[lock] on the path @[path] under the assumption that   //! there is no other lock already that conflicts with this one, i.e.   //! that @expr{check_locks(path,lock->recursive,id)@} would return   //! @expr{LOCK_NONE@} if @expr{lock->lockscope@} is   //! @expr{"DAV:exclusive"@}, or @expr{<= LOCK_SHARED_AT@} if   //! @expr{lock->lockscope@} is @expr{"DAV:shared"@}.