aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2013-10-07 01:05:00 -0700
committerPaul Eggert2013-10-07 01:05:00 -0700
commit223752d78f464f6cabafa76f32089300522d3ff4 (patch)
tree757d9055bfb2a434d787a6280d8e4d5461302097
parent3c439e0a8410d713488b16af5842ad8ef0cddb04 (diff)
downloademacs-223752d78f464f6cabafa76f32089300522d3ff4.tar.gz
emacs-223752d78f464f6cabafa76f32089300522d3ff4.zip
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.
-rw-r--r--src/ChangeLog9
-rw-r--r--src/alloc.c2
-rw-r--r--src/lisp.h6
-rw-r--r--src/sysdep.c8
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 @@
12013-10-07 Paul Eggert <eggert@cs.ucla.edu>
2
3 emacs_read and emacs_write now use void *, not char *.
4 * alloc.c (valid_pointer_p) [!WINDOWSNT]: Remove now-unnecessary cast.
5 * sysdep.c (emacs_read, emacs_write, emacs_write_sig):
6 Buffer arg is now void *, not char *. This matches plain
7 'read' and 'write' better, and avoids a constraint violation
8 on Solaris 9 with Oracle Studio.
9
12013-10-07 Dmitry Antipov <dmantipov@yandex.ru> 102013-10-07 Dmitry Antipov <dmantipov@yandex.ru>
2 11
3 * alloc.c (Fmake_string): For ASCII char initializer, prefer 12 * 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)
4824 4824
4825 if (emacs_pipe (fd) == 0) 4825 if (emacs_pipe (fd) == 0)
4826 { 4826 {
4827 bool valid = emacs_write (fd[1], (char *) p, 16) == 16; 4827 bool valid = emacs_write (fd[1], p, 16) == 16;
4828 emacs_close (fd[1]); 4828 emacs_close (fd[1]);
4829 emacs_close (fd[0]); 4829 emacs_close (fd[0]);
4830 return valid; 4830 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;
4085extern int emacs_open (const char *, int, int); 4085extern int emacs_open (const char *, int, int);
4086extern int emacs_pipe (int[2]); 4086extern int emacs_pipe (int[2]);
4087extern int emacs_close (int); 4087extern int emacs_close (int);
4088extern ptrdiff_t emacs_read (int, char *, ptrdiff_t); 4088extern ptrdiff_t emacs_read (int, void *, ptrdiff_t);
4089extern ptrdiff_t emacs_write (int, const char *, ptrdiff_t); 4089extern ptrdiff_t emacs_write (int, void const *, ptrdiff_t);
4090extern ptrdiff_t emacs_write_sig (int, char const *, ptrdiff_t); 4090extern ptrdiff_t emacs_write_sig (int, void const *, ptrdiff_t);
4091extern void emacs_perror (char const *); 4091extern void emacs_perror (char const *);
4092 4092
4093extern void unlock_all_files (void); 4093extern 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)
2257 Return the number of bytes read, which might be less than NBYTE. 2257 Return the number of bytes read, which might be less than NBYTE.
2258 On error, set errno and return -1. */ 2258 On error, set errno and return -1. */
2259ptrdiff_t 2259ptrdiff_t
2260emacs_read (int fildes, char *buf, ptrdiff_t nbyte) 2260emacs_read (int fildes, void *buf, ptrdiff_t nbyte)
2261{ 2261{
2262 register ssize_t rtnval; 2262 ssize_t rtnval;
2263 2263
2264 /* There is no need to check against MAX_RW_COUNT, since no caller ever 2264 /* There is no need to check against MAX_RW_COUNT, since no caller ever
2265 passes a size that large to emacs_read. */ 2265 passes a size that large to emacs_read. */
@@ -2310,14 +2310,14 @@ emacs_full_write (int fildes, char const *buf, ptrdiff_t nbyte,
2310 interrupted or if a partial write occurs. Return the number of 2310 interrupted or if a partial write occurs. Return the number of
2311 bytes written, setting errno if this is less than NBYTE. */ 2311 bytes written, setting errno if this is less than NBYTE. */
2312ptrdiff_t 2312ptrdiff_t
2313emacs_write (int fildes, char const *buf, ptrdiff_t nbyte) 2313emacs_write (int fildes, void const *buf, ptrdiff_t nbyte)
2314{ 2314{
2315 return emacs_full_write (fildes, buf, nbyte, 0); 2315 return emacs_full_write (fildes, buf, nbyte, 0);
2316} 2316}
2317 2317
2318/* Like emacs_write, but also process pending signals if interrupted. */ 2318/* Like emacs_write, but also process pending signals if interrupted. */
2319ptrdiff_t 2319ptrdiff_t
2320emacs_write_sig (int fildes, char const *buf, ptrdiff_t nbyte) 2320emacs_write_sig (int fildes, void const *buf, ptrdiff_t nbyte)
2321{ 2321{
2322 return emacs_full_write (fildes, buf, nbyte, 1); 2322 return emacs_full_write (fildes, buf, nbyte, 1);
2323} 2323}