Skip to content

Commit 2b5f401

Browse files
committed
fmemopen is optional
1 parent e682fe1 commit 2b5f401

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

configure.ac

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ AC_PREREQ(2.52)
22

33
m4_define([PKG_VERSION_MAJOR], [3])
44
m4_define([PKG_VERSION_MINOR], [7])
5-
m4_define([PKG_VERSION_PATCH], [5])
5+
m4_define([PKG_VERSION_PATCH], [6])
66

77
# Bump if the ABI (not API) changed in a backwards-incompatible manner
88
m4_define([PKG_VERSION_ABI], [3])
@@ -61,8 +61,7 @@ AC_TYPE_SIZE_T
6161
# Checks for library functions.
6262
AC_FUNC_ERROR_AT_LINE
6363

64-
AC_CHECK_DECLS([fread_unlocked, fwrite_unlocked, fgetc_unlocked, \
65-
fputc_unlocked, fputs_unlocked])
64+
AC_CHECK_DECLS([fread_unlocked, fwrite_unlocked, fgetc_unlocked, fputc_unlocked, fputs_unlocked, fmemopen])
6665

6766
AC_CHECK_FUNCS([setlocale strdup getopt_long])
6867

lttoolbox/input_file.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,15 @@ InputFile::open(const char* fname)
4444
return (infile != nullptr);
4545
}
4646

47+
#ifdef HAVE_DECL_FMEMOPEN
4748
bool
4849
InputFile::open_in_memory(char *input_buffer)
4950
{
5051
close();
5152
infile = fmemopen(input_buffer, strlen(input_buffer), "rb");
52-
return (infile != nullptr);
53+
return (infile != nullptr);
5354
}
55+
#endif
5456

5557
void
5658
InputFile::open_or_exit(const char* fname)

lttoolbox/input_file.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ class InputFile
3434
InputFile();
3535
~InputFile();
3636
bool open(const char* fname = nullptr);
37+
#ifdef HAVE_DECL_FMEMOPEN
3738
bool open_in_memory(char* input_buffer);
39+
#endif
3840
void open_or_exit(const char* fname = nullptr);
3941
void close();
4042
void wrap(FILE* newinfile);

0 commit comments

Comments
 (0)