Skip to content

Commit

Permalink
util, io, net, ...: use "#pragma once"
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKellermann committed Mar 11, 2024
1 parent 313f2a1 commit be84b18
Show file tree
Hide file tree
Showing 32 changed files with 32 additions and 128 deletions.
5 changes: 1 addition & 4 deletions src/io/BufferedOutputStream.hxx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <[email protected]>

#ifndef BUFFERED_OUTPUT_STREAM_HXX
#define BUFFERED_OUTPUT_STREAM_HXX
#pragma once

#include "util/DynamicFifoBuffer.hxx"
#include "util/SpanCast.hxx"
Expand Down Expand Up @@ -130,5 +129,3 @@ WithBufferedOutputStream(OutputStream &os, F &&f)
f(bos);
bos.Flush();
}

#endif
5 changes: 1 addition & 4 deletions src/io/Open.hxx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <[email protected]>

#ifndef OPEN_HXX
#define OPEN_HXX
#pragma once

class FileDescriptor;
class UniqueFileDescriptor;
Expand Down Expand Up @@ -38,5 +37,3 @@ UniqueFileDescriptor
OpenDirectory(FileDescriptor directory, const char *name, int flags=0);

#endif

#endif
5 changes: 1 addition & 4 deletions src/io/OutputStream.hxx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <[email protected]>

#ifndef OUTPUT_STREAM_HXX
#define OUTPUT_STREAM_HXX
#pragma once

#include <cstddef>
#include <span>
Expand All @@ -17,5 +16,3 @@ public:
*/
virtual void Write(std::span<const std::byte> src) = 0;
};

#endif
5 changes: 1 addition & 4 deletions src/io/Reader.hxx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <[email protected]>

#ifndef READER_HXX
#define READER_HXX
#pragma once

#include <cstddef>
#include <span>
Expand Down Expand Up @@ -41,5 +40,3 @@ public:
ReadFull(std::as_writable_bytes(std::span{&dest, 1}));
}
};

#endif
5 changes: 1 addition & 4 deletions src/io/StdioOutputStream.hxx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <[email protected]>

#ifndef STDIO_OUTPUT_STREAM_HXX
#define STDIO_OUTPUT_STREAM_HXX
#pragma once

#include "OutputStream.hxx"

Expand All @@ -21,5 +20,3 @@ public:
/* this class is debug-only and ignores errors */
}
};

#endif
5 changes: 1 addition & 4 deletions src/io/UniqueFileDescriptor.hxx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <[email protected]>

#ifndef UNIQUE_FILE_DESCRIPTOR_HXX
#define UNIQUE_FILE_DESCRIPTOR_HXX
#pragma once

#include "FileDescriptor.hxx" // IWYU pragma: export

Expand Down Expand Up @@ -72,5 +71,3 @@ public:
return IsDefined() && FileDescriptor::Close();
}
};

#endif
5 changes: 1 addition & 4 deletions src/lib/curl/Global.hxx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <[email protected]>

#ifndef CURL_GLOBAL_HXX
#define CURL_GLOBAL_HXX
#pragma once

#include "Multi.hxx"
#include "event/CoarseTimerEvent.hxx"
Expand Down Expand Up @@ -56,5 +55,3 @@ private:
/* callback for #timeout_event */
void OnTimeout() noexcept;
};

#endif
5 changes: 1 addition & 4 deletions src/lib/curl/Slist.hxx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <[email protected]>

#ifndef CURL_SLIST_HXX
#define CURL_SLIST_HXX
#pragma once

#include <curl/curl.h>

Expand Down Expand Up @@ -47,5 +46,3 @@ public:
head = new_head;
}
};

#endif
5 changes: 1 addition & 4 deletions src/lib/curl/String.hxx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <[email protected]>

#ifndef CURL_STRING_HXX
#define CURL_STRING_HXX
#pragma once

#include <curl/curl.h>

Expand Down Expand Up @@ -47,5 +46,3 @@ public:
return p;
}
};

#endif
5 changes: 1 addition & 4 deletions src/lib/dbus/Connection.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
// Copyright CM4all GmbH
// author: Max Kellermann <[email protected]>

#ifndef ODBUS_CONNECTION_HXX
#define ODBUS_CONNECTION_HXX
#pragma once

#include <dbus/dbus.h>

Expand Down Expand Up @@ -61,5 +60,3 @@ public:
};

} /* namespace ODBus */

#endif
5 changes: 1 addition & 4 deletions src/lib/dbus/Iter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
// Copyright CM4all GmbH
// author: Max Kellermann <[email protected]>

#ifndef ODBUS_ITER_HXX
#define ODBUS_ITER_HXX
#pragma once

#include <dbus/dbus.h>

Expand All @@ -21,5 +20,3 @@ public:
};

} /* namespace ODBus */

#endif
5 changes: 1 addition & 4 deletions src/lib/dbus/Message.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
// Copyright CM4all GmbH
// author: Max Kellermann <[email protected]>

#ifndef ODBUS_MESSAGE_HXX
#define ODBUS_MESSAGE_HXX
#pragma once

#include <dbus/dbus.h>

Expand Down Expand Up @@ -123,5 +122,3 @@ public:
};

} /* namespace ODBus */

#endif
5 changes: 1 addition & 4 deletions src/lib/dbus/PendingCall.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
// Copyright CM4all GmbH
// author: Max Kellermann <[email protected]>

