[svn:parrot] r45911 - in branches/string_consting: config/gen/platform/generic config/gen/platform/win32 include/parrot

bacek at svn.parrot.org bacek at svn.parrot.org
Thu Apr 22 13:05:14 UTC 2010


Author: bacek
Date: Thu Apr 22 13:05:14 2010
New Revision: 45911
URL: https://trac.parrot.org/parrot/changeset/45911

Log:
Constify platform-sepcific functions

Modified:
   branches/string_consting/config/gen/platform/generic/env.c
   branches/string_consting/config/gen/platform/generic/exec.c
   branches/string_consting/config/gen/platform/generic/stat.c
   branches/string_consting/config/gen/platform/win32/env.c
   branches/string_consting/include/parrot/io_unix.h
   branches/string_consting/include/parrot/platform_interface.h
   branches/string_consting/include/parrot/stat.h

Modified: branches/string_consting/config/gen/platform/generic/env.c
==============================================================================
--- branches/string_consting/config/gen/platform/generic/env.c	Thu Apr 22 13:04:52 2010	(r45910)
+++ branches/string_consting/config/gen/platform/generic/env.c	Thu Apr 22 13:05:14 2010	(r45911)
@@ -35,7 +35,7 @@
 */
 
 void
-Parrot_setenv(PARROT_INTERP, STRING *str_name, STRING *str_value)
+Parrot_setenv(PARROT_INTERP, const STRING *str_name, const STRING *str_value)
 {
     char *name  = Parrot_str_to_cstring(interp, str_name);
     char *value = Parrot_str_to_cstring(interp, str_value);
@@ -72,7 +72,7 @@
 */
 
 void
-Parrot_unsetenv(PARROT_INTERP, STRING *str_name)
+Parrot_unsetenv(PARROT_INTERP, const STRING *str_name)
 {
     char * const name = Parrot_str_to_cstring(interp, str_name);
 #ifdef PARROT_HAS_UNSETENV
@@ -94,7 +94,7 @@
 */
 
 char *
-Parrot_getenv(PARROT_INTERP, STRING *str_name)
+Parrot_getenv(PARROT_INTERP, const STRING *str_name)
 {
     char *name  = Parrot_str_to_cstring(interp, str_name);
     char *value = getenv(name);

Modified: branches/string_consting/config/gen/platform/generic/exec.c
==============================================================================
--- branches/string_consting/config/gen/platform/generic/exec.c	Thu Apr 22 13:04:52 2010	(r45910)
+++ branches/string_consting/config/gen/platform/generic/exec.c	Thu Apr 22 13:05:14 2010	(r45911)
@@ -36,7 +36,7 @@
 */
 
 INTVAL
-Parrot_Run_OS_Command(PARROT_INTERP, STRING *command)
+Parrot_Run_OS_Command(PARROT_INTERP, const STRING *command)
 {
     pid_t child;
     child = fork();

Modified: branches/string_consting/config/gen/platform/generic/stat.c
==============================================================================
--- branches/string_consting/config/gen/platform/generic/stat.c	Thu Apr 22 13:04:52 2010	(r45910)
+++ branches/string_consting/config/gen/platform/generic/stat.c	Thu Apr 22 13:05:14 2010	(r45911)
@@ -31,7 +31,7 @@
 */
 
 PMC *
-Parrot_stat_file(SHIM_INTERP, SHIM(STRING *filename))
+Parrot_stat_file(SHIM_INTERP, SHIM(const STRING *filename))
 {
     return NULL;
 }
@@ -46,7 +46,7 @@
 */
 
 PMC *
-Parrot_stat_info_pmc(SHIM_INTERP, SHIM(STRING *filename), SHIM(INTVAL thing))
+Parrot_stat_info_pmc(SHIM_INTERP, SHIM(const STRING *filename), SHIM(INTVAL thing))
 {
     return NULL;
 }
@@ -146,7 +146,7 @@
 */
 
 INTVAL
-Parrot_stat_info_intval(PARROT_INTERP, STRING *file, INTVAL thing)
+Parrot_stat_info_intval(PARROT_INTERP, const STRING *file, INTVAL thing)
 {
     struct stat statbuf;
 
@@ -189,7 +189,7 @@
 */
 
 FLOATVAL
-Parrot_stat_info_floatval(SHIM_INTERP, SHIM(STRING *filename), SHIM(INTVAL thing))
+Parrot_stat_info_floatval(SHIM_INTERP, SHIM(const STRING *filename), SHIM(INTVAL thing))
 {
     return (FLOATVAL)-1;
 }

Modified: branches/string_consting/config/gen/platform/win32/env.c
==============================================================================
--- branches/string_consting/config/gen/platform/win32/env.c	Thu Apr 22 13:04:52 2010	(r45910)
+++ branches/string_consting/config/gen/platform/win32/env.c	Thu Apr 22 13:05:14 2010	(r45911)
@@ -97,7 +97,7 @@
 */
 
 char *
-Parrot_getenv(PARROT_INTERP, ARGIN(STRING *str_name))
+Parrot_getenv(PARROT_INTERP, ARGIN(const STRING *str_name))
 {
     char *name       = Parrot_str_to_cstring(interp, str_name);
     const DWORD size = GetEnvironmentVariable(name, NULL, 0);

Modified: branches/string_consting/include/parrot/io_unix.h
==============================================================================
--- branches/string_consting/include/parrot/io_unix.h	Thu Apr 22 13:04:52 2010	(r45910)
+++ branches/string_consting/include/parrot/io_unix.h	Thu Apr 22 13:05:14 2010	(r45911)
@@ -62,7 +62,7 @@
 PARROT_CAN_RETURN_NULL
 PMC * Parrot_io_open_pipe_unix(PARROT_INTERP,
     ARGMOD(PMC *filehandle),
-    ARGIN(STRING *command),
+    ARGIN(const STRING *command),
     int flags)
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
@@ -73,7 +73,7 @@
 PARROT_CAN_RETURN_NULL
 PMC * Parrot_io_open_unix(PARROT_INTERP,
     ARGMOD_NULLOK(PMC *filehandle),
-    ARGIN(STRING *path),
+    ARGIN(const STRING *path),
     INTVAL flags)
         __attribute__nonnull__(1)
         __attribute__nonnull__(3)
@@ -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: branches/string_consting/include/parrot/platform_interface.h
==============================================================================
--- branches/string_consting/include/parrot/platform_interface.h	Thu Apr 22 13:04:52 2010	(r45910)
+++ branches/string_consting/include/parrot/platform_interface.h	Thu Apr 22 13:05:14 2010	(r45911)
@@ -65,9 +65,9 @@
  * Env
  */
 
-void Parrot_setenv(PARROT_INTERP, STRING *name, STRING *value);
-void Parrot_unsetenv(PARROT_INTERP, STRING *name);
-char * Parrot_getenv(PARROT_INTERP, STRING *name);
+void Parrot_setenv(PARROT_INTERP, const STRING *name, const STRING *value);
+void Parrot_unsetenv(PARROT_INTERP, const STRING *name);
+char * Parrot_getenv(PARROT_INTERP, const STRING *name);
 
 /*
 ** Dynamic Loading:
@@ -132,7 +132,7 @@
 
 
 struct parrot_string_t;
-INTVAL Parrot_Run_OS_Command(Interp*, struct parrot_string_t *);
+INTVAL Parrot_Run_OS_Command(Interp*, const struct parrot_string_t *);
 INTVAL Parrot_Run_OS_Command_Argv(Interp*, struct PMC *);
 
 #endif /* PARROT_PLATFORM_INTERFACE_H_GUARD */

Modified: branches/string_consting/include/parrot/stat.h
==============================================================================
--- branches/string_consting/include/parrot/stat.h	Thu Apr 22 13:04:52 2010	(r45910)
+++ branches/string_consting/include/parrot/stat.h	Thu Apr 22 13:05:14 2010	(r45911)
@@ -39,12 +39,12 @@
 
 /* &end_gen */
 
-PARROT_EXPORT PMC *Parrot_stat_file(Parrot_Interp, STRING *);
-PARROT_EXPORT PMC *Parrot_stat_info_pmc(Parrot_Interp, STRING *, INTVAL);
-PARROT_EXPORT STRING *Parrot_stat_info_string(Parrot_Interp, STRING *, INTVAL);
-PARROT_EXPORT INTVAL Parrot_stat_info_intval(Parrot_Interp, STRING *, INTVAL);
+PARROT_EXPORT PMC *Parrot_stat_file(Parrot_Interp, ARGIN(const STRING *));
+PARROT_EXPORT PMC *Parrot_stat_info_pmc(Parrot_Interp, ARGIN(const STRING *), INTVAL);
+PARROT_EXPORT STRING *Parrot_stat_info_string(Parrot_Interp, ARGIN(const STRING *), INTVAL);
+PARROT_EXPORT INTVAL Parrot_stat_info_intval(Parrot_Interp, ARGIN(const STRING *), INTVAL);
 PARROT_EXPORT INTVAL Parrot_fstat_info_intval(Parrot_Interp, INTVAL, INTVAL);
-PARROT_EXPORT FLOATVAL Parrot_stat_info_floatval(Parrot_Interp, STRING *, INTVAL);
+PARROT_EXPORT FLOATVAL Parrot_stat_info_floatval(Parrot_Interp, ARGIN(const STRING *), INTVAL);
 
 #endif /* PARROT_STAT_H_GUARD */
 


More information about the parrot-commits mailing list