This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new 4d56e4ebd06 [chore](be) remove useless errorno code (#52766) 4d56e4ebd06 is described below commit 4d56e4ebd06713534b1d728ffb07f603c909325a Author: yiguolei <guo...@selectdb.com> AuthorDate: Sat Jul 5 16:26:19 2025 +0800 [chore](be) remove useless errorno code (#52766) --- be/src/util/errno.cpp | 48 ------------------------------------------------ be/src/util/errno.h | 34 ---------------------------------- 2 files changed, 82 deletions(-) diff --git a/be/src/util/errno.cpp b/be/src/util/errno.cpp deleted file mode 100644 index f6ab7699268..00000000000 --- a/be/src/util/errno.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -#include "util/errno.h" - -#ifndef __APPLE__ -#include <features.h> -#endif - -#include <cstring> - -namespace doris { - -void errno_to_cstring(int err, char* buf, size_t buf_len) { -#if !defined(__GLIBC__) || \ - ((_POSIX_C_SOURCE >= 200112 || _XOPEN_SOURCE >= 600) && !defined(_GNU_SOURCE)) - // Using POSIX version 'int strerror_r(...)'. - int ret = strerror_r(err, buf, buf_len); - if (ret && ret != ERANGE && ret != EINVAL) { - strncpy(buf, "unknown error", buf_len); - buf[buf_len - 1] = '\0'; - } -#else - // Using GLIBC version - - char* ret = strerror_r(err, buf, buf_len); - if (ret != buf) { - strncpy(buf, ret, buf_len); - buf[buf_len - 1] = '\0'; - } -#endif -} - -} // namespace doris diff --git a/be/src/util/errno.h b/be/src/util/errno.h deleted file mode 100644 index 837fc8ceb93..00000000000 --- a/be/src/util/errno.h +++ /dev/null @@ -1,34 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -#pragma once - -#include <cstddef> -#include <string> - -namespace doris { - -void errno_to_cstring(int err, char* buf, size_t buf_len); - -// Return a string representing an errno. -inline static std::string errno_to_string(int err) { - char buf[512]; - errno_to_cstring(err, buf, sizeof(buf)); - return std::string(buf); -} - -} // namespace doris --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org