Ticket #1576 (closed todo: done)

Opened 4 years ago

Last modified 4 years ago

Update functions that take STRING * to take const args where possible

Reported by: petdance Owned by:
Priority: normal Milestone:
Component: core Version: 2.3.0
Severity: medium Keywords:
Cc: Language:
Patch status: Platform:

Description (last modified by petdance) (diff)

Now that we theoretically have immutable strings on trunk, we can constify many STRING * arguments in many functions.

* Parrot_str_concat
* Parrot_str_copy
* Parrot_str_substr
* Parrot_str_replace
* Parrot_str_chopn
* Parrot_str_to_hashval
* Parrot_str_upcase
* Parrot_str_downcase
* Parrot_str_titlecase
* Parrot_str_find_cclass
* Parrot_str_find_not_cclass
* Parrot_str_change_charset
* Parrot_str_change_encoding
* Parrot_str_compose
* Parrot_str_join
* Parrot_str_split

From src/spf_render.c

* handle_flags
* str_concat_w_flags
* Parrot_sprintf_format

The entire file needs some heavy consting on the STRINGs.

Attachments

str-consting.patch Download (3.4 KB) - added by tcurtis 4 years ago.
A patch to const Parrot_str_change_charset, Parrot_str_change_encoding, and Parrot_str_split.

Change History

Changed 4 years ago by petdance

  • description modified (diff)

Changed 4 years ago by bacek

Just my $0.02. Biggest opportunity is to change CallContext registers to store constant strings. It will require update of many parts (ops, pmcs, etc) but will give us most const-correctness in strings handling.

Changed 4 years ago by tcurtis

A patch to const Parrot_str_change_charset, Parrot_str_change_encoding, and Parrot_str_split.

Changed 4 years ago by bacek

  • status changed from new to closed
  • resolution set to done

Last function was fixed in 4c6d38e58943cf1149301b65d4d3ec6bc3cfe252. All other changes are superseded by #1906. Closing ticket.

Note: See TracTickets for help on using tickets.