Merge branch 'merges'
[sxemacs] / src / buffer.h
index 4c5a81e..0492730 100644 (file)
@@ -1099,8 +1099,7 @@ do {                                                                              \
                                  dfc_simplified_sink_type,   &dfc_sink);       \
                                                                                \
   DFC_##sink_type##_USE_CONVERTED_DATA (sink);                                 \
-} while (0);                                                                   \
-assert((sink)!=NULL)
+} while (0)
 
 #define TO_INTERNAL_FORMAT(source_type, source, sink_type, sink, coding_system)        \
 do {                                                                           \
@@ -1131,8 +1130,7 @@ do {                                                                              \
                                  dfc_simplified_sink_type,   &dfc_sink);       \
                                                                                \
   DFC_##sink_type##_USE_CONVERTED_DATA (sink);                                 \
-} while (0);                                                                   \
-assert((sink)!=NULL)
+} while (0)
 
 #ifdef FILE_CODING
 #define DFC_CONVERT_TO_EXTERNAL_FORMAT dfc_convert_to_external_format
@@ -1195,12 +1193,15 @@ dfc_convert_to_internal_format(dfc_conversion_type source_type,
        do {                                                    \
                dfc_source.data.ptr = DFC_CPP_CAR val;          \
                dfc_source.data.len = DFC_CPP_CDR val;          \
+               assert(dfc_source.data.ptr != NULL);            \
                dfc_simplified_source_type = DFC_TYPE_DATA;     \
        } while (0)
 #define DFC_SOURCE_C_STRING_TO_ARGS(val)                               \
        do {                                                            \
-               dfc_source.data.len =                                   \
-                       strlen((const char*)(dfc_source.data.ptr = (val))); \
+               dfc_source.data.ptr = (val);                            \
+               assert(dfc_source.data.ptr != NULL);            \
+               dfc_source.data.len = strlen((const char*)              \
+                                            (dfc_source.data.ptr));    \
                dfc_simplified_source_type = DFC_TYPE_DATA;             \
        } while (0)
 #define DFC_SOURCE_LISP_STRING_TO_ARGS(val)                            \
@@ -1222,6 +1223,7 @@ dfc_convert_to_internal_format(dfc_conversion_type source_type,
                Lisp_Opaque *dfc_slota = XOPAQUE (val);         \
                dfc_source.data.ptr = OPAQUE_DATA (dfc_slota);  \
                dfc_source.data.len = OPAQUE_SIZE (dfc_slota);  \
+               assert(dfc_source.data.ptr != NULL);            \
                dfc_simplified_source_type = DFC_TYPE_DATA;     \
        } while (0)
 
@@ -1261,6 +1263,7 @@ typedef union {
 } *dfc_aliasing_voidpp;
 #define DFC_ALLOCA_USE_CONVERTED_DATA(sink) do {                       \
                void *dfc_sink_ret = alloca(dfc_sink.data.len + 1);     \
+               assert(dfc_sink_ret != NULL);                           \
                memcpy(dfc_sink_ret, dfc_sink.data.ptr,                 \
                       dfc_sink.data.len + 1);                          \
                ((dfc_aliasing_voidpp)&(DFC_CPP_CAR sink))->p =         \
@@ -1270,6 +1273,7 @@ typedef union {
 #define DFC_MALLOC_USE_CONVERTED_DATA(sink)                            \
        do {                                                            \
                void *dfc_sink_ret = xmalloc_atomic(dfc_sink.data.len + 1); \
+               assert(dfc_sink_ret != NULL);                           \
                memcpy(dfc_sink_ret, dfc_sink.data.ptr,                 \
                       dfc_sink.data.len + 1);                          \
                ((dfc_aliasing_voidpp)&(DFC_CPP_CAR sink))->p =         \
@@ -1279,6 +1283,7 @@ typedef union {
 #define DFC_C_STRING_ALLOCA_USE_CONVERTED_DATA(sink)                   \
        do {                                                            \
                void *dfc_sink_ret = alloca (dfc_sink.data.len + 1);    \
+               assert(dfc_sink_ret != NULL);                           \
                memcpy(dfc_sink_ret, dfc_sink.data.ptr,                 \
                       dfc_sink.data.len + 1);                          \
                (sink) =  dfc_sink_ret;                                 \
@@ -1286,15 +1291,24 @@ typedef union {
 #define DFC_C_STRING_MALLOC_USE_CONVERTED_DATA(sink)                   \
        do {                                                            \
                void *dfc_sink_ret = xmalloc_atomic(dfc_sink.data.len + 1); \
+               assert(dfc_sink_ret != NULL);                           \
                memcpy(dfc_sink_ret, dfc_sink.data.ptr,                 \
                       dfc_sink.data.len + 1);                          \
                (sink) = dfc_sink_ret;                                  \
        } while (0)
 #define DFC_LISP_STRING_USE_CONVERTED_DATA(sink)                       \
-       sink = make_string(                                             \
-               (const Bufbyte*)dfc_sink.data.ptr, dfc_sink.data.len)
-#define DFC_LISP_OPAQUE_USE_CONVERTED_DATA(sink) \
-       sink = make_opaque(dfc_sink.data.ptr, dfc_sink.data.len)
+       do {                                                            \
+               sink = make_string((const Bufbyte*)dfc_sink.data.ptr,   \
+                                  dfc_sink.data.len);                  \
+               assert(!NILP(sink));                                    \
+       } while (0)
+#define DFC_LISP_OPAQUE_USE_CONVERTED_DATA(sink)                       \
+       do {                                                            \
+               sink = make_opaque(dfc_sink.data.ptr,                   \
+                                  dfc_sink.data.len);                  \
+               assert(!NILP(sink));                                    \
+       } while (0)
+               
 #define DFC_LISP_LSTREAM_USE_CONVERTED_DATA(sink)      /* data already used */
 #define DFC_LISP_BUFFER_USE_CONVERTED_DATA(sink)               \
        Lstream_delete (XLSTREAM (dfc_sink.lisp_object))