From: Steven Schubiger Date: Sun, 3 Feb 2008 19:53:16 +0000 (+0100) Subject: sv.c: consting X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=de37a1949aa0086cb5f4db306875e7b8338704bd;p=p5sagit%2Fp5-mst-13.2.git sv.c: consting Message-ID: <20080203185315.GA20276@refcnt.homeunix.org> p4raw-id: //depot/perl@33231 --- diff --git a/embed.fnc b/embed.fnc index 8c050dd..f0f2ca6 100644 --- a/embed.fnc +++ b/embed.fnc @@ -831,7 +831,7 @@ Apd |char* |sv_pvn |NN SV *sv|NN STRLEN *len Apd |char* |sv_pvutf8n |NN SV *sv|NN STRLEN *len Apd |char* |sv_pvbyten |NN SV *sv|NN STRLEN *len Apd |I32 |sv_true |NULLOK SV *sv -pd |void |sv_add_arena |NN char* ptr|U32 size|U32 flags +pd |void |sv_add_arena |NN char *const ptr|const U32 size|const U32 flags Apd |int |sv_backoff |NN SV* sv Apd |SV* |sv_bless |NN SV* sv|NN HV* stash Afpd |void |sv_catpvf |NN SV* sv|NN const char* pat|... @@ -1143,7 +1143,7 @@ s |HV* |require_tie_mod|NN GV *gv|NN const char *varpv|NN SV* namesv \ #endif : #if defined(PERL_IN_HV_C) || defined(PERL_IN_SV_C) || defined(PERL_DECL_PROT) -paRxo |void* |get_arena |size_t svtype|U32 misc +paRxo |void* |get_arena |const size_t svtype|const U32 misc : #endif #if defined(PERL_IN_HV_C) || defined(PERL_DECL_PROT) @@ -1495,7 +1495,7 @@ poM |int |sv_kill_backrefs |NN SV *sv|NN AV *av nsR |char * |uiv_2buf |NN char *buf|IV iv|UV uv|int is_uv|NN char **peob s |void |sv_unglob |NN SV* sv s |void |not_a_number |NN SV *sv -s |I32 |visit |NN SVFUNC_t f|U32 flags|U32 mask +s |I32 |visit |NN SVFUNC_t f|const U32 flags|const U32 mask s |void |sv_del_backref |NN SV *target|NN SV *ref sR |SV * |varname |NULLOK GV *gv|const char gvtype|PADOFFSET targ \ |NULLOK SV *keyname|I32 aindex|int subscript_type @@ -1527,7 +1527,7 @@ sn |char * |F0convert |NV nv|NN char *endbuf|NN STRLEN *len sM |void |sv_release_COW |NN SV *sv|NN const char *pvx|NN SV *after # endif s |SV * |more_sv -s |void * |more_bodies |svtype sv_type +s |void * |more_bodies |const svtype sv_type s |bool |sv_2iuv_common |NN SV *sv s |void |glob_assign_glob|NN SV *dstr|NN SV *sstr|const int dtype s |void |glob_assign_ref|NN SV *dstr|NN SV *sstr @@ -1819,7 +1819,7 @@ Apo |bool |ckwarn_d |U32 w XEopMa |STRLEN *|new_warnings_bitfield|NULLOK STRLEN *buffer \ |NN const char *const bits|STRLEN size -p |void |offer_nice_chunk |NN void *chunk|U32 chunk_size +p |void |offer_nice_chunk |NN void *const chunk|const U32 chunk_size #ifndef SPRINTF_RETURNS_STRLEN Apnod |int |my_sprintf |NN char *buffer|NN const char *pat|... diff --git a/pod/perlintern.pod b/pod/perlintern.pod index 1bcff4a..3703b40 100644 --- a/pod/perlintern.pod +++ b/pod/perlintern.pod @@ -998,7 +998,7 @@ X Given a chunk of memory, link it to the head of the list of arenas, and split it into a list of free SVs. - void sv_add_arena(char* ptr, U32 size, U32 flags) + void sv_add_arena(char *const ptr, const U32 size, const U32 flags) =for hackers Found in file sv.c diff --git a/proto.h b/proto.h index fa5b1b6..eac3dd3 100644 --- a/proto.h +++ b/proto.h @@ -2223,7 +2223,7 @@ PERL_CALLCONV char* Perl_sv_pvbyten(pTHX_ SV *sv, STRLEN *len) __attribute__nonnull__(pTHX_2); PERL_CALLCONV I32 Perl_sv_true(pTHX_ SV *sv); -PERL_CALLCONV void Perl_sv_add_arena(pTHX_ char* ptr, U32 size, U32 flags) +PERL_CALLCONV void Perl_sv_add_arena(pTHX_ char *const ptr, const U32 size, const U32 flags) __attribute__nonnull__(pTHX_1); PERL_CALLCONV int Perl_sv_backoff(pTHX_ SV* sv) @@ -3023,7 +3023,7 @@ STATIC HV* S_require_tie_mod(pTHX_ GV *gv, const char *varpv, SV* namesv, const #endif -PERL_CALLCONV void* Perl_get_arena(pTHX_ size_t svtype, U32 misc) +PERL_CALLCONV void* Perl_get_arena(pTHX_ const size_t svtype, const U32 misc) __attribute__malloc__ __attribute__warn_unused_result__; @@ -3956,7 +3956,7 @@ STATIC void S_sv_unglob(pTHX_ SV* sv) STATIC void S_not_a_number(pTHX_ SV *sv) __attribute__nonnull__(pTHX_1); -STATIC I32 S_visit(pTHX_ SVFUNC_t f, U32 flags, U32 mask) +STATIC I32 S_visit(pTHX_ SVFUNC_t f, const U32 flags, const U32 mask) __attribute__nonnull__(pTHX_1); STATIC void S_sv_del_backref(pTHX_ SV *target, SV *ref) @@ -4022,7 +4022,7 @@ STATIC void S_sv_release_COW(pTHX_ SV *sv, const char *pvx, SV *after) # endif STATIC SV * S_more_sv(pTHX); -STATIC void * S_more_bodies(pTHX_ svtype sv_type); +STATIC void * S_more_bodies(pTHX_ const svtype sv_type); STATIC bool S_sv_2iuv_common(pTHX_ SV *sv) __attribute__nonnull__(pTHX_1); @@ -4556,7 +4556,7 @@ PERL_CALLCONV STRLEN * Perl_new_warnings_bitfield(pTHX_ STRLEN *buffer, const ch __attribute__nonnull__(pTHX_2); -PERL_CALLCONV void Perl_offer_nice_chunk(pTHX_ void *chunk, U32 chunk_size) +PERL_CALLCONV void Perl_offer_nice_chunk(pTHX_ void *const chunk, const U32 chunk_size) __attribute__nonnull__(pTHX_1); diff --git a/sv.c b/sv.c index d30f077..9ef94dc 100644 --- a/sv.c +++ b/sv.c @@ -154,7 +154,7 @@ Public API: */ void -Perl_offer_nice_chunk(pTHX_ void *chunk, U32 chunk_size) +Perl_offer_nice_chunk(pTHX_ void *const chunk, const U32 chunk_size) { dVAR; void *new_chunk; @@ -332,7 +332,7 @@ and split it into a list of free SVs. */ void -Perl_sv_add_arena(pTHX_ char *ptr, U32 size, U32 flags) +Perl_sv_add_arena(pTHX_ char *const ptr, const U32 size, const U32 flags) { dVAR; SV* const sva = (SV*)ptr; @@ -370,7 +370,7 @@ Perl_sv_add_arena(pTHX_ char *ptr, U32 size, U32 flags) * whose flags field matches the flags/mask args. */ STATIC I32 -S_visit(pTHX_ SVFUNC_t f, U32 flags, U32 mask) +S_visit(pTHX_ SVFUNC_t f, const U32 flags, const U32 mask) { dVAR; SV* sva; @@ -427,7 +427,7 @@ Perl_sv_report_used(pTHX) /* called by sv_clean_objs() for each live SV */ static void -do_clean_objs(pTHX_ SV *ref) +do_clean_objs(pTHX_ SV *const ref) { dVAR; assert (SvROK(ref)); @@ -503,7 +503,7 @@ Perl_sv_clean_objs(pTHX) /* called by sv_clean_all() for each live SV */ static void -do_clean_all(pTHX_ SV *sv) +do_clean_all(pTHX_ SV *const sv) { dVAR; DEBUG_D((PerlIO_printf(Perl_debug_log, "Cleaning loops: SV at 0x%"UVxf"\n", PTR2UV(sv)) )); @@ -663,7 +663,7 @@ Perl_sv_free_arenas(pTHX) TBD: export properly for hv.c: S_more_he(). */ void* -Perl_get_arena(pTHX_ size_t arena_size, U32 misc) +Perl_get_arena(pTHX_ const size_t arena_size, const U32 misc) { dVAR; struct arena_desc* adesc; @@ -1027,7 +1027,7 @@ static const struct body_details bodies_by_type[] = { my_safecalloc((details)->body_size + (details)->offset) STATIC void * -S_more_bodies (pTHX_ svtype sv_type) +S_more_bodies (pTHX_ const svtype sv_type) { dVAR; void ** const root = &PL_body_roots[sv_type]; @@ -1090,7 +1090,7 @@ S_more_bodies (pTHX_ svtype sv_type) #ifndef PURIFY STATIC void * -S_new_body(pTHX_ svtype sv_type) +S_new_body(pTHX_ const svtype sv_type) { dVAR; void *xpv;