OSSP CVS Repository

ossp - Check-in [592]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 592
Date: 2001-Aug-02 10:12:26 (local)
2001-Aug-02 08:12:26 (UTC)
User:simons
Branch:
Comment: - Moved definition of xds_check_parameter(), xds_init_encoding_engine(), and xds_init_decoding_engine() from internal.h to xds.h so that the callbacks don't need to include internal.h.

- Renamed declare_formatting_engine() to xds_declare_formatting_engine().

Tickets:
Inspections:
Files:
ossp-pkg/xds/internal.h      1.8 -> 1.9     0 inserted, 41 deleted
ossp-pkg/xds/xds.h.in      1.7 -> 1.8     76 inserted, 38 deleted

ossp-pkg/xds/internal.h 1.8 -> 1.9

--- internal.h   2001/08/01 15:25:47     1.8
+++ internal.h   2001/08/02 08:12:26     1.9
@@ -30,12 +30,8 @@
 #ifndef __INTERNAL_H__
 #define __INTERNAL_H__
 
-#include <assert.h>
 #include "xds.h"
 
-#define XDS_TRUE (1==1)
-#define XDS_FALSE (1!=1)
-
 #define XDS_INITIAL_BUFFER_CAPACITY  512
 #define XDS_INITIAL_ENGINES_CAPACITY  32
 
@@ -64,41 +60,4 @@
 int xds_find_engine(const engine_map_t* engines, size_t last, const char* name, size_t* pos);
 int xds_set_capacity(void** array, size_t* array_capacity, size_t new_capacity, size_t elem_size, size_t initial_capacity);
 
-extern const char xds_xml_begin_text[];
-extern const char xds_xml_end_text[];
-
-#define xds_check_parameter(condition)    \
-    do                                    \
-    {                                     \
-    assert(condition);                    \
-    if (!(condition))                     \
-        return XDS_ERR_INVALID_ARG;       \
-    } while(XDS_FALSE)
-
-#define xds_init_encoding_engine(size)                                          \
-    do                                                                          \
-    {                                                                           \
-    xds_check_parameter(xds != NULL);                                           \
-    xds_check_parameter(buffer != NULL);                                        \
-    xds_check_parameter(buffer_size != 0);                                      \
-    xds_check_parameter(used_buffer_size != NULL && *used_buffer_size == 0);    \
-    xds_check_parameter(args != NULL);                                          \
-    *used_buffer_size = size;                                                   \
-    if (buffer_size < size)                                                     \
-        return XDS_ERR_OVERFLOW;                                                \
-    } while(XDS_FALSE)
-
-#define xds_init_decoding_engine(size)                                          \
-    do                                                                          \
-    {                                                                           \
-    xds_check_parameter(xds != NULL);                                           \
-    xds_check_parameter(buffer != NULL);                                        \
-    xds_check_parameter(buffer_size != 0);                                      \
-    xds_check_parameter(used_buffer_size != NULL && *used_buffer_size == 0);    \
-    xds_check_parameter(args != NULL);                                          \
-    *used_buffer_size = size;                                                   \
-    if (buffer_size < size)                                                     \
-        return XDS_ERR_UNDERFLOW;                                               \
-    } while(XDS_FALSE)
-
 #endif /* !defined(__INTERNAL_H__) */


ossp-pkg/xds/xds.h.in 1.7 -> 1.8

--- xds.h.in     2001/08/01 15:25:47     1.7
+++ xds.h.in     2001/08/02 08:12:26     1.8
@@ -33,6 +33,10 @@
 #include <stdlib.h>
 #include <stdarg.h>
 #include <sys/types.h>
+#include <assert.h>
+
+#define XDS_TRUE (1==1)
+#define XDS_FALSE (1!=1)
 
 typedef @xds_uint8_t@ xds_uint8_t;
 typedef @xds_uint16_t@ xds_uint16_t;
@@ -79,45 +83,79 @@
 int xds_vencode(xds_t* xds, const char* fmt, va_list args);
 int xds_vdecode(xds_t* xds, const char* fmt, va_list args);
 
