util, io, net, ...: use "#pragma once"

This commit is contained in:
Max Kellermann 2024-02-26 13:01:12 +01:00 committed by Max Kellermann
parent 313f2a1894
commit be84b189dc
32 changed files with 32 additions and 128 deletions

View File

@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <max.kellermann@gmail.com>
#ifndef BUFFERED_OUTPUT_STREAM_HXX
#define BUFFERED_OUTPUT_STREAM_HXX
#pragma once
#include "util/DynamicFifoBuffer.hxx"
#include "util/SpanCast.hxx"
@ -130,5 +129,3 @@ WithBufferedOutputStream(OutputStream &os, F &&f)
f(bos);
bos.Flush();
}
#endif

View File

@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <max.kellermann@gmail.com>
#ifndef OPEN_HXX
#define OPEN_HXX
#pragma once
class FileDescriptor;
class UniqueFileDescriptor;
@ -38,5 +37,3 @@ UniqueFileDescriptor
OpenDirectory(FileDescriptor directory, const char *name, int flags=0);
#endif
#endif

View File

@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <max.kellermann@gmail.com>
#ifndef OUTPUT_STREAM_HXX
#define OUTPUT_STREAM_HXX
#pragma once
#include <cstddef>
#include <span>
@ -17,5 +16,3 @@ public:
*/
virtual void Write(std::span<const std::byte> src) = 0;
};
#endif

View File

@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <max.kellermann@gmail.com>
#ifndef READER_HXX
#define READER_HXX
#pragma once
#include <cstddef>
#include <span>
@ -41,5 +40,3 @@ public:
ReadFull(std::as_writable_bytes(std::span{&dest, 1}));
}
};
#endif

View File

@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <max.kellermann@gmail.com>
#ifndef STDIO_OUTPUT_STREAM_HXX
#define STDIO_OUTPUT_STREAM_HXX
#pragma once
#include "OutputStream.hxx"
@ -21,5 +20,3 @@ public:
/* this class is debug-only and ignores errors */
}
};
#endif

View File

@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <max.kellermann@gmail.com>
#ifndef UNIQUE_FILE_DESCRIPTOR_HXX
#define UNIQUE_FILE_DESCRIPTOR_HXX
#pragma once
#include "FileDescriptor.hxx" // IWYU pragma: export
@ -72,5 +71,3 @@ public:
return IsDefined() && FileDescriptor::Close();
}
};
#endif

View File

@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <max.kellermann@gmail.com>
#ifndef CURL_GLOBAL_HXX
#define CURL_GLOBAL_HXX
#pragma once
#include "Multi.hxx"
#include "event/CoarseTimerEvent.hxx"
@ -56,5 +55,3 @@ private:
/* callback for #timeout_event */
void OnTimeout() noexcept;
};
#endif

View File

@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <max.kellermann@gmail.com>
#ifndef CURL_SLIST_HXX
#define CURL_SLIST_HXX
#pragma once
#include <curl/curl.h>
@ -47,5 +46,3 @@ public:
head = new_head;
}
};
#endif

View File

@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <max.kellermann@gmail.com>
#ifndef CURL_STRING_HXX
#define CURL_STRING_HXX
#pragma once
#include <curl/curl.h>
@ -47,5 +46,3 @@ public:
return p;
}
};
#endif

View File

@ -2,8 +2,7 @@
// Copyright CM4all GmbH
// author: Max Kellermann <mk@cm4all.com>
#ifndef ODBUS_CONNECTION_HXX
#define ODBUS_CONNECTION_HXX
#pragma once
#include <dbus/dbus.h>
@ -61,5 +60,3 @@ public:
};
} /* namespace ODBus */
#endif

View File

@ -2,8 +2,7 @@
// Copyright CM4all GmbH
// author: Max Kellermann <mk@cm4all.com>
#ifndef ODBUS_ITER_HXX
#define ODBUS_ITER_HXX
#pragma once
#include <dbus/dbus.h>
@ -21,5 +20,3 @@ public:
};
} /* namespace ODBus */
#endif

