1
0
mirror of https://github.com/irssi/irssi.git synced 2024-09-15 04:28:09 -04:00

cleanup char* casts and replace one useless SvPV with SvPV_nolen

This commit is contained in:
Ailin Nemui 2014-06-25 03:17:03 +02:00
parent 7dbb8efdde
commit f58a461c54
4 changed files with 11 additions and 12 deletions

View File

@ -48,11 +48,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_nolen(p2);
perl_command_bind_to((char *)SvPV_nolen(p0), 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_nolen(p1);
SvPV_nolen(p1);
perl_command_bind_add_hash(priority, p0, category);
}
}
@ -116,7 +116,7 @@ CODE:
if (items != 1 && items != 2)
croak("Usage: Irssi::signal_add(signal, func)");
if (items == 2)
perl_signal_add_full((char *)SvPV_nolen(ST(0)), 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));
@ -127,7 +127,7 @@ CODE:
if (items != 1 && items != 2)
croak("Usage: Irssi::signal_add_first(signal, func)");
if (items == 2)
perl_signal_add_full((char *)SvPV_nolen(ST(0)), 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));
@ -138,7 +138,7 @@ CODE:
if (items != 1 && items != 2)
croak("Usage: Irssi::signal_add_last(signal, func)");
if (items == 2)
perl_signal_add_full((char *)SvPV_nolen(ST(0)), 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));
@ -149,7 +149,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_nolen(ST(0)), 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));

View File

@ -81,7 +81,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_nolen(func));
SvPV_nolen(func));
func = new_pv(name);
g_free(name);
} else {

View File

@ -323,7 +323,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]);
@ -331,7 +330,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));
@ -435,7 +434,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

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