[libc-commits] [libc] [libc] Implement getprotobyname_r (PR #243486)

Pavel Labath via libc-commits libc-commits at lists.llvm.org
Tue Nov 17 07:02:22 PST 2026


================
@@ -0,0 +1,163 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// Implementation of getprotobyname_r.
+///
+//===----------------------------------------------------------------------===//
+
+#include "src/netdb/getprotobyname_r.h"
+
+#include "hdr/errno_macros.h"
+#include "hdr/stdint_proxy.h"
+#include "hdr/types/size_t.h"
+#include "hdr/types/struct_protoent.h"
+#include "src/__support/CPP/optional.h"
+#include "src/__support/CPP/scope.h"
+#include "src/__support/CPP/span.h"
+#include "src/__support/CPP/string_view.h"
+#include "src/__support/File/file.h"
+#include "src/__support/common.h"
+#include "src/__support/ctype_utils.h"
+#include "src/__support/macros/null_check.h"
+#include "src/__support/str_to_integer.h"
+#include "src/string/memory_utils/inline_memcpy.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace netdb {
----------------
labath wrote:

(just a quick driveby for now). It's more llvm-y (the thing about keeping namespaces small) to drop this namespaces (at least netdb, I'm not sure how consistent we are about LIBC_NAMESPACE) and keep everything static (which it already is). set_protocols_path can be declared as `void netdb::set_protocols_path`)

https://github.com/llvm/llvm-project/pull/243486


More information about the libc-commits mailing list