1
0
mirror of https://github.com/irssi/irssi.git synced 2024-09-01 04:14:16 -04:00

I always forget Perl 5.004 doesn't have PL_na .. so, now I've declared for

5.004, and changed all STRLEN n_a code to use PL_na instead.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2238 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-12-11 16:44:53 +00:00 committed by cras
parent d4ee6fd604
commit 617123b5d4
10 changed files with 21 additions and 35 deletions

View File

@ -22,8 +22,6 @@ PROTOTYPES: ENABLE
void
signal_emit(signal, ...)
char *signal
PREINIT:
STRLEN n_a;
CODE:
void *p[SIGNAL_MAX_ARGUMENTS];
int n;
@ -31,7 +29,7 @@ CODE:
memset(p, 0, sizeof(p));
for (n = 1; n < items && n < SIGNAL_MAX_ARGUMENTS+1; n++) {
if (SvPOKp(ST(n)))
p[n-1] = SvPV(ST(n), n_a);
p[n-1] = SvPV(ST(n), PL_na);
else if (irssi_is_ref_object(ST(n)))
p[n-1] = irssi_ref_object(ST(n));
else

View File

@ -25,7 +25,6 @@ static GSList *event_hash2list(HV *hv)
{
HE *he;
GSList *list;
STRLEN n_a;
if (hv == NULL)
return NULL;
@ -35,7 +34,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), n_a);
char *value = SvPV(HeVAL(he), PL_na);
list = g_slist_append(list, g_strdup(key));
list = g_slist_append(list, g_strdup(value));

View File

