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:
H. Peter Anvin 2016-09-20 18:26:42 -07:00
parent e8b01c6f72
commit c170089e7c
2 changed files with 16 additions and 14 deletions

View file

@ -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;

View file

@ -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