mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-01-30 16:41:05 +08:00
nasmlib: move fseeko/ftello/off_t replacements to nasmlib.h
Move fseeko, ftello, and off_t definitions to nasmlib.h so that files other than nasmlib/file.c can use them (already added to asm/assemble.c). Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
This commit is contained in:
parent
e8b01c6f72
commit
c170089e7c
@ -459,6 +459,20 @@ FILE *nasm_open_write(const char *filename, enum file_flags flags);
|
||||
extern const uint8_t zero_buffer[ZERO_BUF_SIZE];
|
||||
void fwritezero(size_t bytes, FILE *fp);
|
||||
|
||||
/* Missing fseeko/ftello */
|
||||
#ifndef HAVE_FSEEKO
|
||||
# undef off_t /* Just in case it is a macro */
|
||||
# ifdef HAVE__FSEEKI64
|
||||
# define fseeko _fseeki64
|
||||
# define ftello _ftelli64
|
||||
# define off_t int64_t
|
||||
# else
|
||||
# define fseeko fseek
|
||||
# define ftello ftell
|
||||
# define off_t long
|
||||
# endif
|
||||
#endif
|
||||
|
||||
static inline bool overflow_general(int64_t value, int bytes)
|
||||
{
|
||||
int sbit;
|
||||
|
@ -43,20 +43,6 @@
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
/* Missing fseeko/ftello */
|
||||
#ifndef HAVE_FSEEKO
|
||||
# undef off_t /* Just in case it is a macro */
|
||||
# ifdef HAVE__FSEEKI64
|
||||
# define fseeko _fseeki64
|
||||
# define ftello _ftelli64
|
||||
# define off_t int64_t
|
||||
# else
|
||||
# define fseeko fseek
|
||||
# define ftello ftell
|
||||
# define off_t long
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Can we adjust the file size without actually writing all the bytes? */
|
||||
#ifdef HAVE_FILENO /* Useless without fileno() */
|
||||
# ifdef HAVE__CHSIZE_S
|
||||
@ -188,3 +174,5 @@ FILE *nasm_open_write(const char *filename, enum file_flags flags)
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
off_t
|
||||
|
Loading…
Reference in New Issue
Block a user