summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2012-08-16 10:50:14 -0600
committerKarl Williamson <public@khwilliamson.com>2012-08-18 11:26:37 -0600
commiteb578fdb5569b91c28466a4d1939e381ff6ceaf4 (patch)
treecb76dfdd15ead716ff76b6a46eb1c49f10b302f2 /mg.c
parent29205e9cdf0a179ed7a2e9401a3b19c8ede062db (diff)
downloadperl-eb578fdb5569b91c28466a4d1939e381ff6ceaf4.tar.gz
Omnibus removal of register declarations
This removes most register declarations in C code (and accompanying documentation) in the Perl core. Retained are those in the ext directory, Configure, and those that are associated with assembly language. See: http://stackoverflow.com/questions/314994/whats-a-good-example-of-register-variable-usage-in-c which says, in part: There is no good example of register usage when using modern compilers (read: last 10+ years) because it almost never does any good and can do some bad. When you use register, you are telling the compiler "I know how to optimize my code better than you do" which is almost never the case. One of three things can happen when you use register: The compiler ignores it, this is most likely. In this case the only harm is that you cannot take the address of the variable in the code. The compiler honors your request and as a result the code runs slower. The compiler honors your request and the code runs faster, this is the least likely scenario. Even if one compiler produces better code when you use register, there is no reason to believe another will do the same. If you have some critical code that the compiler is not optimizing well enough your best bet is probably to use assembler for that part anyway but of course do the appropriate profiling to verify the generated code is really a problem first.
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/mg.c b/mg.c
index 2ac49bff59..3972a87be6 100644
--- a/mg.c
+++ b/mg.c
@@ -612,7 +612,7 @@ Perl_magic_regdata_cnt(pTHX_ SV *sv, MAGIC *mg)
PERL_ARGS_ASSERT_MAGIC_REGDATA_CNT;
if (PL_curpm) {
- register const REGEXP * const rx = PM_GETRE(PL_curpm);
+ const REGEXP * const rx = PM_GETRE(PL_curpm);
if (rx) {
if (mg->mg_obj) { /* @+ */
/* return the number possible */
@@ -641,18 +641,18 @@ Perl_magic_regdatum_get(pTHX_ SV *sv, MAGIC *mg)
PERL_ARGS_ASSERT_MAGIC_REGDATUM_GET;
if (PL_curpm) {
- register const REGEXP * const rx = PM_GETRE(PL_curpm);
+ const REGEXP * const rx = PM_GETRE(PL_curpm);
if (rx) {
- register const I32 paren = mg->mg_len;
- register I32 s;
- register I32 t;
+ const I32 paren = mg->mg_len;
+ I32 s;
+ I32 t;
if (paren < 0)
return 0;
if (paren <= (I32)RX_NPARENS(rx) &&
(s = RX_OFFS(rx)[paren].start) != -1 &&
(t = RX_OFFS(rx)[paren].end) != -1)
{
- register I32 i;
+ I32 i;
if (mg->mg_obj) /* @+ */
i = t;
else /* @- */
@@ -685,9 +685,9 @@ U32
Perl_magic_len(pTHX_ SV *sv, MAGIC *mg)
{
dVAR;
- register I32 paren;
- register I32 i;
- register const REGEXP * rx;
+ I32 paren;
+ I32 i;
+ const REGEXP * rx;
const char * const remaining = mg->mg_ptr + 1;
PERL_ARGS_ASSERT_MAGIC_LEN;
@@ -804,9 +804,9 @@ int
Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
{
dVAR;
- register I32 paren;
- register const char *s = NULL;
- register REGEXP *rx;
+ I32 paren;
+ const char *s = NULL;
+ REGEXP *rx;
const char * const remaining = mg->mg_ptr + 1;
const char nextchar = *remaining;
@@ -1514,7 +1514,7 @@ Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg)
sigset_t set, save;
SV* save_sv;
#endif
- register const char *s = MgPV_const(mg,len);
+ const char *s = MgPV_const(mg,len);
PERL_ARGS_ASSERT_MAGIC_SETSIG;
@@ -2499,9 +2499,9 @@ int
Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
{
dVAR;
- register const char *s;
- register I32 paren;
- register const REGEXP * rx;
+ const char *s;
+ I32 paren;
+ const REGEXP * rx;
const char * const remaining = mg->mg_ptr + 1;
I32 i;
STRLEN len;
@@ -3076,7 +3076,7 @@ Perl_whichsig_pv(pTHX_ const char *sig)
I32
Perl_whichsig_pvn(pTHX_ const char *sig, STRLEN len)
{
- register char* const* sigv;
+ char* const* sigv;
PERL_ARGS_ASSERT_WHICHSIG_PVN;
PERL_UNUSED_CONTEXT;