[svn:parrot] r46109 - in trunk: include/parrot src/io

petdance at svn.parrot.org petdance at svn.parrot.org
Wed Apr 28 15:52:25 UTC 2010


Author: petdance
Date: Wed Apr 28 15:52:24 2010
New Revision: 46109
URL: https://trac.parrot.org/parrot/changeset/46109

Log:
consting the STRINGs passed to Parrot_io_write_*

Modified:
   trunk/include/parrot/io.h
   trunk/include/parrot/io_portable.h
   trunk/include/parrot/io_unix.h
   trunk/include/parrot/io_win32.h
   trunk/src/io/api.c
   trunk/src/io/buffer.c
   trunk/src/io/portable.c
   trunk/src/io/unix.c
   trunk/src/io/utf8.c
   trunk/src/io/win32.c

Modified: trunk/include/parrot/io.h
==============================================================================
--- trunk/include/parrot/io.h	Wed Apr 28 15:43:41 2010	(r46108)
+++ trunk/include/parrot/io.h	Wed Apr 28 15:52:24 2010	(r46109)
@@ -495,7 +495,7 @@
 
 size_t Parrot_io_write_buffer(PARROT_INTERP,
     ARGMOD(PMC *filehandle),
-    ARGIN(STRING *s))
+    ARGIN(const STRING *s))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         __attribute__nonnull__(3)
@@ -552,12 +552,11 @@
 
 size_t Parrot_io_write_utf8(PARROT_INTERP,
     ARGMOD(PMC *filehandle),
-    ARGMOD(STRING *s))
+    ARGIN(const STRING *s))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         __attribute__nonnull__(3)
-        FUNC_MODIFIES(*filehandle)
-        FUNC_MODIFIES(*s);
+        FUNC_MODIFIES(*filehandle);
 
 #define ASSERT_ARGS_Parrot_io_read_utf8 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \

Modified: trunk/include/parrot/io_portable.h
==============================================================================
--- trunk/include/parrot/io_portable.h	Wed Apr 28 15:43:41 2010	(r46108)
+++ trunk/include/parrot/io_portable.h	Wed Apr 28 15:52:24 2010	(r46109)
@@ -91,11 +91,10 @@
 
 size_t Parrot_io_write_portable(PARROT_INTERP,
     ARGIN(PMC *filehandle),
-    ARGMOD(STRING *s))
+    ARGIN(const STRING *s))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
-        __attribute__nonnull__(3)
-        FUNC_MODIFIES(*s);
+        __attribute__nonnull__(3);
 
 #define ASSERT_ARGS_Parrot_io_close_portable __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \

Modified: trunk/include/parrot/io_unix.h
==============================================================================
--- trunk/include/parrot/io_unix.h	Wed Apr 28 15:43:41 2010	(r46108)
+++ trunk/include/parrot/io_unix.h	Wed Apr 28 15:52:24 2010	(r46109)
@@ -117,11 +117,10 @@
 
 size_t Parrot_io_write_unix(PARROT_INTERP,
     ARGIN(PMC *filehandle),
-    ARGMOD(STRING *s))
+    ARGIN(const STRING *s))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
-        __attribute__nonnull__(3)
-        FUNC_MODIFIES(*s);
+        __attribute__nonnull__(3);
 
 #define ASSERT_ARGS_Parrot_io_async_unix __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \

Modified: trunk/include/parrot/io_win32.h
==============================================================================
--- trunk/include/parrot/io_win32.h	Wed Apr 28 15:43:41 2010	(r46108)
+++ trunk/include/parrot/io_win32.h	Wed Apr 28 15:52:24 2010	(r46109)
@@ -110,7 +110,7 @@
 
 size_t Parrot_io_write_win32(PARROT_INTERP,
     ARGIN(PMC *filehandle),
-    ARGIN(STRING *s))
+    ARGIN(const STRING *s))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         __attribute__nonnull__(3);

