chromium/net/base/lookup_string_in_fixed_set.cc

// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif

#include "net/base/lookup_string_in_fixed_set.h"

#include <cstdint>

#include "base/check.h"
#include "base/containers/span.h"

namespace net {

namespace {

// Read next offset from `bytes`, increment `offset_bytes` by that amount, and
// increment `bytes` either to point to the start of the next encoded offset in
// its node, or set it to an empty span, if there are no remaining offsets.
//
// Returns true if an offset could be read; false otherwise.
inline bool GetNextOffset(base::span<const uint8_t>* bytes,
                          base::span<const uint8_t>* offset_bytes) {}

// Check if byte at `byte` is last in label.
bool IsEOL(uint8_t byte) {}

// Check if byte at `byte` matches key. This version matches both end-of-label
// chars and not-end-of-label chars.
bool IsMatch(uint8_t byte, char key) {}

// Read return value at `byte`, if it is a return value. Returns true if a
// return value could be read, false otherwise.
bool GetReturnValue(uint8_t byte, int* return_value) {}

}  // namespace

FixedSetIncrementalLookup::FixedSetIncrementalLookup(
    base::span<const uint8_t> graph)
    :{}

FixedSetIncrementalLookup::FixedSetIncrementalLookup(
    const FixedSetIncrementalLookup& other) = default;

FixedSetIncrementalLookup& FixedSetIncrementalLookup::operator=(
    const FixedSetIncrementalLookup& other) = default;

FixedSetIncrementalLookup::~FixedSetIncrementalLookup() = default;

bool FixedSetIncrementalLookup::Advance(char input) {}

int FixedSetIncrementalLookup::GetResultForCurrentSequence() const {}

int LookupStringInFixedSet(base::span<const uint8_t> graph,
                           const char* key,
                           size_t key_length) {}

// This function is only used by GetRegistryLengthInStrippedHost(), but is
// implemented here to allow inlining of
// LookupStringInFixedSet::GetResultForCurrentSequence() and
// LookupStringInFixedSet::Advance() at compile time. Tests on x86_64 linux
// indicated about 10% increased runtime cost for GetRegistryLength() in average
// if the implementation of this function was separated from the lookup methods.
int LookupSuffixInReversedSet(base::span<const uint8_t> graph,
                              bool include_private,
                              std::string_view host,
                              size_t* suffix_length) {}

}  // namespace net