#ifndef ODBUS_PENDING_CALL_HXX
#define ODBUS_PENDING_CALL_HXX
#pragma once

#include <dbus/dbus.h>

Expand Down Expand Up @@ -76,5 +75,3 @@ public:
};

} /* namespace ODBus */

#endif
5 changes: 1 addition & 4 deletions src/lib/dbus/ScopeMatch.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
// Copyright CM4all GmbH
// author: Max Kellermann <[email protected]>

#ifndef ODBUS_SCOPE_MATCH_HXX
#define ODBUS_SCOPE_MATCH_HXX
#pragma once

#include <dbus/dbus.h>

Expand All @@ -29,5 +28,3 @@ public:
};

} /* namespace ODBus */

#endif
5 changes: 1 addition & 4 deletions src/lib/dbus/Types.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
// Copyright CM4all GmbH
// author: Max Kellermann <[email protected]>

#ifndef ODBUS_TYPES_HXX
#define ODBUS_TYPES_HXX
#pragma once

#include "util/TemplateString.hxx"

Expand Down Expand Up @@ -89,5 +88,3 @@ struct StructTypeTraits {
};

} /* namespace ODBus */

#endif
5 changes: 1 addition & 4 deletions src/lib/zlib/Error.hxx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <[email protected]>

#ifndef ZLIB_ERROR_HXX
#define ZLIB_ERROR_HXX
#pragma once

#include <exception>

Expand All @@ -18,5 +17,3 @@ public:

const char *what() const noexcept override;
};

#endif
5 changes: 1 addition & 4 deletions src/lib/zlib/GunzipReader.hxx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <[email protected]>

#ifndef GUNZIP_READER_HXX
#define GUNZIP_READER_HXX
#pragma once

#include "io/Reader.hxx"
#include "util/StaticFifoBuffer.hxx"
Expand Down Expand Up @@ -39,5 +38,3 @@ public:
private:
bool FillBuffer();
};

#endif
5 changes: 1 addition & 4 deletions src/net/IPv4Address.hxx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <[email protected]>

#ifndef IPV4_ADDRESS_HXX
#define IPV4_ADDRESS_HXX
#pragma once

#include "SocketAddress.hxx"
#include "util/ByteOrder.hxx"
Expand Down Expand Up @@ -209,5 +208,3 @@ public:
GetPort() & other.GetPort());
}
};

#endif
5 changes: 1 addition & 4 deletions src/net/IPv6Address.hxx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <[email protected]>

#ifndef IPV6_ADDRESS_HXX
#define IPV6_ADDRESS_HXX
#pragma once

#include "SocketAddress.hxx"
#include "util/ByteOrder.hxx"
Expand Down Expand Up @@ -191,5 +190,3 @@ private:
: (0xffff << (offset + 16 - prefix_length)));
}
};

#endif
5 changes: 1 addition & 4 deletions src/net/Resolver.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
// Copyright CM4all GmbH
// author: Max Kellermann <[email protected]>

#ifndef NET_RESOLVER_HXX
#define NET_RESOLVER_HXX
#pragma once

class AddressInfoList;

Expand All @@ -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
5 changes: 1 addition & 4 deletions src/util/AllocatedString.hxx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <[email protected]>

#ifndef ALLOCATED_STRING_HXX
#define ALLOCATED_STRING_HXX
#pragma once

#include "StringPointer.hxx"

Expand Down Expand Up @@ -164,5 +163,3 @@ public:

using BasicAllocatedString::operator=;
};

#endif
5 changes: 1 addition & 4 deletions src/util/Cast.hxx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <[email protected]>

#ifndef CAST_HXX
#define CAST_HXX
#pragma once

#include "OffsetPointer.hxx"

Expand Down Expand Up @@ -55,5 +54,3 @@ ContainerCast(const A &a, const A C::*member)
{
return *OffsetCast<const C, const A>(&a, -ContainerAttributeOffset<C, A>(member));
}

#endif
5 changes: 1 addition & 4 deletions src/util/CharUtil.hxx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <[email protected]>

#ifndef CHAR_UTIL_HXX
#define CHAR_UTIL_HXX
#pragma once

#ifdef _UNICODE
#include "WCharUtil.hxx"
Expand Down Expand Up @@ -140,5 +139,3 @@ IsHexDigit(char ch) noexcept
(ch >= 'a' && ch <= 'f') ||
(ch >= 'A' && ch <= 'F');
}

#endif
5 changes: 1 addition & 4 deletions src/util/DeleteDisposer.hxx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <[email protected]>

#ifndef DELETE_DISPOSER_HXX
#define DELETE_DISPOSER_HXX
#pragma once

/**
* A disposer for boost::intrusive that invokes the "delete" operator
Expand All @@ -15,5 +14,3 @@ public:
delete t;
}
};

#endif
5 changes: 1 addition & 4 deletions src/util/DynamicFifoBuffer.hxx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <[email protected]>

#ifndef DYNAMIC_FIFO_BUFFER_HXX
#define DYNAMIC_FIFO_BUFFER_HXX
#pragma once

#include "ForeignFifoBuffer.hxx"

Expand Down Expand Up @@ -91,5 +90,3 @@ public:
protected:
using ForeignFifoBuffer<T>::GetBuffer;
};

#endif
Loading

0 comments on commit be84b18

Please sign in to comment.