22 lines
611 B
C++
22 lines
611 B
C++
// SPDX-FileCopyrightText: Matteo Settenvini <matteo.settenvini@montecristosoftware.eu>
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <nss.h>
|
|
|
|
#include <utility>
|
|
|
|
template <typename T>
|
|
inline auto set_if_valid(T *ptr, T val) -> T * {
|
|
if (ptr != nullptr) {
|
|
*ptr = std::move(val);
|
|
}
|
|
return ptr;
|
|
}
|
|
|
|
namespace malcontent {
|
|
auto copy_hostent(const hostent& src, hostent& dst, void *buffer, size_t buflen) -> void;
|
|
auto copy_hostent_to_gaih_addrtuple(const hostent& src, gaih_addrtuple *head, void *& buffer, size_t& buflen) -> gaih_addrtuple *;
|
|
} // ~ namespace malcontent
|