diff options
author | qrort <qrort@yandex-team.com> | 2022-12-02 11:31:25 +0300 |
---|---|---|
committer | qrort <qrort@yandex-team.com> | 2022-12-02 11:31:25 +0300 |
commit | b1f4ffc9c8abff3ba58dc1ec9a9f92d2f0de6806 (patch) | |
tree | 2a23209faf0fea5586a6d4b9cee60d1b318d29fe /library/cpp/deprecated/fgood/fput.h | |
parent | 559174a9144de40d6bb3997ea4073c82289b4974 (diff) | |
download | ydb-b1f4ffc9c8abff3ba58dc1ec9a9f92d2f0de6806.tar.gz |
remove kikimr/driver DEPENDS
Diffstat (limited to 'library/cpp/deprecated/fgood/fput.h')
-rw-r--r-- | library/cpp/deprecated/fgood/fput.h | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/library/cpp/deprecated/fgood/fput.h b/library/cpp/deprecated/fgood/fput.h deleted file mode 100644 index 690b06332df..00000000000 --- a/library/cpp/deprecated/fgood/fput.h +++ /dev/null @@ -1,79 +0,0 @@ -#pragma once - -#include <util/system/defaults.h> -#include <util/system/valgrind.h> - -#include <cstdio> - -#ifdef __FreeBSD__ -#include <cstring> - -template <class T> -Y_FORCE_INLINE size_t fput(FILE* F, const T& a) { - if (Y_LIKELY(F->_w >= int(sizeof(a)))) { - memcpy(F->_p, &a, sizeof(a)); - F->_p += sizeof(a); - F->_w -= sizeof(a); - return 1; - } else { - return fwrite(&a, sizeof(a), 1, F); - } -} - -template <class T> -Y_FORCE_INLINE size_t fget(FILE* F, T& a) { - if (Y_LIKELY(F->_r >= int(sizeof(a)))) { - memcpy(&a, F->_p, sizeof(a)); - F->_p += sizeof(a); - F->_r -= sizeof(a); - return 1; - } else { - return fread(&a, sizeof(a), 1, F); - } -} - -inline size_t fsput(FILE* F, const char* s, size_t l) { - VALGRIND_CHECK_READABLE(s, l); - - if ((size_t)F->_w >= l) { - memcpy(F->_p, s, l); - F->_p += l; - F->_w -= l; - return l; - } else { - return fwrite(s, 1, l, F); - } -} - -inline size_t fsget(FILE* F, char* s, size_t l) { - if ((size_t)F->_r >= l) { - memcpy(s, F->_p, l); - F->_p += l; - F->_r -= l; - return l; - } else { - return fread(s, 1, l, F); - } -} -#else -template <class T> -Y_FORCE_INLINE size_t fput(FILE* F, const T& a) { - return fwrite(&a, sizeof(a), 1, F); -} - -template <class T> -Y_FORCE_INLINE size_t fget(FILE* F, T& a) { - return fread(&a, sizeof(a), 1, F); -} - -inline size_t fsput(FILE* F, const char* s, size_t l) { -#ifdef WITH_VALGRIND - VALGRIND_CHECK_READABLE(s, l); -#endif - return fwrite(s, 1, l, F); -} - -inline size_t fsget(FILE* F, char* s, size_t l) { - return fread(s, 1, l, F); -} -#endif |