@ -47,14 +47,17 @@ typedef struct {
PERL_OBJECT_FUNC fill_func;
} PERL_OBJECT_REC;
#ifndef HAVE_PL_PERL
STRLEN PL_na;
#endif
static GHashTable *iobject_stashes, *plain_stashes;
static GSList *use_protocols;
/* returns the package who called us */
const char *perl_get_package(void)
{
STRLEN n_a;
return SvPV(perl_eval_pv("caller", TRUE), n_a);
return SvPV(perl_eval_pv("caller", TRUE), PL_na);
}
/* Parses the package part from function name */
@ -76,13 +79,12 @@ char *perl_function_get_package(const char *function)
SV *perl_func_sv_inc(SV *func, const char *package)
{
STRLEN n_a;
char *name;
if (SvPOK(func)) {
/* prefix with package name */
name = g_strdup_printf("%s::%s", package,
(char *) SvPV(func, n_a));
(char *) SvPV(func, PL_na));
func = new_pv(name);
g_free(name);
} else {

View File

@ -29,6 +29,7 @@ SV *perl_func_sv_inc(SV *func, const char *package);
/* For compatibility with perl 5.004 and older */
#ifndef HAVE_PL_PERL
# define PL_sv_undef sv_undef
extern STRLEN PL_na;
#endif
#define iobject_bless(object) \

View File

@ -234,9 +234,7 @@ static int perl_script_eval(PERL_SCRIPT_REC *script)
error = NULL;
if (SvTRUE(ERRSV)) {
STRLEN n_a;
error = SvPV(ERRSV, n_a);
error = SvPV(ERRSV, PL_na);
} else if (retcount > 0) {
error = POPp;
}

View File

@ -160,9 +160,7 @@ static void perl_call_signal(PERL_SCRIPT_REC *script, SV *func,
SPAGAIN;
if (SvTRUE(ERRSV)) {
STRLEN n_a;
signal_emit("script error", 2, script, SvPV(ERRSV, n_a));
signal_emit("script error", 2, script, SvPV(ERRSV, PL_na));
rec = NULL;
}
@ -335,14 +333,13 @@ static void perl_signal_remove_list_one(GSList **siglist, PERL_SIGNAL_REC *rec)
static void perl_signal_remove_list(GSList **list, SV *func)
{
GSList *tmp;
STRLEN n_a;
g_return_if_fail(list != NULL);
for (tmp = *list; tmp != NULL; tmp = tmp->next) {
PERL_SIGNAL_REC *rec = tmp->data;
if (sv_func_cmp(rec->func, func, n_a)) {
if (sv_func_cmp(rec->func, func, PL_na)) {
perl_signal_remove_list_one(list, rec);
break;
}

View File

@ -77,10 +77,8 @@ static int perl_source_event(PERL_SOURCE_REC *rec)
SPAGAIN;
if (SvTRUE(ERRSV)) {
STRLEN n_a;
signal_emit("script error", 2, rec->script,
SvPV(ERRSV, n_a));
SvPV(ERRSV, PL_na));
}
perl_source_unref(rec);

View File

@ -65,7 +65,6 @@ static void perl_statusbar_event(char *function, SBAR_ITEM_REC *item,
SPAGAIN;
if (SvTRUE(ERRSV)) {
STRLEN n_a;
PERL_SCRIPT_REC *script;
char *package;
@ -77,7 +76,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, n_a));
signal_emit("script error", 2, script, SvPV(ERRSV, PL_na));
} else {
/* min_size and max_size can be changed, move them to SBAR_ITEM_REC */
hv = hvref(item_sv);

View File

@ -14,12 +14,11 @@ PREINIT:
char **charargs;
char *ret;
int n;
STRLEN n_a;
PPCODE:
charargs = g_new0(char *, items-5+1);
charargs[items-5] = NULL;
for (n = 5; n < items; n++) {
charargs[n-5] = (char *)SvPV(ST(n), n_a);
charargs[n-5] = (char *)SvPV(ST(n), PL_na);
}
ret = format_get_text(module, window, server, target, formatnum, charargs);
g_free(charargs);

View File

@ -91,7 +91,6 @@ void
theme_register(formats)
SV *formats
PREINIT:
STRLEN n_a;
AV *av;
FORMAT_REC *formatrecs;
char *key, *value;
@ -110,8 +109,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), n_a); n++;
value = SvPV(*av_fetch(av, n, 0), n_a);
key = SvPV(*av_fetch(av, n, 0), PL_na); n++;
value = SvPV(*av_fetch(av, n, 0), PL_na);
formatrecs[fpos].tag = g_strdup(key);
formatrecs[fpos].def = g_strdup(value);
@ -125,7 +124,6 @@ printformat(level, format, ...)
int level
char *format
PREINIT:
STRLEN n_a;
TEXT_DEST_REC dest;
char *arglist[MAX_FORMAT_PARAMS+1];
int n;
@ -133,7 +131,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), n_a);
arglist[n-2] = SvPV(ST(n), PL_na);
}
printformat_perl(&dest, format, arglist);
@ -149,7 +147,6 @@ printformat(server, target, level, format, ...)
int level
char *format
PREINIT:
STRLEN n_a;
TEXT_DEST_REC dest;
char *arglist[MAX_FORMAT_PARAMS+1];
int n;
@ -157,7 +154,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), n_a);
arglist[n-4] = SvPV(ST(n), PL_na);
}
printformat_perl(&dest, format, arglist);
@ -172,7 +169,6 @@ printformat(window, level, format, ...)
int level
char *format
PREINIT:
STRLEN n_a;
TEXT_DEST_REC dest;
char *arglist[MAX_FORMAT_PARAMS+1];
int n;
@ -180,7 +176,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), n_a);
arglist[n-3] = SvPV(ST(n), PL_na);
}
printformat_perl(&dest, format, arglist);
@ -195,7 +191,6 @@ printformat(item, level, format, ...)
int level
char *format
PREINIT:
STRLEN n_a;
TEXT_DEST_REC dest;
char *arglist[MAX_FORMAT_PARAMS+1];
int n;
@ -203,7 +198,7 @@ CODE:
format_create_dest(&dest, item->server, item->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), n_a);
arglist[n-3] = SvPV(ST(n), PL_na);
}
printformat_perl(&dest, format, arglist);