Proper use of static funcs in toke.c and pp_sys.c
Andy Lester [Tue, 9 May 2006 12:27:30 +0000 (07:27 -0500)]
Message-ID: <20060509172730.GA5272@petdance.com>

p4raw-id: //depot/perl@28179

embed.fnc
embed.h
pp_sys.c
proto.h
toke.c

index f37a720..1d98dff 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -1452,6 +1452,7 @@ s |void   |strip_return   |NN SV *sv
 #  endif
 #  if defined(DEBUGGING)
 s      |int    |tokereport     |I32 rv
+s      |void   |printbuf       |NN const char* fmt|NN const char* s
 #  endif
 #endif
 
diff --git a/embed.h b/embed.h
index 5edf4ba..9383ce6 100644 (file)
--- a/embed.h
+++ b/embed.h
 #  if defined(DEBUGGING)
 #ifdef PERL_CORE
 #define tokereport             S_tokereport
+#define printbuf               S_printbuf
 #endif
 #  endif
 #endif
 #  if defined(DEBUGGING)
 #ifdef PERL_CORE
 #define tokereport(a)          S_tokereport(aTHX_ a)
+#define printbuf(a,b)          S_printbuf(aTHX_ a,b)
 #endif
 #  endif
 #endif
index 2df5a77..a111f1e 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -4647,7 +4647,7 @@ PP(pp_ghostent)
 
     if (hent) {
        PUSHs(sv_2mortal(newSVpv((char*)hent->h_name, 0)));
-       PUSHs(S_space_join_names_mortal(aTHX_ hent->h_aliases));
+       PUSHs(space_join_names_mortal(hent->h_aliases));
        PUSHs(sv_2mortal(newSViv((IV)hent->h_addrtype)));
        len = hent->h_length;
        PUSHs(sv_2mortal(newSViv((IV)len)));
@@ -4730,7 +4730,7 @@ PP(pp_gnetent)
 
     if (nent) {
        PUSHs(sv_2mortal(newSVpv(nent->n_name, 0)));
-       PUSHs(S_space_join_names_mortal(aTHX_ nent->n_aliases));
+       PUSHs(space_join_names_mortal(nent->n_aliases));
        PUSHs(sv_2mortal(newSViv((IV)nent->n_addrtype)));
        PUSHs(sv_2mortal(newSViv((IV)nent->n_net)));
     }
@@ -4791,7 +4791,7 @@ PP(pp_gprotoent)
 
     if (pent) {
        PUSHs(sv_2mortal(newSVpv(pent->p_name, 0)));
-       PUSHs(S_space_join_names_mortal(aTHX_ pent->p_aliases));
+       PUSHs(space_join_names_mortal(pent->p_aliases));
        PUSHs(sv_2mortal(newSViv((IV)pent->p_proto)));
     }
 
@@ -4861,7 +4861,7 @@ PP(pp_gservent)
 
     if (sent) {
        PUSHs(sv_2mortal(newSVpv(sent->s_name, 0)));
-       PUSHs(S_space_join_names_mortal(aTHX_ sent->s_aliases));
+       PUSHs(space_join_names_mortal(sent->s_aliases));
 #ifdef HAS_NTOHS
        PUSHs(sv_2mortal(newSViv((IV)PerlSock_ntohs(sent->s_port))));
 #else
@@ -5278,7 +5278,7 @@ PP(pp_ggrent)
         * but the gr_mem is poisonous anyway.
         * So yes, you cannot get the list of group
         * members if building multithreaded in UNICOS/mk. */
-       PUSHs(S_space_join_names_mortal(aTHX_ grent->gr_mem));
+       PUSHs(space_join_names_mortal(grent->gr_mem));
 #endif
     }
 
diff --git a/proto.h b/proto.h
index c59d5a7..5ab1d5e 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -3944,6 +3944,10 @@ STATIC void      S_strip_return(pTHX_ SV *sv)
 #  endif
 #  if defined(DEBUGGING)
 STATIC int     S_tokereport(pTHX_ I32 rv);
+STATIC void    S_printbuf(pTHX_ const char* fmt, const char* s)
+                       __attribute__nonnull__(pTHX_1)
+                       __attribute__nonnull__(pTHX_2);
+
 #  endif
 #endif
 
diff --git a/toke.c b/toke.c
index 23f801e..173474c 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -3816,9 +3816,7 @@ Perl_yylex(pTHX)
 
            if (strnEQ(s,"=>",2)) {
                s = force_word(PL_bufptr,WORD,FALSE,FALSE,FALSE);
-                DEBUG_T( { S_printbuf(aTHX_
-                       "### Saw unary minus before =>, forcing word %s\n", s);
-                } );
+               DEBUG_T( { printbuf("### Saw unary minus before =>, forcing word %s\n", s); } );
                OPERATOR('-');          /* unary minus */
            }
            PL_last_uni = PL_oldbufptr;
@@ -4788,14 +4786,14 @@ Perl_yylex(pTHX)
     case '0': case '1': case '2': case '3': case '4':
     case '5': case '6': case '7': case '8': case '9':
        s = scan_num(s, &yylval);
-       DEBUG_T( { S_printbuf(aTHX_ "### Saw number in %s\n", s); } );
+       DEBUG_T( { printbuf("### Saw number in %s\n", s); } );
        if (PL_expect == XOPERATOR)
            no_op("Number",s);
        TERM(THING);
 
     case '\'':
        s = scan_str(s,!!PL_madskills,FALSE);
-       DEBUG_T( { S_printbuf(aTHX_ "### Saw string before %s\n", s); } );
+       DEBUG_T( { printbuf("### Saw string before %s\n", s); } );
        if (PL_expect == XOPERATOR) {
            if (PL_lex_formbrack && PL_lex_brackets == PL_lex_formbrack) {
                PL_expect = XTERM;
@@ -4812,7 +4810,7 @@ Perl_yylex(pTHX)
 
     case '"':
        s = scan_str(s,!!PL_madskills,FALSE);
-       DEBUG_T( { S_printbuf(aTHX_ "### Saw string before %s\n", s); } );
+       DEBUG_T( { printbuf("### Saw string before %s\n", s); } );
        if (PL_expect == XOPERATOR) {
            if (PL_lex_formbrack && PL_lex_brackets == PL_lex_formbrack) {
                PL_expect = XTERM;
@@ -4837,7 +4835,7 @@ Perl_yylex(pTHX)
 
     case '`':
        s = scan_str(s,!!PL_madskills,FALSE);
-       DEBUG_T( { S_printbuf(aTHX_ "### Saw backtick string before %s\n", s); } );
+       DEBUG_T( { printbuf("### Saw backtick string before %s\n", s); } );
        if (PL_expect == XOPERATOR)
            no_op("Backticks",s);
        if (!s)