summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Færøy <ahf@0x90.dk>2014-06-27 14:31:04 +0200
committerAlexander Færøy <ahf@0x90.dk>2014-06-27 14:31:04 +0200
commitb8c2915d79a1e0ccec92e627b716fe0a6af81fc6 (patch)
tree57f01b2716bd7ab4159eb68ac5fb9aec88a48d59
parente4051eb42e7ab9965c9e523c443dca26326ef73a (diff)
parentf58a461c54f2189543d64303e8c80bacda78448d (diff)
downloadirssi-b8c2915d79a1e0ccec92e627b716fe0a6af81fc6.zip
Merge pull request #59 from ailin-nemui/perl-pl-na
get rid of PL_na
-rw-r--r--src/perl/common/Core.xs16
-rw-r--r--src/perl/common/Expando.xs4
-rw-r--r--src/perl/irc/Server.xs2
-rw-r--r--src/perl/perl-common.c4
-rw-r--r--src/perl/perl-core.c2
-rw-r--r--src/perl/perl-signals.c7
-rw-r--r--src/perl/perl-sources.c2
-rw-r--r--src/perl/textui/Statusbar.xs2
-rw-r--r--src/perl/ui/Formats.xs2
-rw-r--r--src/perl/ui/Themes.xs16
10 files changed, 28 insertions, 29 deletions
diff --git a/src/perl/common/Core.xs b/src/perl/common/Core.xs
index 84f660ba..bfe2efde 100644
--- a/src/perl/common/Core.xs
+++ b/src/perl/common/Core.xs
@@ -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);
diff --git a/src/perl/common/Expando.xs b/src/perl/common/Expando.xs
index e1dd89ab..375a4c2f 100644
--- a/src/perl/common/Expando.xs
+++ b/src/perl/common/Expando.xs
@@ -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;
diff --git a/src/perl/irc/Server.xs b/src/perl/irc/Server.xs
index 4fe0d6b5..0e9ec672 100644
--- a/src/perl/irc/Server.xs
+++ b/src/perl/irc/Server.xs
@@ -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));
diff --git a/src/perl/perl-common.c b/src/perl/perl-common.c
index 43325a82..c5037ba6 100644
--- a/src/perl/perl-common.c
+++ b/src/perl/perl-common.c
@@ -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 {
diff --git a/src/perl/perl-core.c b/src/perl/perl-core.c
index 26138510..3b00ce18 100644
--- a/src/perl/perl-core.c
+++ b/src/perl/perl-core.c
@@ -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);
diff --git a/src/perl/perl-signals.c b/src/perl/perl-signals.c
index 0173ff15..d0670ba2 100644
--- a/src/perl/perl-signals.c
+++ b/src/perl/perl-signals.c
@@ -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)
{
diff --git a/src/perl/perl-sources.c b/src/perl/perl-sources.c
index d36329c9..33fe6dd1 100644
--- a/src/perl/perl-sources.c
+++ b/src/perl/perl-sources.c
@@ -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);
}
diff --git a/src/perl/textui/Statusbar.xs b/src/perl/textui/Statusbar.xs
index 7336c3cd..d1241ae1 100644
--- a/src/perl/textui/Statusbar.xs
+++ b/src/perl/textui/Statusbar.xs
@@ -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);
diff --git a/src/perl/ui/Formats.xs b/src/perl/ui/Formats.xs
index 5c59bc5c..c10f0b4e 100644
--- a/src/perl/ui/Formats.xs
+++ b/src/perl/ui/Formats.xs
@@ -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);
diff --git a/src/perl/ui/Themes.xs b/src/perl/ui/Themes.xs
index 1a782dc0..dc5f6272 100644
--- a/src/perl/ui/Themes.xs
+++ b/src/perl/ui/Themes.xs
@@ -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);