From 223752d78f464f6cabafa76f32089300522d3ff4 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 7 Oct 2013 01:05:00 -0700 Subject: [PATCH] emacs_read and emacs_write now use void *, not char *. * alloc.c (valid_pointer_p) [!WINDOWSNT]: Remove now-unnecessary cast. * sysdep.c (emacs_read, emacs_write, emacs_write_sig): Buffer arg is now void *, not char *. This matches plain 'read' and 'write' better, and avoids a constraint violation on Solaris 9 with Oracle Studio. --- src/ChangeLog | 9 +++++++++ src/alloc.c | 2 +- src/lisp.h | 6 +++--- src/sysdep.c | 8 ++++---- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 4be64c13993..7483748919d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2013-10-07 Paul Eggert + + emacs_read and emacs_write now use void *, not char *. + * alloc.c (valid_pointer_p) [!WINDOWSNT]: Remove now-unnecessary cast. + * sysdep.c (emacs_read, emacs_write, emacs_write_sig): + Buffer arg is now void *, not char *. This matches plain + 'read' and 'write' better, and avoids a constraint violation + on Solaris 9 with Oracle Studio. + 2013-10-07 Dmitry Antipov * alloc.c (Fmake_string): For ASCII char initializer, prefer diff --git a/src/alloc.c b/src/alloc.c index 56a9763db15..0e6a01944ab 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -4824,7 +4824,7 @@ valid_pointer_p (void *p) if (emacs_pipe (fd) == 0) { - bool valid = emacs_write (fd[1], (char *) p, 16) == 16; + bool valid = emacs_write (fd[1], p, 16) == 16; emacs_close (fd[1]); emacs_close (fd[0]); return valid; diff --git a/src/lisp.h b/src/lisp.h index 2f0279ef542..c7f13e21e55 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -4085,9 +4085,9 @@ extern _Noreturn void emacs_abort (void) NO_INLINE; extern int emacs_open (const char *, int, int); extern int emacs_pipe (int[2]); extern int emacs_close (int); -extern ptrdiff_t emacs_read (int, char *, ptrdiff_t); -extern ptrdiff_t emacs_write (int, const char *, ptrdiff_t); -extern ptrdiff_t emacs_write_sig (int, char const *, ptrdiff_t); +extern ptrdiff_t emacs_read (int, void *, ptrdiff_t); +extern ptrdiff_t emacs_write (int, void const *, ptrdiff_t); +extern ptrdiff_t emacs_write_sig (int, void const *, ptrdiff_t); extern void emacs_perror (char const *); extern void unlock_all_files (void); diff --git a/src/sysdep.c b/src/sysdep.c index 84859813249..f78a8fbb2ef 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -2257,9 +2257,9 @@ emacs_close (int fd) Return the number of bytes read, which might be less than NBYTE. On error, set errno and return -1. */ ptrdiff_t -emacs_read (int fildes, char *buf, ptrdiff_t nbyte) +emacs_read (int fildes, void *buf, ptrdiff_t nbyte) { - register ssize_t rtnval; + ssize_t rtnval; /* There is no need to check against MAX_RW_COUNT, since no caller ever passes a size that large to emacs_read. */ @@ -2310,14 +2310,14 @@ emacs_full_write (int fildes, char const *buf, ptrdiff_t nbyte, interrupted or if a partial write occurs. Return the number of bytes written, setting errno if this is less than NBYTE. */ ptrdiff_t -emacs_write (int fildes, char const *buf, ptrdiff_t nbyte) +emacs_write (int fildes, void const *buf, ptrdiff_t nbyte) { return emacs_full_write (fildes, buf, nbyte, 0); } /* Like emacs_write, but also process pending signals if interrupted. */ ptrdiff_t -emacs_write_sig (int fildes, char const *buf, ptrdiff_t nbyte) +emacs_write_sig (int fildes, void const *buf, ptrdiff_t nbyte) { return emacs_full_write (fildes, buf, nbyte, 1); } -- 2.11.4.GIT