Permalink
Browse files

Parrot_pa_is_owned() is not something for public consumption, and doe…

…s not use the interp, so get rid of the interp as an argument. Also, all arguments to the function can be consted.
  • Loading branch information...
1 parent 67cec30 commit f5cec3449befa388bdde3f096b0db450fd9f70e4 @petdance petdance committed Mar 26, 2012
Showing with 18 additions and 18 deletions.
  1. +7 −8 include/parrot/pointer_array.h
  2. +3 −3 src/gc/gc_gms.c
  3. +2 −2 src/gc/gc_ms2.c
  4. +6 −5 src/pointer_array.c
@@ -152,13 +152,13 @@ void Parrot_pa_destroy(PARROT_INTERP, ARGFREE(Parrot_Pointer_Array *self))
__attribute__nonnull__(1);
PARROT_EXPORT
-int Parrot_pa_is_owned(PARROT_INTERP,
- ARGIN(Parrot_Pointer_Array *self),
- ARGIN(void *orig),
- ARGIN_NULLOK(void *ref))
+PARROT_WARN_UNUSED_RESULT
+int Parrot_pa_is_owned(
+ ARGIN(const Parrot_Pointer_Array *self),
+ ARGIN(const void *orig),
+ ARGIN_NULLOK(const void *ref))
__attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3);
+ __attribute__nonnull__(2);
PARROT_EXPORT
PARROT_MALLOC
@@ -182,8 +182,7 @@ size_t Parrot_pa_count_used(PARROT_INTERP,
#define ASSERT_ARGS_Parrot_pa_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_pa_is_owned __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(self) \
+ PARROT_ASSERT_ARG(self) \
, PARROT_ASSERT_ARG(orig))
#define ASSERT_ARGS_Parrot_pa_new __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
View
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2001-2011, Parrot Foundation.
+Copyright (C) 2001-2012, Parrot Foundation.
=head1 NAME
@@ -1488,7 +1488,7 @@ gc_gms_is_pmc_ptr(PARROT_INTERP, ARGIN_NULLOK(void *ptr))
return 0;
/* Pool.is_owned isn't precise enough (yet) */
- if (Parrot_pa_is_owned(interp, self->objects[POBJ2GEN(obj)], item, item->ptr)) {
+ if (Parrot_pa_is_owned(self->objects[POBJ2GEN(obj)], item, item->ptr)) {
if (POBJ2GEN(obj) == 0)
PObj_GC_soil_root_SET(obj);
return 1;
@@ -1614,7 +1614,7 @@ gc_gms_is_string_ptr(PARROT_INTERP, ARGIN_NULLOK(void *ptr))
if (POBJ2GEN(&item->str) > self->gen_to_collect)
return 0;
- if (Parrot_pa_is_owned(interp, self->strings[POBJ2GEN(obj)], item, item->ptr))
+ if (Parrot_pa_is_owned(self->strings[POBJ2GEN(obj)], item, item->ptr))
return 1;
return 0;
View
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2001-2011, Parrot Foundation.
+Copyright (C) 2001-2012, Parrot Foundation.
=head1 NAME
@@ -1272,7 +1272,7 @@ gc_ms2_is_ptr_owned(PARROT_INTERP,
return 0;
/* Pool.is_owned isn't precise enough (yet) */
- return Parrot_pa_is_owned(interp, list, item, item->ptr);
+ return Parrot_pa_is_owned(list, item, item->ptr);
}
View
@@ -104,18 +104,19 @@ Parrot_pa_count_used(PARROT_INTERP, ARGIN(const Parrot_Pointer_Array *self))
/*
-=item C<int Parrot_pa_is_owned(PARROT_INTERP, Parrot_Pointer_Array *self, void
-*orig, void *ref)>
+=item C<int Parrot_pa_is_owned(const Parrot_Pointer_Array *self, const void
+*orig, const void *ref)>
Check that C<orig> pointer is stored in C<ref> cell. Used during system stack t
=cut
*/
PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
int
-Parrot_pa_is_owned(PARROT_INTERP, ARGIN(Parrot_Pointer_Array *self),
- ARGIN(void *orig), ARGIN_NULLOK(void *ref))
+Parrot_pa_is_owned(ARGIN(const Parrot_Pointer_Array *self),
+ ARGIN(const void *orig), ARGIN_NULLOK(const void *ref))
{
ASSERT_ARGS(Parrot_pa_is_owned)
size_t i;
@@ -132,7 +133,7 @@ Parrot_pa_is_owned(PARROT_INTERP, ARGIN(Parrot_Pointer_Array *self),
continue;
if (PTR2UINTVAL(ref) > PTR2UINTVAL(chunk) + CHUNK_SIZE)
continue;
- return (*(void **)ref == orig);
+ return (*(void * const *)ref == orig);
}
return 0;

0 comments on commit f5cec34

Please sign in to comment.