diff options
author | Ailin Nemui <ailin@esf51.localdomain> | 2014-06-25 03:17:03 +0200 |
---|---|---|
committer | Ailin Nemui <ailin@esf51.localdomain> | 2014-06-25 03:17:03 +0200 |
commit | f58a461c54f2189543d64303e8c80bacda78448d (patch) | |
tree | 62d0d862fce3df1f7f7eadb05e194260e83ee922 /src | |
parent | 7dbb8efdde3720fd15f06de088848259e24e3397 (diff) | |
download | irssi-f58a461c54f2189543d64303e8c80bacda78448d.zip |
cleanup char* casts and replace one useless SvPV with SvPV_nolen
Diffstat (limited to 'src')
-rw-r--r-- | src/perl/common/Core.xs | 14 | ||||
-rw-r--r-- | src/perl/perl-common.c | 2 | ||||
-rw-r--r-- | src/perl/perl-signals.c | 5 | ||||
-rw-r--r-- | src/perl/ui/Formats.xs | 2 |
4 files changed, 11 insertions, 12 deletions
diff --git a/src/perl/common/Core.xs b/src/perl/common/Core.xs index 719c0303..3358f5eb 100644 --- a/src/perl/common/Core.xs +++ b/src/perl/common/Core.xs @@ -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)); diff --git a/src/perl/perl-common.c b/src/perl/perl-common.c index 12df78f7..a1b04b11 100644 --- a/src/perl/perl-common.c +++ b/src/perl/perl-common.c @@ -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 { diff --git a/src/perl/perl-signals.c b/src/perl/perl-signals.c index 02716b2f..cca989e9 100644 --- a/src/perl/perl-signals.c +++ b/src/perl/perl-signals.c @@ -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) { diff --git a/src/perl/ui/Formats.xs b/src/perl/ui/Formats.xs index 74add583..c16aa5a0 100644 --- a/src/perl/ui/Formats.xs +++ b/src/perl/ui/Formats.xs @@ -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); |