View File

@ -2,8 +2,7 @@
// Copyright CM4all GmbH
// author: Max Kellermann <mk@cm4all.com>
#ifndef ODBUS_MESSAGE_HXX
#define ODBUS_MESSAGE_HXX
#pragma once
#include <dbus/dbus.h>
@ -123,5 +122,3 @@ public:
};
} /* namespace ODBus */
#endif

View File

@ -2,8 +2,7 @@
// Copyright CM4all GmbH
// author: Max Kellermann <mk@cm4all.com>
#ifndef ODBUS_PENDING_CALL_HXX
#define ODBUS_PENDING_CALL_HXX
#pragma once
#include <dbus/dbus.h>
@ -76,5 +75,3 @@ public:
};
} /* namespace ODBus */
#endif

View File

@ -2,8 +2,7 @@
// Copyright CM4all GmbH
// author: Max Kellermann <mk@cm4all.com>
#ifndef ODBUS_SCOPE_MATCH_HXX
#define ODBUS_SCOPE_MATCH_HXX
#pragma once
#include <dbus/dbus.h>
@ -29,5 +28,3 @@ public:
};
} /* namespace ODBus */
#endif

View File

@ -2,8 +2,7 @@
// Copyright CM4all GmbH
// author: Max Kellermann <mk@cm4all.com>
#ifndef ODBUS_TYPES_HXX
#define ODBUS_TYPES_HXX
#pragma once
#include "util/TemplateString.hxx"
@ -89,5 +88,3 @@ struct StructTypeTraits {
};
} /* namespace ODBus */
#endif

View File

@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <max.kellermann@gmail.com>
#ifndef ZLIB_ERROR_HXX
#define ZLIB_ERROR_HXX
#pragma once
#include <exception>
@ -18,5 +17,3 @@ public:
const char *what() const noexcept override;
};
#endif

View File

@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <max.kellermann@gmail.com>
#ifndef GUNZIP_READER_HXX
#define GUNZIP_READER_HXX
#pragma once
#include "io/Reader.hxx"
#include "util/StaticFifoBuffer.hxx"
@ -39,5 +38,3 @@ public:
private:
bool FillBuffer();
};
#endif

View File

@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <max.kellermann@gmail.com>
#ifndef IPV4_ADDRESS_HXX
#define IPV4_ADDRESS_HXX
#pragma once
#include "SocketAddress.hxx"
#include "util/ByteOrder.hxx"
@ -209,5 +208,3 @@ public:
GetPort() & other.GetPort());
}
};
#endif

View File

@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <max.kellermann@gmail.com>
#ifndef IPV6_ADDRESS_HXX
#define IPV6_ADDRESS_HXX
#pragma once
#include "SocketAddress.hxx"
#include "util/ByteOrder.hxx"
@ -191,5 +190,3 @@ private:
: (0xffff << (offset + 16 - prefix_length)));
}
};
#endif

View File

@ -2,8 +2,7 @@
// Copyright CM4all GmbH
// author: Max Kellermann <mk@cm4all.com>
#ifndef NET_RESOLVER_HXX
#define NET_RESOLVER_HXX
#pragma once
class AddressInfoList;
@ -30,5 +29,3 @@ Resolve(const char *host_and_port, int default_port,
AddressInfoList
Resolve(const char *host_port, unsigned default_port, int flags, int socktype);
#endif

View File

@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <max.kellermann@gmail.com>
#ifndef ALLOCATED_STRING_HXX
#define ALLOCATED_STRING_HXX
#pragma once
#include "StringPointer.hxx"
@ -164,5 +163,3 @@ public:
using BasicAllocatedString::operator=;
};
#endif

View File