Modified: trunk/src/io/api.c
==============================================================================
--- trunk/src/io/api.c	Wed Apr 28 15:43:41 2010	(r46108)
+++ trunk/src/io/api.c	Wed Apr 28 15:52:24 2010	(r46109)
@@ -460,14 +460,13 @@
 Parrot_io_write(PARROT_INTERP, ARGMOD(PMC *pmc), ARGIN(const void *buffer), size_t length)
 {
     ASSERT_ARGS(Parrot_io_write)
-    DECL_CONST_CAST;
     INTVAL result;
     STRING *s;
 
     if (PMC_IS_NULL(pmc))
         return -1;
 
-    s = Parrot_str_new(interp, (char *) PARROT_const_cast(void *, buffer), length);
+    s = Parrot_str_new(interp, (const char *)buffer, length);
 
     result = Parrot_io_putps(interp, pmc, s);
     return result;

Modified: trunk/src/io/buffer.c
==============================================================================
--- trunk/src/io/buffer.c	Wed Apr 28 15:43:41 2010	(r46108)
+++ trunk/src/io/buffer.c	Wed Apr 28 15:52:24 2010	(r46109)
@@ -543,8 +543,8 @@
 
 /*
 
-=item C<size_t Parrot_io_write_buffer(PARROT_INTERP, PMC *filehandle, STRING
-*s)>
+=item C<size_t Parrot_io_write_buffer(PARROT_INTERP, PMC *filehandle, const
+STRING *s)>
 
 The buffer layer's C<Write> function.
 
@@ -553,7 +553,7 @@
 */
 
 size_t
-Parrot_io_write_buffer(PARROT_INTERP, ARGMOD(PMC *filehandle), ARGIN(STRING *s))
+Parrot_io_write_buffer(PARROT_INTERP, ARGMOD(PMC *filehandle), ARGIN(const STRING *s))
 {
     ASSERT_ARGS(Parrot_io_write_buffer)
     unsigned char * const buffer_start = Parrot_io_get_buffer_start(interp, filehandle);

Modified: trunk/src/io/portable.c
==============================================================================
--- trunk/src/io/portable.c	Wed Apr 28 15:43:41 2010	(r46108)
+++ trunk/src/io/portable.c	Wed Apr 28 15:52:24 2010	(r46109)
@@ -393,8 +393,8 @@
 
 /*
 
-=item C<size_t Parrot_io_write_portable(PARROT_INTERP, PMC *filehandle, STRING
-*s)>
+=item C<size_t Parrot_io_write_portable(PARROT_INTERP, PMC *filehandle, const
+STRING *s)>
 
 Writes the given STRING to the provided IO PMC.
 
@@ -403,10 +403,10 @@
 */
 
 size_t
-Parrot_io_write_portable(PARROT_INTERP, ARGIN(PMC *filehandle), ARGMOD(STRING *s))
+Parrot_io_write_portable(PARROT_INTERP, ARGIN(PMC *filehandle), ARGIN(const STRING *s))
 {
     ASSERT_ARGS(Parrot_io_write_portable)
-    void * const buffer = s->strstart;
+    const void * const buffer = s->strstart;
     return fwrite(buffer, 1, s->bufused,
                   (FILE *)Parrot_io_get_os_handle(interp, filehandle));
 }

Modified: trunk/src/io/unix.c
==============================================================================
--- trunk/src/io/unix.c	Wed Apr 28 15:43:41 2010	(r46108)
+++ trunk/src/io/unix.c	Wed Apr 28 15:52:24 2010	(r46109)
@@ -541,7 +541,8 @@
 
 /*
 
-=item C<size_t Parrot_io_write_unix(PARROT_INTERP, PMC *filehandle, STRING *s)>
+=item C<size_t Parrot_io_write_unix(PARROT_INTERP, PMC *filehandle, const STRING
+*s)>
 
 Calls C<write()> to write C<len> bytes from the memory starting at
 C<buffer> to the file descriptor in C<*io>.
@@ -551,7 +552,7 @@
 */
 
 size_t
-Parrot_io_write_unix(PARROT_INTERP, ARGIN(PMC *filehandle), ARGMOD(STRING *s))
+Parrot_io_write_unix(PARROT_INTERP, ARGIN(PMC *filehandle), ARGIN(const STRING *s))
 {
     ASSERT_ARGS(Parrot_io_write_unix)
     const PIOHANDLE file_descriptor = Parrot_io_get_os_handle(interp, filehandle);

Modified: trunk/src/io/utf8.c
==============================================================================
--- trunk/src/io/utf8.c	Wed Apr 28 15:43:41 2010	(r46108)
+++ trunk/src/io/utf8.c	Wed Apr 28 15:52:24 2010	(r46109)
@@ -101,7 +101,8 @@
 
 /*
 
-=item C<size_t Parrot_io_write_utf8(PARROT_INTERP, PMC *filehandle, STRING *s)>
+=item C<size_t Parrot_io_write_utf8(PARROT_INTERP, PMC *filehandle, const STRING
+*s)>
 
 Write a Parrot string to a filehandle in UTF-8 format.
 
@@ -110,8 +111,7 @@
 */
 
 size_t
-Parrot_io_write_utf8(PARROT_INTERP, ARGMOD(PMC *filehandle),
-        ARGMOD(STRING *s))
+Parrot_io_write_utf8(PARROT_INTERP, ARGMOD(PMC *filehandle), ARGIN(const STRING *s))
 {
     ASSERT_ARGS(Parrot_io_write_utf8)
     STRING *dest;
@@ -134,10 +134,6 @@
 F<src/io/io_layers.c>,
 F<src/io/io_private.h>.
 
-=head1 HISTORY
-
-Initially written by Leo.
-
 =cut
 
 */

Modified: trunk/src/io/win32.c
==============================================================================
--- trunk/src/io/win32.c	Wed Apr 28 15:43:41 2010	(r46108)
+++ trunk/src/io/win32.c	Wed Apr 28 15:52:24 2010	(r46109)
@@ -472,7 +472,8 @@
 
 /*
 
-=item C<size_t Parrot_io_write_win32(PARROT_INTERP, PMC *filehandle, STRING *s)>
+=item C<size_t Parrot_io_write_win32(PARROT_INTERP, PMC *filehandle, const
+STRING *s)>
 
 Calls C<WriteFile()> to write C<len> bytes from the memory starting at
 C<buffer> to C<*io>'s file descriptor. Returns C<(size_t)-1> on
@@ -483,9 +484,7 @@
 */
 
 size_t
-Parrot_io_write_win32(PARROT_INTERP,
-        ARGIN(PMC *filehandle),
-        ARGIN(STRING *s))
+Parrot_io_write_win32(PARROT_INTERP, ARGIN(PMC *filehandle), ARGIN(const STRING *s))
 {
     ASSERT_ARGS(Parrot_io_write_win32)
     DWORD countwrote = 0;


More information about the parrot-commits mailing list