diff --git a/BUILD b/BUILD index 2c86b3cb43..68933101fb 100644 --- a/BUILD +++ b/BUILD @@ -46,9 +46,6 @@ upb_proto_library_copts( cc_library( name = "port", - srcs = [ - "upb/port.c", - ], copts = UPB_DEFAULT_COPTS, textual_hdrs = [ "upb/port_def.inc", diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index e23703fcfd..638482d438 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -61,8 +61,7 @@ endif() enable_testing() -add_library(port - ../upb/port.c) +add_library(port INTERFACE) add_library(upb ../upb/decode.c ../upb/encode.c diff --git a/upb/port.c b/upb/port.c deleted file mode 100644 index 9ecf135167..0000000000 --- a/upb/port.c +++ /dev/null @@ -1,26 +0,0 @@ - -#include "upb/port_def.inc" - -#ifdef UPB_MSVC_VSNPRINTF -/* Visual C++ earlier than 2015 doesn't have standard C99 snprintf and - * vsnprintf. To support them, missing functions are manually implemented - * using the existing secure functions. */ -int msvc_vsnprintf(char* s, size_t n, const char* format, va_list arg) { - if (!s) { - return _vscprintf(format, arg); - } - int ret = _vsnprintf_s(s, n, _TRUNCATE, format, arg); - if (ret < 0) { - ret = _vscprintf(format, arg); - } - return ret; -} - -int msvc_snprintf(char* s, size_t n, const char* format, ...) { - va_list arg; - va_start(arg, format); - int ret = msvc_vsnprintf(s, n, format, arg); - va_end(arg); - return ret; -} -#endif