@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <max.kellermann@gmail.com>
#ifndef CAST_HXX
#define CAST_HXX
#pragma once
#include "OffsetPointer.hxx"
@ -55,5 +54,3 @@ ContainerCast(const A &a, const A C::*member)
{
return *OffsetCast<const C, const A>(&a, -ContainerAttributeOffset<C, A>(member));
}
#endif

View File

@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <max.kellermann@gmail.com>
#ifndef CHAR_UTIL_HXX
#define CHAR_UTIL_HXX
#pragma once
#ifdef _UNICODE
#include "WCharUtil.hxx"
@ -140,5 +139,3 @@ IsHexDigit(char ch) noexcept
(ch >= 'a' && ch <= 'f') ||
(ch >= 'A' && ch <= 'F');
}
#endif

View File

@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <max.kellermann@gmail.com>
#ifndef DELETE_DISPOSER_HXX
#define DELETE_DISPOSER_HXX
#pragma once
/**
* A disposer for boost::intrusive that invokes the "delete" operator
@ -15,5 +14,3 @@ public:
delete t;
}
};
#endif

View File

@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <max.kellermann@gmail.com>
#ifndef DYNAMIC_FIFO_BUFFER_HXX
#define DYNAMIC_FIFO_BUFFER_HXX
#pragma once
#include "ForeignFifoBuffer.hxx"
@ -91,5 +90,3 @@ public:
protected:
using ForeignFifoBuffer<T>::GetBuffer;
};
#endif

View File

@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <max.kellermann@gmail.com>
#ifndef EXCEPTION_HXX
#define EXCEPTION_HXX
#pragma once
#include <exception>
#include <string>
@ -113,5 +112,3 @@ std::string
GetFullMessage(std::exception_ptr ep,
const char *fallback="Unknown exception",
const char *separator="; ") noexcept;
#endif

View File

@ -2,8 +2,7 @@
// Copyright CM4all GmbH
// author: Max Kellermann <mk@cm4all.com>
#ifndef PRINT_EXCEPTION_HXX
#define PRINT_EXCEPTION_HXX
#pragma once
#include <exception>
@ -15,5 +14,3 @@ PrintException(const std::exception &e) noexcept;
void
PrintException(const std::exception_ptr &ep) noexcept;
#endif

View File

@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <max.kellermann@gmail.com>
#ifndef SCOPE_EXIT_HXX
#define SCOPE_EXIT_HXX
#pragma once
#include <utility>
@ -64,5 +63,3 @@ struct ScopeExitTag {
* Boost's compile-time and runtime bloat.
*/
#define AtScopeExit(...) auto ScopeExitName(__LINE__) = ScopeExitTag() + [__VA_ARGS__]()
#endif

View File

@ -2,8 +2,7 @@
// Copyright CM4all GmbH
// author: Max Kellermann <mk@cm4all.com>
#ifndef SHALLOW_COPY_HXX
#define SHALLOW_COPY_HXX
#pragma once
/**
* A tag for overloading copying constructors, telling them to make
@ -11,5 +10,3 @@
* duplicating the referenced objects).
*/
struct ShallowCopy {};
#endif

View File

@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <max.kellermann@gmail.com>
#ifndef STRING_API_HXX
#define STRING_API_HXX
#pragma once
#include <cstring>
@ -193,5 +192,3 @@ DuplicateString(const char *p) noexcept
{
return strdup(p);
}
#endif

View File

@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <max.kellermann@gmail.com>
#ifndef STRING_BUFFER_HXX
#define STRING_BUFFER_HXX
#pragma once
#include <array>
@ -89,5 +88,3 @@ public:
template<std::size_t CAPACITY>
class StringBuffer : public BasicStringBuffer<char, CAPACITY> {};
#endif

View File

@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <max.kellermann@gmail.com>
#ifndef STRING_POINTER_HXX
#define STRING_POINTER_HXX
#pragma once
#include <cstddef>
@ -52,5 +51,3 @@ public:
return *value == SENTINEL;
}
};
#endif