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

petdance at svn.parrot.org petdance at svn.parrot.org
Wed May 13 22:17:33 UTC 2009


Author: petdance
Date: Wed May 13 22:17:33 2009
New Revision: 38759
URL: https://trac.parrot.org/parrot/changeset/38759

Log:
removed unused return values. shimmed unused arguments. Added some splint decorators.

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

Modified: trunk/include/parrot/packfile.h
==============================================================================
--- trunk/include/parrot/packfile.h	Wed May 13 22:07:12 2009	(r38758)
+++ trunk/include/parrot/packfile.h	Wed May 13 22:17:33 2009	(r38759)
@@ -464,7 +464,7 @@
         __attribute__nonnull__(2);
 
 PARROT_EXPORT
-INTVAL PackFile_add_segment(SHIM_INTERP,
+void PackFile_add_segment(SHIM_INTERP,
     ARGMOD(PackFile_Directory *dir),
     ARGIN(PackFile_Segment *seg))
         __attribute__nonnull__(2)
@@ -491,12 +491,10 @@
 
 PARROT_EXPORT
 PARROT_CANNOT_RETURN_NULL
-PackFile_Segment * PackFile_Annotations_new(PARROT_INTERP,
-    ARGIN(struct PackFile *pf),
+PackFile_Segment * PackFile_Annotations_new(SHIM_INTERP,
+    SHIM(struct PackFile *pf),
     SHIM(const char *name),
-    NULLOK(int add))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
+    NULLOK(int add));
 
 PARROT_EXPORT
 void PackFile_Constant_destroy(SHIM_INTERP,
@@ -618,7 +616,7 @@
         __attribute__nonnull__(2);
 
 PARROT_EXPORT
-INTVAL PackFile_funcs_register(SHIM_INTERP,
+void PackFile_funcs_register(SHIM_INTERP,
     ARGOUT(PackFile *pf),
     UINTVAL type,
     const PackFile_funcs funcs)
@@ -814,6 +812,7 @@
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
+PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
 opcode_t * PackFile_Annotations_pack(PARROT_INTERP,
     ARGIN(PackFile_Segment *seg),
@@ -823,9 +822,9 @@
         __attribute__nonnull__(3)
         FUNC_MODIFIES(*cursor);
 
-size_t PackFile_Annotations_packed_size(PARROT_INTERP,
+PARROT_WARN_UNUSED_RESULT
+size_t PackFile_Annotations_packed_size(SHIM_INTERP,
     ARGIN(PackFile_Segment *seg))
-        __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
 PARROT_CANNOT_RETURN_NULL
@@ -853,9 +852,7 @@
 #define ASSERT_ARGS_PackFile_Annotations_add_group \
      __attribute__unused__ int _ASSERT_ARGS_CHECK = \
        PARROT_ASSERT_ARG(self)
-#define ASSERT_ARGS_PackFile_Annotations_new __attribute__unused__ int _ASSERT_ARGS_CHECK = \
-       PARROT_ASSERT_ARG(interp) \
-    || PARROT_ASSERT_ARG(pf)
+#define ASSERT_ARGS_PackFile_Annotations_new __attribute__unused__ int _ASSERT_ARGS_CHECK = 0
 #define ASSERT_ARGS_PackFile_Constant_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = 0
 #define ASSERT_ARGS_PackFile_Constant_new __attribute__unused__ int _ASSERT_ARGS_CHECK = 0
 #define ASSERT_ARGS_PackFile_Constant_pack_size __attribute__unused__ int _ASSERT_ARGS_CHECK = \
@@ -982,8 +979,7 @@
     || PARROT_ASSERT_ARG(cursor)
 #define ASSERT_ARGS_PackFile_Annotations_packed_size \
      __attribute__unused__ int _ASSERT_ARGS_CHECK = \
-       PARROT_ASSERT_ARG(interp) \
-    || PARROT_ASSERT_ARG(seg)
+       PARROT_ASSERT_ARG(seg)
 #define ASSERT_ARGS_PackFile_Annotations_unpack __attribute__unused__ int _ASSERT_ARGS_CHECK = \
        PARROT_ASSERT_ARG(interp) \
     || PARROT_ASSERT_ARG(seg) \

Modified: trunk/src/packfile.c
==============================================================================
--- trunk/src/packfile.c	Wed May 13 22:07:12 2009	(r38758)
+++ trunk/src/packfile.c	Wed May 13 22:17:33 2009	(r38759)
@@ -1137,7 +1137,7 @@
 
 /*
 
-=item C<INTVAL PackFile_add_segment(PARROT_INTERP, PackFile_Directory *dir,
+=item C<void PackFile_add_segment(PARROT_INTERP, PackFile_Directory *dir,
 PackFile_Segment *seg)>
 
 Adds the Segment C<seg> to the directory C<dir>.  The PackFile becomes the
@@ -1148,7 +1148,7 @@
 */
 
 PARROT_EXPORT
-INTVAL
+void
 PackFile_add_segment(SHIM_INTERP, ARGMOD(PackFile_Directory *dir),
         ARGIN(PackFile_Segment *seg))
 {
@@ -1158,7 +1158,7 @@
     dir->num_segments++;
     seg->dir = dir;
 
-    return 0;
+    return;
 }
 
 
@@ -1407,8 +1407,8 @@
 
 /*
 
-=item C<INTVAL PackFile_funcs_register(PARROT_INTERP, PackFile *pf, UINTVAL
-type, const PackFile_funcs funcs)>
+=item C<void PackFile_funcs_register(PARROT_INTERP, PackFile *pf, UINTVAL type,
+const PackFile_funcs funcs)>
 
 Registers the C<pack>/C<unpack>/... functions for a packfile type.
 
@@ -1417,14 +1417,13 @@
 */
 
 PARROT_EXPORT
-INTVAL
+void
 PackFile_funcs_register(SHIM_INTERP, ARGOUT(PackFile *pf), UINTVAL type,
                         const PackFile_funcs funcs)
 {
     ASSERT_ARGS(PackFile_funcs_register)
     /* TODO dynamic registering */
     pf->PackFuncs[type] = funcs;
-    return 1;
 }
 
 
@@ -4109,14 +4108,14 @@
 PARROT_EXPORT
 PARROT_CANNOT_RETURN_NULL
 PackFile_Segment *
-PackFile_Annotations_new(PARROT_INTERP, ARGIN(struct PackFile *pf),
+PackFile_Annotations_new(SHIM_INTERP, SHIM(struct PackFile *pf),
         SHIM(const char *name), SHIM(int add))
 {
     ASSERT_ARGS(PackFile_Annotations_new)
 
     /* Allocate annotations structure; create it all zeroed, and we will
      * allocate memory for each of the arrays on demand. */
-    PackFile_Annotations *seg = mem_allocate_zeroed_typed(PackFile_Annotations);
+    PackFile_Annotations * const seg = mem_allocate_zeroed_typed(PackFile_Annotations);
     return (PackFile_Segment *) seg;
 }
 
@@ -4174,11 +4173,12 @@
 
 */
 
+PARROT_WARN_UNUSED_RESULT
 size_t
-PackFile_Annotations_packed_size(PARROT_INTERP, ARGIN(PackFile_Segment *seg))
+PackFile_Annotations_packed_size(SHIM_INTERP, ARGIN(PackFile_Segment *seg))
 {
     ASSERT_ARGS(PackFile_Annotations_packed_size)
-    PackFile_Annotations *self = (PackFile_Annotations *)seg;
+    const PackFile_Annotations * const self = (PackFile_Annotations *)seg;
     return 3                      /* Counts. */
          + self->num_keys    * 2  /* Keys. */
          + self->num_groups  * 2  /* Groups. */
@@ -4197,6 +4197,7 @@
 
 */
 
+PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
 opcode_t *
 PackFile_Annotations_pack(PARROT_INTERP, ARGIN(PackFile_Segment *seg),
@@ -4791,13 +4792,13 @@
     ASSERT_ARGS(PackFile_append_pbc)
     PackFile * const pf = Parrot_pbc_read(interp, filename, 0);
 
-    if (!pf)
-        return NULL;
+    if (pf) {
+        PackFile_add_segment(interp, &interp->initial_pf->directory,
+                &pf->directory.base);
 
-    PackFile_add_segment(interp, &interp->initial_pf->directory,
-            &pf->directory.base);
+        do_sub_pragmas(interp, pf->cur_cs, PBC_LOADED, NULL);
+    }
 
-    do_sub_pragmas(interp, pf->cur_cs, PBC_LOADED, NULL);
     return pf;
 }
 


More information about the parrot-commits mailing list