From 8148369cfba2c982a87fb4eb72d024e26e193a03 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 4 Nov 2012 17:59:00 -0800 Subject: [PATCH] Simplify by assuming __fpending. Now that Emacs is using the gnulib fpending module, there's no need for Emacs to have a separate implementation. * configure.ac (stdio_ext.h, __fpending): Remove now-duplicate checks. (PENDING_OUTPUT_COUNT, DISPNEW_NEEDS_STDIO_EXT): Remove. * admin/CPP-DEFINES (PENDING_OUTPUT_COUNT): Remove. * src/dispnew.c: Include , not . (update_frame_1): Use __fpending, not PENDING_OUTPUT_COUNT. Do not assume that __fpending's result fits in int. --- ChangeLog | 8 ++++ admin/CPP-DEFINES | 1 - admin/ChangeLog | 5 +++ configure.ac | 98 +---------------------------------------------- src/ChangeLog | 7 ++++ src/dispnew.c | 6 +-- 6 files changed, 24 insertions(+), 101 deletions(-) diff --git a/ChangeLog b/ChangeLog index a344ec765d..83026bc506 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2012-11-05 Paul Eggert + + Simplify by assuming __fpending. + Now that Emacs is using the gnulib fpending module, + there's no need for Emacs to have a separate implementation. + * configure.ac (stdio_ext.h, __fpending): Remove now-duplicate checks. + (PENDING_OUTPUT_COUNT, DISPNEW_NEEDS_STDIO_EXT): Remove. + 2012-11-03 Eli Zaretskii * lib/makefile.w32-in (GNULIBOBJS): Add $(BLD)/fpending.$(O) and diff --git a/admin/CPP-DEFINES b/admin/CPP-DEFINES index 661cde9c43..fb217fc22e 100644 --- a/admin/CPP-DEFINES +++ b/admin/CPP-DEFINES @@ -425,7 +425,6 @@ ORDINARY_LINK O_RDONLY O_RDWR PAGESIZE -PENDING_OUTPUT_COUNT PREFER_VSUSP PTY_ITERATION PTY_NAME_SPRINTF diff --git a/admin/ChangeLog b/admin/ChangeLog index ccb54a0a9e..c48faadab1 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog @@ -1,3 +1,8 @@ +2012-11-05 Paul Eggert + + Simplify by assuming __fpending. + * CPP-DEFINES (PENDING_OUTPUT_COUNT): Remove. + 2012-11-03 Glenn Morris * admin.el (set-copyright): Add msdos/sed2v2.inp. diff --git a/configure.ac b/configure.ac index b0711923e1..9a562a37a8 100644 --- a/configure.ac +++ b/configure.ac @@ -1266,7 +1266,7 @@ fi dnl checks for header files AC_CHECK_HEADERS_ONCE( linux/version.h sys/systeminfo.h - stdio_ext.h fcntl.h coff.h pty.h + fcntl.h coff.h pty.h sys/vlimit.h sys/resource.h sys/utsname.h pwd.h utmp.h dirent.h util.h) @@ -2874,7 +2874,7 @@ closedir getrusage get_current_dir_name \ lrand48 setsid \ fpathconf select euidaccess getpagesize setlocale \ utimes getrlimit setrlimit setpgid getcwd shutdown getaddrinfo \ -__fpending strsignal setitimer \ +strsignal setitimer \ sendto recvfrom getsockname getpeername getifaddrs freeifaddrs \ gai_strerror mkstemp getline getdelim fsync sync \ difftime posix_memalign \ @@ -3650,100 +3650,6 @@ case $opsys in esac -dnl Used in dispnew.c -AH_TEMPLATE(PENDING_OUTPUT_COUNT, [Number of chars of output in the - buffer of a stdio stream.]) - -AC_MSG_CHECKING([whether we are using the GNU C library]) -AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[ -#include -#ifndef __GNU_LIBRARY__ -# error "this is not the GNU C library" -#endif - ]], [[]])], emacs_glibc=yes, emacs_glibc=no) -AC_MSG_RESULT([$emacs_glibc]) - -if test $emacs_glibc = yes; then - - emacs_pending_output=unknown - - case $opsys in - gnu | gnu-linux | gnu-kfreebsd ) - AC_MSG_CHECKING([for style of pending output formalism]) - dnl In autoconf 2.67 and later, we could use a single test - dnl since the preprocessed output is accessible in "conftest.i". - AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[ -#include -#if !defined (_IO_STDIO_H) && !defined (_STDIO_USES_IOSTREAM) -# error "stdio definitions not found" -#endif - ]], [[]])], emacs_pending_output=new, []) - - if test $emacs_pending_output = unknown; then - case $opsys in - gnu-linux | gnu-kfreebsd) - AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[ -#include -#ifndef __UCLIBC__ -# error "not using uclibc" -#endif - ]], [[]])], emacs_pending_output=uclibc, emacs_pending_output=old) - ;; - esac - fi - - AC_MSG_RESULT([$emacs_pending_output]) - - case $emacs_pending_output in - new) - dnl New C libio names. - AC_DEFINE(PENDING_OUTPUT_COUNT(FILE), - [((FILE)->_IO_write_ptr - (FILE)->_IO_write_base)]) - ;; - uclibc) - dnl Using the uClibc library. - AC_DEFINE(PENDING_OUTPUT_COUNT(FILE), - [((FILE)->__bufpos - (FILE)->__bufstart)]) - ;; - old) - dnl Old C++ iostream names. - AC_DEFINE(PENDING_OUTPUT_COUNT(FILE), - [((FILE)->_pptr - (FILE)->_pbase)]) - ;; - esac - ;; - esac dnl opsys - - if test $emacs_pending_output = unknown; then - AC_DEFINE(PENDING_OUTPUT_COUNT(FILE), [((FILE)->__bufp - (FILE)->__buffer)]) - fi - -else dnl !emacs_glibc - - case $opsys in - cygwin | darwin | freebsd | netbsd | openbsd ) - AC_DEFINE(PENDING_OUTPUT_COUNT(FILE), [((FILE)->_p - (FILE)->_bf._base)]) - ;; - - unixware) - AC_DEFINE(PENDING_OUTPUT_COUNT(FILE), [((FILE)->__ptr - (FILE)->__base)]) - ;; - - *) - dnl HAVE_STDIO_EXT_H && HAVE___FPENDING - if test x$ac_cv_header_stdio_ext_h = xyes && \ - test x$ac_cv_func___fpending = xyes; then - AC_DEFINE(PENDING_OUTPUT_COUNT(FILE), [__fpending (FILE)]) - AC_DEFINE(DISPNEW_NEEDS_STDIO_EXT, 1, - [Define if dispnew.c should include stdio_ext.h.]) - else - AC_DEFINE(PENDING_OUTPUT_COUNT(FILE), [((FILE)->_ptr - (FILE)->_base)]) - fi - ;; - esac -fi dnl emacs_glibc - - dnl Used in vm-limit.c AH_TEMPLATE(DATA_START, [Address of the start of the data segment.]) dnl Used in lisp.h, emacs.c, mem-limits.h diff --git a/src/ChangeLog b/src/ChangeLog index 75b70ee475..29efd9f181 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2012-11-05 Paul Eggert + + Simplify by assuming __fpending. + * dispnew.c: Include , not . + (update_frame_1): Use __fpending, not PENDING_OUTPUT_COUNT. + Do not assume that __fpending's result fits in int. + 2012-11-04 Paul Eggert Remove EMACS_OUTQSIZE+sleep hack. diff --git a/src/dispnew.c b/src/dispnew.c index 2ddd29139a..907259a3e9 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -53,9 +53,7 @@ along with GNU Emacs. If not, see . */ #include "systime.h" #include -#ifdef DISPNEW_NEEDS_STDIO_EXT -#include -#endif +#include #if defined (HAVE_TERM_H) && defined (GNU_LINUX) #include /* for tgetent */ @@ -4647,7 +4645,7 @@ update_frame_1 (struct frame *f, bool force_p, bool inhibit_id_p) FILE *display_output = FRAME_TTY (f)->output; if (display_output) { - int outq = PENDING_OUTPUT_COUNT (display_output); + ptrdiff_t outq = __fpending (display_output); if (outq > 900 || (outq > 20 && ((i - 1) % preempt_count == 0))) fflush (display_output); -- 2.20.1