提交 d0f3e7f5 编写于 作者: B Behdad Esfahbod

[util] Use setlinebuf() if present

To work around mysterious bug on OS X.

Fixes https://github.com/harfbuzz/harfbuzz/issues/727
上级 ad575a5f
...@@ -69,7 +69,7 @@ GTK_DOC_CHECK([1.15],[--flavour no-tmpl]) ...@@ -69,7 +69,7 @@ GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
]) ])
# Functions and headers # Functions and headers
AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap isatty newlocale strtod_l) AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap isatty newlocale strtod_l setlinebuf)
AC_CHECK_HEADERS(unistd.h sys/mman.h xlocale.h) AC_CHECK_HEADERS(unistd.h sys/mman.h xlocale.h)
# Compiler flags # Compiler flags
...@@ -355,9 +355,7 @@ if $have_freetype; then ...@@ -355,9 +355,7 @@ if $have_freetype; then
AC_DEFINE(HAVE_FREETYPE, 1, [Have FreeType 2 library]) AC_DEFINE(HAVE_FREETYPE, 1, [Have FreeType 2 library])
save_libs=$LIBS save_libs=$LIBS
LIBS="$LIBS $FREETYPE_LIBS" LIBS="$LIBS $FREETYPE_LIBS"
AC_CHECK_FUNCS(FT_Get_Var_Blend_Coordinates) AC_CHECK_FUNCS(FT_Get_Var_Blend_Coordinates FT_Set_Var_Blend_Coordinates FT_Done_MM_Var)
AC_CHECK_FUNCS(FT_Set_Var_Blend_Coordinates)
AC_CHECK_FUNCS(FT_Done_MM_Var)
LIBS=$save_libs LIBS=$save_libs
fi fi
AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype) AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype)
......
...@@ -780,7 +780,11 @@ text_options_t::get_line (unsigned int *len) ...@@ -780,7 +780,11 @@ text_options_t::get_line (unsigned int *len)
gs = g_string_new (nullptr); gs = g_string_new (nullptr);
} }
setvbuf(fp, NULL, _IOLBF, BUFSIZ); //setlinebuf (fp); #ifdef HAVE_SETLINEBUF
setlinebuf (fp);
#else
setvbuf(fp, NULL, _IOLBF, BUFSIZ);
#endif
g_string_set_size (gs, 0); g_string_set_size (gs, 0);
char buf[BUFSIZ]; char buf[BUFSIZ];
...@@ -819,7 +823,11 @@ output_options_t::get_file_handle (void) ...@@ -819,7 +823,11 @@ output_options_t::get_file_handle (void)
fail (false, "Cannot open output file `%s': %s", fail (false, "Cannot open output file `%s': %s",
g_filename_display_name (output_file), strerror (errno)); g_filename_display_name (output_file), strerror (errno));
setvbuf(fp, NULL, _IOLBF, BUFSIZ); //setlinebuf (fp); #ifdef HAVE_SETLINEBUF
setlinebuf (fp);
#else
setvbuf(fp, NULL, _IOLBF, BUFSIZ);
#endif
return fp; return fp;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册