On Sat, Apr 26, 2008 at 8:16 PM, chromatic <[EMAIL PROTECTED]> wrote:

>  > A possible solution is to add another macro taking as second argument
>  > the struct instead of a pointer.
>  That seems cleaner to me; want to try that patch?

The attached patch adds the macro STRUCT_COPY_ST, and uses it in the
src/charset charset init functions.

All test pass with 27216 in my system (Ubuntu 8.04)

-- 
Salu2
Index: src/charset/iso-8859-1.c
===================================================================
--- src/charset/iso-8859-1.c	(revisión: 27216)
+++ src/charset/iso-8859-1.c	(copia de trabajo)
@@ -628,7 +628,7 @@
         NULL
     };
 
-    STRUCT_COPY(return_set, &base_set);
+    STRUCT_COPY_ST(return_set, base_set);
     return_set->preferred_encoding = Parrot_fixed_8_encoding_ptr;
     Parrot_register_charset(interp, "iso-8859-1", return_set);
     return return_set;
Index: src/charset/binary.c
===================================================================
--- src/charset/binary.c	(revisión: 27216)
+++ src/charset/binary.c	(copia de trabajo)
@@ -467,7 +467,7 @@
         NULL
     };
 
-    STRUCT_COPY(return_set, &base_set);
+    STRUCT_COPY_ST(return_set, base_set);
     return_set->preferred_encoding = Parrot_fixed_8_encoding_ptr;
     Parrot_register_charset(interp, "binary", return_set);
     return return_set;
Index: src/charset/unicode.c
===================================================================
--- src/charset/unicode.c	(revisión: 27216)
+++ src/charset/unicode.c	(copia de trabajo)
@@ -925,7 +925,7 @@
         NULL
     };
 
-    STRUCT_COPY(return_set, &base_set);
+    STRUCT_COPY_ST(return_set, base_set);
     /*
      * for now use utf8
      * TODO replace it with a fixed uint_16 or uint_32 encoding
Index: src/charset/ascii.c
===================================================================
--- src/charset/ascii.c	(revisión: 27216)
+++ src/charset/ascii.c	(copia de trabajo)
@@ -789,7 +789,7 @@
         NULL
     };
 
-    STRUCT_COPY(return_set, &base_set);
+    STRUCT_COPY_ST(return_set, base_set);
     return_set->preferred_encoding = Parrot_fixed_8_encoding_ptr;
     Parrot_register_charset(interp, "ascii", return_set);
     return return_set;
Index: include/parrot/parrot.h
===================================================================
--- include/parrot/parrot.h	(revisión: 27216)
+++ include/parrot/parrot.h	(copia de trabajo)
@@ -241,10 +241,12 @@
 #endif /* O_BINARY */
 
 /* Hide our struct copying behind macros */
+/* Copying to struct pointer from struct pointer */
 #define STRUCT_COPY(d, s)    (PARROT_ASSERT(d), PARROT_ASSERT(s), *(d)=*(s))
 #define STRUCT_COPY_N(d, s, n) (PARROT_ASSERT(d), PARROT_ASSERT(s), PARROT_ASSERT(sizeof (*(d))==sizeof (*(s))), memcpy((d), (s), sizeof (*(d))*(n)))
+/* Copying to struct pointer from struct */
+#define STRUCT_COPY_ST(d, s)    (PARROT_ASSERT(d), *(d)=(s))
 
-
 /* internationalization settings */
 #ifdef    PARROT_HAS_GETTEXT
 #  include <libintl.h>

Reply via email to