develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r34731 - in trunk: include/parrot src

From:
infinoid
Date:
December 31, 2008 18:16
Subject:
[svn:parrot] r34731 - in trunk: include/parrot src
Message ID:
20090101021554.0B6DACBA08@x12.develooper.com
Author: infinoid
Date: Wed Dec 31 18:15:53 2008
New Revision: 34731

Modified:
   trunk/include/parrot/inter_call.h
   trunk/src/inter_call.c

Log:
[core] More NULLOK function arguments.
* The index arguments to parrot_pass_args() are only passed to other NULLOK
  functions; they can be marked NULLOK.
* set_context_sig_returns() checks ret_x before dereferencing, it is NULLOK.
(Found by the headerizer NONNULL assert() patch, see Trac #105.)

Modified: trunk/include/parrot/inter_call.h
==============================================================================
--- trunk/include/parrot/inter_call.h	(original)
+++ trunk/include/parrot/inter_call.h	Wed Dec 31 18:15:53 2008
@@ -161,18 +161,14 @@
 void parrot_pass_args(PARROT_INTERP,
     ARGMOD(Parrot_Context *src_ctx),
     ARGMOD(Parrot_Context *dest_ctx),
-    ARGMOD(opcode_t *src_indexes),
-    ARGMOD(opcode_t *dest_indexes),
+    ARGMOD_NULLOK(opcode_t *src_indexes),
+    ARGMOD_NULLOK(opcode_t *dest_indexes),
     arg_pass_t param_or_result)
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         __attribute__nonnull__(3)
-        __attribute__nonnull__(4)
-        __attribute__nonnull__(5)
         FUNC_MODIFIES(*src_ctx)
-        FUNC_MODIFIES(*dest_ctx)
-        FUNC_MODIFIES(*src_indexes)
-        FUNC_MODIFIES(*dest_indexes);
+        FUNC_MODIFIES(*dest_ctx);
 
 PARROT_EXPORT
 void Parrot_pcc_invoke_sub_from_c_args(PARROT_INTERP,
@@ -278,9 +274,7 @@
                                         assert(sig);
 #define ASSERT_ARGS_parrot_pass_args assert(interp); \
                                      assert(src_ctx); \
-                                     assert(dest_ctx); \
-                                     assert(src_indexes); \
-                                     assert(dest_indexes);
+                                     assert(dest_ctx);
 #define ASSERT_ARGS_Parrot_pcc_invoke_sub_from_c_args assert(interp); \
                                                       assert(sub_obj); \
                                                       assert(sig);

Modified: trunk/src/inter_call.c
==============================================================================
--- trunk/src/inter_call.c	(original)
+++ trunk/src/inter_call.c	Wed Dec 31 18:15:53 2008
@@ -170,12 +170,11 @@
 static void set_context_sig_returns(PARROT_INTERP,
     ARGMOD(Parrot_Context *ctx),
     ARGMOD(opcode_t **indexes),
-    ARGIN(const char *ret_x),
+    ARGIN_NULLOK(const char *ret_x),
     ARGMOD(PMC *result_list))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         __attribute__nonnull__(3)
-        __attribute__nonnull__(4)
         __attribute__nonnull__(5)
         FUNC_MODIFIES(*ctx)
         FUNC_MODIFIES(*indexes)
@@ -280,7 +279,6 @@
 #define ASSERT_ARGS_set_context_sig_returns assert(interp); \
                                             assert(ctx); \
                                             assert(indexes); \
-                                            assert(ret_x); \
                                             assert(result_list);
 #define ASSERT_ARGS_set_context_sig_returns_varargs assert(interp); \
                                                     assert(ctx); \
@@ -1694,7 +1692,7 @@
 void
 parrot_pass_args(PARROT_INTERP,
         ARGMOD(Parrot_Context *src_ctx), ARGMOD(Parrot_Context *dest_ctx),
-        ARGMOD(opcode_t *src_indexes),   ARGMOD(opcode_t *dest_indexes),
+        ARGMOD_NULLOK(opcode_t *src_indexes), ARGMOD_NULLOK(opcode_t *dest_indexes),
         arg_pass_t param_or_result)
 {
     call_state st;
@@ -2176,8 +2174,9 @@
 */
 
 static void
-set_context_sig_returns(PARROT_INTERP, ARGMOD(Parrot_Context *ctx),
-    ARGMOD(opcode_t **indexes), ARGIN(const char *ret_x), ARGMOD(PMC *result_list))
+set_context_sig_returns(PARROT_INTERP,
+    ARGMOD(Parrot_Context *ctx), ARGMOD(opcode_t **indexes),
+    ARGIN_NULLOK(const char *ret_x), ARGMOD(PMC *result_list))
 {
     const char   *x;
     STRING       *empty_string = CONST_STRING(interp, "");



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About