* 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 Paul Eggert <eggert@cs.ucla.edu>
+
+ 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 <dmantipov@yandex.ru>
* alloc.c (Fmake_string): For ASCII char initializer, prefer
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;
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);
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. */
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);
}