1
0
mirror of https://github.com/irssi/irssi.git synced 2024-10-27 05:20:20 -04:00

Merge pull request #59 from ailin-nemui/perl-pl-na

get rid of PL_na
This commit is contained in:
Alexander Færøy 2014-06-27 14:31:04 +02:00
commit b8c2915d79
10 changed files with 28 additions and 29 deletions

View File

@ -49,11 +49,11 @@ static void handle_command_bind(int priority, int items, SV *p0, SV *p1, SV *p2)
if (!hash) {
category = items < 3 ? DEFAULT_COMMAND_CATEGORY :
(char *)SvPV(p2, PL_na);
perl_command_bind_to((char *)SvPV(p0, PL_na), category, p1, priority);
SvPV_nolen(p2);
perl_command_bind_to(SvPV_nolen(p0), category, p1, priority);
} else {
category = items < 2 ? DEFAULT_COMMAND_CATEGORY :
(char *)SvPV(p1, PL_na);
SvPV_nolen(p1);
perl_command_bind_add_hash(priority, p0, category);
}
}
@ -117,7 +117,7 @@ CODE:
if (items != 1 && items != 2)
croak("Usage: Irssi::signal_add(signal, func)");
if (items == 2)
perl_signal_add_full((char *)SvPV(ST(0),PL_na), ST(1),
perl_signal_add_full(SvPV_nolen(ST(0)), ST(1),
SIGNAL_PRIORITY_DEFAULT);
else
perl_signal_add_hash(SIGNAL_PRIORITY_DEFAULT, ST(0));
@ -128,7 +128,7 @@ CODE:
if (items != 1 && items != 2)
croak("Usage: Irssi::signal_add_first(signal, func)");
if (items == 2)
perl_signal_add_full((char *)SvPV(ST(0),PL_na), ST(1),
perl_signal_add_full(SvPV_nolen(ST(0)), ST(1),
SIGNAL_PRIORITY_HIGH);
else
perl_signal_add_hash(SIGNAL_PRIORITY_HIGH, ST(0));
@ -139,7 +139,7 @@ CODE:
if (items != 1 && items != 2)
croak("Usage: Irssi::signal_add_last(signal, func)");
if (items == 2)
perl_signal_add_full((char *)SvPV(ST(0),PL_na), ST(1),
perl_signal_add_full(SvPV_nolen(ST(0)), ST(1),
SIGNAL_PRIORITY_LOW);
else
perl_signal_add_hash(SIGNAL_PRIORITY_LOW, ST(0));
@ -150,7 +150,7 @@ CODE:
if (items != 2 && items != 3)
croak("Usage: Irssi::signal_add_priority(signal, func, priority)");
if (items == 3)
perl_signal_add_full((char *)SvPV(ST(0),PL_na), ST(1), SvIV(ST(2)));
perl_signal_add_full(SvPV_nolen(ST(0)), ST(1), SvIV(ST(2)));
else
perl_signal_add_hash(SvIV(ST(0)), ST(1));
@ -180,7 +180,7 @@ CODE:
if (len > 6) len = 6;
for (pos = 0; pos < len; pos++) {
SV **val = av_fetch(av, pos, 0);
arr[pos] = SvPV(*val, PL_na);
arr[pos] = SvPV_nolen(*val);
}
arr[pos] = NULL;
perl_signal_register(key, arr);

View File

@ -78,7 +78,7 @@ static char *perl_expando_event(PerlExpando *rec, SERVER_REC *server,
if (rec->script != NULL)
script_unregister_expandos(rec->script);
signal_emit("script error", 2, rec->script, SvPV(ERRSV, PL_na));
signal_emit("script error", 2, rec->script, SvPV_nolen(ERRSV));
} else if (retcount > 0) {
ret = g_strdup(POPp);
*free_ret = TRUE;
@ -118,7 +118,7 @@ static void expando_signals_add_hash(const char *key, SV *signals)
hv_iterinit(hv);
while ((he = hv_iternext(hv)) != NULL) {
SV *argsv = HeVAL(he);
argstr = SvPV(argsv, PL_na);
argstr = SvPV_nolen(argsv);
if (g_ascii_strcasecmp(argstr, "none") == 0)
arg = EXPANDO_ARG_NONE;

View File

@ -35,7 +35,7 @@ static GSList *event_hash2list(HV *hv)
while ((he = hv_iternext(hv)) != NULL) {
I32 len;
char *key = hv_iterkey(he, &len);
char *value = SvPV(HeVAL(he), PL_na);
char *value = SvPV_nolen(HeVAL(he));
list = g_slist_append(list, g_strdup(key));
list = g_slist_append(list, g_strdup(value));

View File

@ -55,7 +55,7 @@ static GSList *use_protocols;
/* returns the package who called us */
const char *perl_get_package(void)
{
return SvPV(perl_eval_pv("caller", TRUE), PL_na);
return SvPV_nolen(perl_eval_pv("caller", TRUE));
}
/* Parses the package part from function name */
@ -82,7 +82,7 @@ SV *perl_func_sv_inc(SV *func, const char *package)
if (SvPOK(func)) {
/* prefix with package name */
name = g_strdup_printf("%s::%s", package,
(char *) SvPV(func, PL_na));
SvPV_nolen(func));
func = new_pv(name);
g_free(name);
} else {

View File

@ -238,7 +238,7 @@ static int perl_script_eval(PERL_SCRIPT_REC *script)
error = NULL;
if (SvTRUE(ERRSV)) {
error = SvPV(ERRSV, PL_na);
error = SvPV_nolen(ERRSV);
if (error != NULL) {
error = g_strdup(error);

View File

@ -303,7 +303,7 @@ static void perl_call_signal(PERL_SCRIPT_REC *script, SV *func,
SPAGAIN;
if (SvTRUE(ERRSV)) {
char *error = g_strdup(SvPV(ERRSV, PL_na));
char *error = g_strdup(SvPV_nolen(ERRSV));
signal_emit("script error", 2, script, error);
g_free(error);
rec = NULL;
@ -324,7 +324,6 @@ static void perl_call_signal(PERL_SCRIPT_REC *script, SV *func,
GList **ret = arg;
GList *out = NULL;
void *val;
STRLEN len;
int count;
av = (AV *) SvRV(saved_args[n]);
@ -332,7 +331,7 @@ static void perl_call_signal(PERL_SCRIPT_REC *script, SV *func,
while (count-- >= 0) {
sv = av_shift(av);
if (SvPOKp(sv))
val = g_strdup(SvPV(sv, len));
val = g_strdup(SvPV_nolen(sv));
else
val = GINT_TO_POINTER(SvIV(sv));
@ -436,7 +435,7 @@ static void perl_signal_remove_list_one(GSList **siglist, PERL_SIGNAL_REC *rec)
#define sv_func_cmp(f1, f2) \
(f1 == f2 || (SvPOK(f1) && SvPOK(f2) && \
strcmp((char *) SvPV_nolen(f1), (char *) SvPV_nolen(f2)) == 0))
strcmp(SvPV_nolen(f1), SvPV_nolen(f2)) == 0))
static void perl_signal_remove_list(GSList **list, SV *func)
{

View File

@ -83,7 +83,7 @@ static int perl_source_event(PERL_SOURCE_REC *rec)
SPAGAIN;
if (SvTRUE(ERRSV)) {
char *error = g_strdup(SvPV(ERRSV, PL_na));
char *error = g_strdup(SvPV_nolen(ERRSV));
signal_emit("script error", 2, rec->script, error);
g_free(error);
}

View File

@ -78,7 +78,7 @@ static void perl_statusbar_event(char *function, SBAR_ITEM_REC *item,
/* make sure we don't get back here */
script_unregister_statusbars(script);
}
signal_emit("script error", 2, script, SvPV(ERRSV, PL_na));
signal_emit("script error", 2, script, SvPV_nolen(ERRSV));
} else {
/* min_size and max_size can be changed, move them to SBAR_ITEM_REC */
hv = hvref(item_sv);

View File

@ -90,7 +90,7 @@ PREINIT:
PPCODE:
charargs = g_new0(char *, items-5+1);
for (n = 5; n < items; n++) {
charargs[n-5] = (char *)SvPV(ST(n), PL_na);
charargs[n-5] = SvPV_nolen(ST(n));
}
format_create_dest(&dest, server, target, 0, window);

View File

@ -106,8 +106,8 @@ CODE:
formatrecs[0].def = g_strdup("Perl script");
for (fpos = 1, n = 0; n < len; n++, fpos++) {
key = SvPV(*av_fetch(av, n, 0), PL_na); n++;
value = SvPV(*av_fetch(av, n, 0), PL_na);
key = SvPV_nolen(*av_fetch(av, n, 0)); n++;
value = SvPV_nolen(*av_fetch(av, n, 0));
formatrecs[fpos].tag = g_strdup(key);
formatrecs[fpos].def = g_strdup(value);
@ -128,7 +128,7 @@ CODE:
format_create_dest(&dest, NULL, NULL, level, NULL);
memset(arglist, 0, sizeof(arglist));
for (n = 2; n < items && n < MAX_FORMAT_PARAMS+2; n++) {
arglist[n-2] = SvPV(ST(n), PL_na);
arglist[n-2] = SvPV_nolen(ST(n));
}
printformat_perl(&dest, format, arglist);
@ -149,8 +149,8 @@ CODE:
croak("abstracts list is invalid - not divisible by 2 (%d)", len);
for (i = 0; i < len; i++) {
key = SvPV(*av_fetch(av, i, 0), PL_na); i++;
value = SvPV(*av_fetch(av, i, 0), PL_na);
key = SvPV_nolen(*av_fetch(av, i, 0)); i++;
value = SvPV_nolen(*av_fetch(av, i, 0));
theme_set_default_abstract(key, value);
}
@ -177,7 +177,7 @@ CODE:
format_create_dest(&dest, server, target, level, NULL);
memset(arglist, 0, sizeof(arglist));
for (n = 4; n < items && n < MAX_FORMAT_PARAMS+4; n++) {
arglist[n-4] = SvPV(ST(n), PL_na);
arglist[n-4] = SvPV_nolen(ST(n));
}
printformat_perl(&dest, format, arglist);
@ -199,7 +199,7 @@ CODE:
format_create_dest(&dest, NULL, NULL, level, window);
memset(arglist, 0, sizeof(arglist));
for (n = 3; n < items && n < MAX_FORMAT_PARAMS+3; n++) {
arglist[n-3] = SvPV(ST(n), PL_na);
arglist[n-3] = SvPV_nolen(ST(n));
}
printformat_perl(&dest, format, arglist);
@ -221,7 +221,7 @@ CODE:
format_create_dest(&dest, item->server, item->visible_name, level, NULL);
memset(arglist, 0, sizeof(arglist));
for (n = 3; n < items && n < MAX_FORMAT_PARAMS+3; n++) {
arglist[n-3] = SvPV(ST(n), PL_na);
arglist[n-3] = SvPV_nolen(ST(n));
}
printformat_perl(&dest, format, arglist);