Commit 21238f11 authored by Dmitry Antipov's avatar Dmitry Antipov

Separate read and write access to Lisp_Object slots of Lisp_Process.

* process.h (PGET, PSET): New macros similar to AREF and ASET.
* gnutls.c, print.c, process.c, sysdep.c, w32.c, xdisp.c: Adjust users.
parent 077288cf
2012-08-06 Dmitry Antipov <dmantipov@yandex.ru>
Separate read and write access to Lisp_Object slots of Lisp_Process.
* process.h (PGET, PSET): New macros similar to AREF and ASET.
* gnutls.c, print.c, process.c, sysdep.c, w32.c, xdisp.c: Adjust users.
2012-08-06 Dmitry Antipov <dmantipov@yandex.ru>
Separate read and write access to Lisp_Object slots of struct window.
......
......@@ -830,7 +830,7 @@ one trustfile (usually a CA bundle). */)
XPROCESS (proc)->gnutls_state = NULL;
XPROCESS (proc)->gnutls_x509_cred = NULL;
XPROCESS (proc)->gnutls_anon_cred = NULL;
XPROCESS (proc)->gnutls_cred_type = type;
PSET (XPROCESS (proc), gnutls_cred_type, type);
GNUTLS_INITSTAGE (proc) = GNUTLS_STAGE_EMPTY;
GNUTLS_LOG (1, max_log_level, "allocating credentials");
......
......@@ -1697,11 +1697,11 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
if (escapeflag)
{
strout ("#<process ", -1, -1, printcharfun);
print_string (PVAR (XPROCESS (obj), name), printcharfun);
print_string (PGET (XPROCESS (obj), name), printcharfun);
PRINTCHAR ('>');
}
else
print_string (PVAR (XPROCESS (obj), name), printcharfun);
print_string (PGET (XPROCESS (obj), name), printcharfun);
}
else if (BOOL_VECTOR_P (obj))
{
......
This diff is collapsed.
......@@ -26,10 +26,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "gnutls.h"
#endif
/* Most code should use this macro to access
Lisp fields in struct Lisp_Process. */
/* Most code should use these macros to access Lisp fields in
struct Lisp_Process. PGET should not be used as lvalue. */
#define PVAR(w, field) ((w)->INTERNAL_FIELD (field))
#define PGET(p, field) \
(eassert (offsetof (struct Lisp_Process, field ## _) \
< offsetof (struct Lisp_Process, pid)), \
((p)->INTERNAL_FIELD (field)))
#define PSET(p, field, value) ((p)->INTERNAL_FIELD (field) = (value))
/* This structure records information about a subprocess
or network connection. */
......@@ -100,7 +105,7 @@ struct Lisp_Process
Lisp_Object INTERNAL_FIELD (write_queue);
#ifdef HAVE_GNUTLS
Lisp_Object gnutls_cred_type;
Lisp_Object INTERNAL_FIELD (gnutls_cred_type);
#endif
/* After this point, there are no Lisp_Objects any more. */
......
......@@ -2159,7 +2159,7 @@ serial_configure (struct Lisp_Process *p,
int err = -1;
char summary[4] = "???"; /* This usually becomes "8N1". */
childp2 = Fcopy_sequence (PVAR (p, childp));
childp2 = Fcopy_sequence (PGET (p, childp));
/* Read port attributes and prepare default configuration. */
err = tcgetattr (p->outfd, &attr);
......@@ -2177,7 +2177,7 @@ serial_configure (struct Lisp_Process *p,
if (!NILP (Fplist_member (contact, QCspeed)))
tem = Fplist_get (contact, QCspeed);
else
tem = Fplist_get (PVAR (p, childp), QCspeed);
tem = Fplist_get (PGET (p, childp), QCspeed);
CHECK_NUMBER (tem);
err = cfsetspeed (&attr, XINT (tem));
if (err != 0)
......@@ -2189,7 +2189,7 @@ serial_configure (struct Lisp_Process *p,
if (!NILP (Fplist_member (contact, QCbytesize)))
tem = Fplist_get (contact, QCbytesize);
else
tem = Fplist_get (PVAR (p, childp), QCbytesize);
tem = Fplist_get (PGET (p, childp), QCbytesize);
if (NILP (tem))
tem = make_number (8);
CHECK_NUMBER (tem);
......@@ -2210,7 +2210,7 @@ serial_configure (struct Lisp_Process *p,
if (!NILP (Fplist_member (contact, QCparity)))
tem = Fplist_get (contact, QCparity);
else
tem = Fplist_get (PVAR (p, childp), QCparity);
tem = Fplist_get (PGET (p, childp), QCparity);
if (!NILP (tem) && !EQ (tem, Qeven) && !EQ (tem, Qodd))
error (":parity must be nil (no parity), `even', or `odd'");
#if defined (PARENB) && defined (PARODD) && defined (IGNPAR) && defined (INPCK)
......@@ -2243,7 +2243,7 @@ serial_configure (struct Lisp_Process *p,
if (!NILP (Fplist_member (contact, QCstopbits)))
tem = Fplist_get (contact, QCstopbits);
else
tem = Fplist_get (PVAR (p, childp), QCstopbits);
tem = Fplist_get (PGET (p, childp), QCstopbits);
if (NILP (tem))
tem = make_number (1);
CHECK_NUMBER (tem);
......@@ -2265,7 +2265,7 @@ serial_configure (struct Lisp_Process *p,
if (!NILP (Fplist_member (contact, QCflowcontrol)))
tem = Fplist_get (contact, QCflowcontrol);
else
tem = Fplist_get (PVAR (p, childp), QCflowcontrol);
tem = Fplist_get (PGET (p, childp), QCflowcontrol);
if (!NILP (tem) && !EQ (tem, Qhw) && !EQ (tem, Qsw))
error (":flowcontrol must be nil (no flowcontrol), `hw', or `sw'");
#if defined (CRTSCTS)
......@@ -2307,7 +2307,7 @@ serial_configure (struct Lisp_Process *p,
error ("tcsetattr() failed: %s", emacs_strerror (errno));
childp2 = Fplist_put (childp2, QCsummary, build_string (summary));
PVAR (p, childp) = childp2;
PSET (p, childp, childp2);
}
#endif /* not DOS_NT */
......
......@@ -6891,7 +6891,7 @@ serial_configure (struct Lisp_Process *p, Lisp_Object contact)
error ("Not a serial process");
hnd = fd_info[ p->outfd ].hnd;
childp2 = Fcopy_sequence (PVAR (p, childp));
childp2 = Fcopy_sequence (PGET (p, childp));
/* Initialize timeouts for blocking read and blocking write. */
if (!GetCommTimeouts (hnd, &ct))
......@@ -6920,7 +6920,7 @@ serial_configure (struct Lisp_Process *p, Lisp_Object contact)
if (!NILP (Fplist_member (contact, QCspeed)))
tem = Fplist_get (contact, QCspeed);
else
tem = Fplist_get (PVAR (p, childp), QCspeed);
tem = Fplist_get (PGET (p, childp), QCspeed);
CHECK_NUMBER (tem);
dcb.BaudRate = XINT (tem);
childp2 = Fplist_put (childp2, QCspeed, tem);
......@@ -6929,7 +6929,7 @@ serial_configure (struct Lisp_Process *p, Lisp_Object contact)
if (!NILP (Fplist_member (contact, QCbytesize)))
tem = Fplist_get (contact, QCbytesize);
else
tem = Fplist_get (PVAR (p, childp), QCbytesize);
tem = Fplist_get (PGET (p, childp), QCbytesize);
if (NILP (tem))
tem = make_number (8);
CHECK_NUMBER (tem);
......@@ -6943,7 +6943,7 @@ serial_configure (struct Lisp_Process *p, Lisp_Object contact)
if (!NILP (Fplist_member (contact, QCparity)))
tem = Fplist_get (contact, QCparity);
else
tem = Fplist_get (PVAR (p, childp), QCparity);
tem = Fplist_get (PGET (p, childp), QCparity);
if (!NILP (tem) && !EQ (tem, Qeven) && !EQ (tem, Qodd))
error (":parity must be nil (no parity), `even', or `odd'");
dcb.fParity = FALSE;
......@@ -6973,7 +6973,7 @@ serial_configure (struct Lisp_Process *p, Lisp_Object contact)
if (!NILP (Fplist_member (contact, QCstopbits)))
tem = Fplist_get (contact, QCstopbits);
else
tem = Fplist_get (PVAR (p, childp), QCstopbits);
tem = Fplist_get (PGET (p, childp), QCstopbits);
if (NILP (tem))
tem = make_number (1);
CHECK_NUMBER (tem);
......@@ -6990,7 +6990,7 @@ serial_configure (struct Lisp_Process *p, Lisp_Object contact)
if (!NILP (Fplist_member (contact, QCflowcontrol)))
tem = Fplist_get (contact, QCflowcontrol);
else
tem = Fplist_get (PVAR (p, childp), QCflowcontrol);
tem = Fplist_get (PGET (p, childp), QCflowcontrol);
if (!NILP (tem) && !EQ (tem, Qhw) && !EQ (tem, Qsw))
error (":flowcontrol must be nil (no flowcontrol), `hw', or `sw'");
dcb.fOutxCtsFlow = FALSE;
......@@ -7024,7 +7024,7 @@ serial_configure (struct Lisp_Process *p, Lisp_Object contact)
error ("SetCommState() failed");
childp2 = Fplist_put (childp2, QCsummary, build_string (summary));
PVAR (p, childp) = childp2;
PSET (p, childp, childp2);
}
#ifdef HAVE_GNUTLS
......
......@@ -21677,9 +21677,9 @@ decode_mode_spec (struct window *w, register int c, int field_width,
if (PROCESSP (obj))
{
p = decode_mode_spec_coding
(PVAR (XPROCESS (obj), decode_coding_system), p, eol_flag);
(PGET (XPROCESS (obj), decode_coding_system), p, eol_flag);
p = decode_mode_spec_coding
(PVAR (XPROCESS (obj), encode_coding_system), p, eol_flag);
(PGET (XPROCESS (obj), encode_coding_system), p, eol_flag);
}
#endif /* subprocesses */
#endif /* 0 */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment