Test for xdrmem_create() failure.
Minor lay-out changes.
diff --git a/Modules/_xdrmodule.c b/Modules/_xdrmodule.c
index 27a8d5c..42e545f 100644
--- a/Modules/_xdrmodule.c
+++ b/Modules/_xdrmodule.c
@@ -10,9 +10,9 @@
  *
  * See xdrlib.py for usage notes.
  *
- * Note: this has so far, only been tested on Solaris 2.5 and SGI IRIX 5.3.
- * On these systems, you will need to link with -lnsl for these
- * symbols to be defined.
+ * Note: this has so far, only been tested on Solaris 2.5 and IRIX 5.3.  On
+ * these systems, you will need to link with -lnsl for these symbols to be
+ * defined.
  */
 
 #include "Python.h"
@@ -27,8 +27,8 @@
 
 static PyObject*
 pack_float(self, args)
-	PyObject* self;
-	PyObject* args;
+     PyObject* self;
+     PyObject* args;
 {
     XDR xdr;
     float value;
@@ -41,8 +41,11 @@
     if (!PyArg_ParseTuple(args, "f", &value))
         return NULL;
 
+    xdr.x_ops = NULL;
     xdrmem_create(&xdr, addr.buffer, 4, XDR_ENCODE);
-    if (xdr_float(&xdr, &value))
+    if( xdr.x_ops == NULL )
+        PyErr_SetString(xdr_error, "XDR stream initialization failed.");
+    else if (xdr_float(&xdr, &value))
         rtn = PyString_FromStringAndSize(addr.buffer, 4);
     else
         PyErr_SetString(xdr_error, "conversion from float failed");
@@ -51,10 +54,12 @@
     return rtn;
 }
     
+
+
 static PyObject*
 pack_double(self, args)
-	PyObject* self;
-	PyObject* args;
+     PyObject* self;
+     PyObject* args;
 {
     XDR xdr;
     double value;
@@ -67,8 +72,11 @@
     if (!PyArg_ParseTuple(args, "d", &value))
         return NULL;
 
+    xdr.x_ops = NULL;
     xdrmem_create(&xdr, addr.buffer, 8, XDR_ENCODE);
-    if (xdr_double(&xdr, &value))
+    if( xdr.x_ops == NULL )
+        PyErr_SetString(xdr_error, "XDR stream initialization failed.");
+    else if (xdr_double(&xdr, &value))
         rtn = PyString_FromStringAndSize(addr.buffer, 8);
     else
         PyErr_SetString(xdr_error, "conversion from double failed");
@@ -81,8 +89,8 @@
 
 static PyObject*
 unpack_float(self, args)
-	PyObject* self;
-	PyObject* args;
+     PyObject* self;
+     PyObject* args;
 {
     XDR xdr;
     float value;
@@ -99,8 +107,11 @@
     }
 
         /* Python guarantees that the string is 4 byte aligned */
+    xdr.x_ops = NULL;
     xdrmem_create(&xdr, (caddr_t)string, 4, XDR_DECODE);
-    if (xdr_float(&xdr, &value))
+    if( xdr.x_ops == NULL )
+        PyErr_SetString(xdr_error, "XDR stream initialization failed.");
+    else if (xdr_float(&xdr, &value))
         rtn = Py_BuildValue("f", value);
     else
         PyErr_SetString(xdr_error, "conversion to float failed");
@@ -110,10 +121,11 @@
 }
 
     
+
 static PyObject*
 unpack_double(self, args)
-	PyObject* self;
-	PyObject* args;
+     PyObject* self;
+     PyObject* args;
 {
     XDR xdr;
     double value;
@@ -130,8 +142,11 @@
     }
 
         /* Python guarantees that the string is 4 byte aligned */
+    xdr.x_ops = NULL;
     xdrmem_create(&xdr, (caddr_t)string, 8, XDR_DECODE);
-    if (xdr_double(&xdr, &value))
+    if( xdr.x_ops == NULL )
+        PyErr_SetString(xdr_error, "XDR stream initialization failed.");
+    else if (xdr_double(&xdr, &value))
         rtn = Py_BuildValue("d", value);
     else
         PyErr_SetString(xdr_error, "conversion to double failed");