-#define declare_formatting_engine(x) \
-    int x(xds_t* xds, void* engine_context, \
-          void* buffer, size_t buffer_size, size_t* used_buffer_size, \
+#define xds_check_parameter(condition)                                          \
+    do                                                                          \
+    {                                                                           \
+    assert(condition);                                                          \
+    if (!(condition))                                                           \
+        return XDS_ERR_INVALID_ARG;                                             \
+    } while(XDS_FALSE)
+
+#define xds_init_encoding_engine(size)                                          \
+    do                                                                          \
+    {                                                                           \
+    xds_check_parameter(xds != NULL);                                           \
+    xds_check_parameter(buffer != NULL);                                        \
+    xds_check_parameter(buffer_size != 0);                                      \
+    xds_check_parameter(used_buffer_size != NULL && *used_buffer_size == 0);    \
+    xds_check_parameter(args != NULL);                                          \
+    *used_buffer_size = size;                                                   \
+    if (buffer_size < size)                                                     \
+        return XDS_ERR_OVERFLOW;                                                \
+    } while(XDS_FALSE)
+
+#define xds_init_decoding_engine(size)                                          \
+    do                                                                          \
+    {                                                                           \
+    xds_check_parameter(xds != NULL);                                           \
+    xds_check_parameter(buffer != NULL);                                        \
+    xds_check_parameter(buffer_size != 0);                                      \
+    xds_check_parameter(used_buffer_size != NULL && *used_buffer_size == 0);    \
+    xds_check_parameter(args != NULL);                                          \
+    *used_buffer_size = size;                                                   \
+    if (buffer_size < size)                                                     \
+        return XDS_ERR_UNDERFLOW;                                               \
+    } while(XDS_FALSE)
+
+#define xds_declare_formatting_engine(x)                                        \
+    int x(xds_t* xds, void* engine_context,                                     \
+          void* buffer, size_t buffer_size, size_t* used_buffer_size,           \
           va_list* args)
 
-declare_formatting_engine(xdr_encode_uint32);
-declare_formatting_engine(xdr_decode_uint32);
-declare_formatting_engine(xdr_encode_int32);
-declare_formatting_engine(xdr_decode_int32);
-declare_formatting_engine(xdr_encode_uint64);
-declare_formatting_engine(xdr_decode_uint64);
-declare_formatting_engine(xdr_encode_int64);
-declare_formatting_engine(xdr_decode_int64);
-declare_formatting_engine(xdr_encode_double);
-declare_formatting_engine(xdr_decode_double);
-declare_formatting_engine(xdr_encode_octetstream);
-declare_formatting_engine(xdr_decode_octetstream);
-declare_formatting_engine(xdr_encode_string);
-declare_formatting_engine(xdr_decode_string);
-
-declare_formatting_engine(xml_encode_begin);
-declare_formatting_engine(xml_decode_begin);
-declare_formatting_engine(xml_encode_end);
-declare_formatting_engine(xml_decode_end);
-declare_formatting_engine(xml_encode_uint32);
-declare_formatting_engine(xml_decode_uint32);
-declare_formatting_engine(xml_encode_int32);
-declare_formatting_engine(xml_decode_int32);
-declare_formatting_engine(xml_encode_uint64);
-declare_formatting_engine(xml_decode_uint64);
-declare_formatting_engine(xml_encode_int64);
-declare_formatting_engine(xml_decode_int64);
-declare_formatting_engine(xml_encode_double);
-declare_formatting_engine(xml_decode_double);
-declare_formatting_engine(xml_encode_octetstream);
-declare_formatting_engine(xml_decode_octetstream);
-declare_formatting_engine(xml_encode_string);
-declare_formatting_engine(xml_decode_string);
-
-#undef declare_formatting_engine
+xds_declare_formatting_engine(xdr_encode_uint32);
+xds_declare_formatting_engine(xdr_decode_uint32);
+xds_declare_formatting_engine(xdr_encode_int32);
+xds_declare_formatting_engine(xdr_decode_int32);
+xds_declare_formatting_engine(xdr_encode_uint64);
+xds_declare_formatting_engine(xdr_decode_uint64);
+xds_declare_formatting_engine(xdr_encode_int64);
+xds_declare_formatting_engine(xdr_decode_int64);
+xds_declare_formatting_engine(xdr_encode_double);
+xds_declare_formatting_engine(xdr_decode_double);
+xds_declare_formatting_engine(xdr_encode_octetstream);
+xds_declare_formatting_engine(xdr_decode_octetstream);
+xds_declare_formatting_engine(xdr_encode_string);
+xds_declare_formatting_engine(xdr_decode_string);
+
+xds_declare_formatting_engine(xml_encode_begin);
+xds_declare_formatting_engine(xml_decode_begin);
+xds_declare_formatting_engine(xml_encode_end);
+xds_declare_formatting_engine(xml_decode_end);
+xds_declare_formatting_engine(xml_encode_uint32);
+xds_declare_formatting_engine(xml_decode_uint32);
+xds_declare_formatting_engine(xml_encode_int32);
+xds_declare_formatting_engine(xml_decode_int32);
+xds_declare_formatting_engine(xml_encode_uint64);
+xds_declare_formatting_engine(xml_decode_uint64);
+xds_declare_formatting_engine(xml_encode_int64);
+xds_declare_formatting_engine(xml_decode_int64);
+xds_declare_formatting_engine(xml_encode_double);
+xds_declare_formatting_engine(xml_decode_double);
+xds_declare_formatting_engine(xml_encode_octetstream);
+xds_declare_formatting_engine(xml_decode_octetstream);
+xds_declare_formatting_engine(xml_encode_string);
+xds_declare_formatting_engine(xml_decode_string);
+extern const char xds_xml_begin_text[];
+extern const char xds_xml_end_text[];
 
 #endif /* !defined(__LIBXDS_H__) */

CVSTrac 2.0.1