mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05: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:
parent
d4ee6fd604
commit
617123b5d4
@ -22,8 +22,6 @@ PROTOTYPES: ENABLE
|
|||||||
void
|
void
|
||||||
signal_emit(signal, ...)
|
signal_emit(signal, ...)
|
||||||
char *signal
|
char *signal
|
||||||
PREINIT:
|
|
||||||
STRLEN n_a;
|
|
||||||
CODE:
|
CODE:
|
||||||
void *p[SIGNAL_MAX_ARGUMENTS];
|
void *p[SIGNAL_MAX_ARGUMENTS];
|
||||||
int n;
|
int n;
|
||||||
@ -31,7 +29,7 @@ CODE:
|
|||||||
memset(p, 0, sizeof(p));
|
memset(p, 0, sizeof(p));
|
||||||
for (n = 1; n < items && n < SIGNAL_MAX_ARGUMENTS+1; n++) {
|
for (n = 1; n < items && n < SIGNAL_MAX_ARGUMENTS+1; n++) {
|
||||||
if (SvPOKp(ST(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)))
|
else if (irssi_is_ref_object(ST(n)))
|
||||||
p[n-1] = irssi_ref_object(ST(n));
|
p[n-1] = irssi_ref_object(ST(n));
|
||||||
else
|
else
|
||||||
|
@ -25,7 +25,6 @@ static GSList *event_hash2list(HV *hv)
|
|||||||
{
|
{
|
||||||
HE *he;
|
HE *he;
|
||||||
GSList *list;
|
GSList *list;
|
||||||
STRLEN n_a;
|
|
||||||
|
|
||||||
if (hv == NULL)
|
if (hv == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -35,7 +34,7 @@ static GSList *event_hash2list(HV *hv)
|
|||||||
while ((he = hv_iternext(hv)) != NULL) {
|
while ((he = hv_iternext(hv)) != NULL) {
|
||||||
I32 len;
|
I32 len;
|
||||||
char *key = hv_iterkey(he, &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(key));
|
||||||
list = g_slist_append(list, g_strdup(value));
|
list = g_slist_append(list, g_strdup(value));
|
||||||
|
@ -47,14 +47,17 @@ typedef struct {
|
|||||||
PERL_OBJECT_FUNC fill_func;
|
PERL_OBJECT_FUNC fill_func;
|
||||||
} PERL_OBJECT_REC;
|
} PERL_OBJECT_REC;
|
||||||
|
|
||||||
|
#ifndef HAVE_PL_PERL
|
||||||
|
STRLEN PL_na;
|
||||||
|
#endif
|
||||||
|
|
||||||
static GHashTable *iobject_stashes, *plain_stashes;
|
static GHashTable *iobject_stashes, *plain_stashes;
|
||||||
static GSList *use_protocols;
|
static GSList *use_protocols;
|
||||||
|
|
||||||
/* returns the package who called us */
|
/* returns the package who called us */
|
||||||
const char *perl_get_package(void)
|
const char *perl_get_package(void)
|
||||||
{
|
{
|
||||||
STRLEN n_a;
|
return SvPV(perl_eval_pv("caller", TRUE), PL_na);
|
||||||
return SvPV(perl_eval_pv("caller", TRUE), n_a);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parses the package part from function name */
|
/* 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)
|
SV *perl_func_sv_inc(SV *func, const char *package)
|
||||||
{
|
{
|
||||||
STRLEN n_a;
|
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
if (SvPOK(func)) {
|
if (SvPOK(func)) {
|
||||||
/* prefix with package name */
|
/* prefix with package name */
|
||||||
name = g_strdup_printf("%s::%s", package,
|
name = g_strdup_printf("%s::%s", package,
|
||||||
(char *) SvPV(func, n_a));
|
(char *) SvPV(func, PL_na));
|
||||||
func = new_pv(name);
|
func = new_pv(name);
|
||||||
g_free(name);
|
g_free(name);
|
||||||
} else {
|
} else {
|
||||||
|
@ -29,6 +29,7 @@ SV *perl_func_sv_inc(SV *func, const char *package);
|
|||||||
/* For compatibility with perl 5.004 and older */
|
/* For compatibility with perl 5.004 and older */
|
||||||
#ifndef HAVE_PL_PERL
|
#ifndef HAVE_PL_PERL
|
||||||
# define PL_sv_undef sv_undef
|
# define PL_sv_undef sv_undef
|
||||||
|
extern STRLEN PL_na;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define iobject_bless(object) \
|
#define iobject_bless(object) \
|
||||||
|
@ -234,9 +234,7 @@ static int perl_script_eval(PERL_SCRIPT_REC *script)
|
|||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
if (SvTRUE(ERRSV)) {
|
if (SvTRUE(ERRSV)) {
|
||||||
STRLEN n_a;
|
error = SvPV(ERRSV, PL_na);
|
||||||
|
|
||||||
error = SvPV(ERRSV, n_a);
|
|
||||||
} else if (retcount > 0) {
|
} else if (retcount > 0) {
|
||||||
error = POPp;
|
error = POPp;
|
||||||
}
|
}
|
||||||
|
@ -160,9 +160,7 @@ static void perl_call_signal(PERL_SCRIPT_REC *script, SV *func,
|
|||||||
SPAGAIN;
|
SPAGAIN;
|
||||||
|
|
||||||
if (SvTRUE(ERRSV)) {
|
if (SvTRUE(ERRSV)) {
|
||||||
STRLEN n_a;
|
signal_emit("script error", 2, script, SvPV(ERRSV, PL_na));
|
||||||
|
|
||||||
signal_emit("script error", 2, script, SvPV(ERRSV, n_a));
|
|
||||||
rec = NULL;
|
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)
|
static void perl_signal_remove_list(GSList **list, SV *func)
|
||||||
{
|
{
|
||||||
GSList *tmp;
|
GSList *tmp;
|
||||||
STRLEN n_a;
|
|
||||||
|
|
||||||
g_return_if_fail(list != NULL);
|
g_return_if_fail(list != NULL);
|
||||||
|
|
||||||
for (tmp = *list; tmp != NULL; tmp = tmp->next) {
|
for (tmp = *list; tmp != NULL; tmp = tmp->next) {
|
||||||
PERL_SIGNAL_REC *rec = tmp->data;
|
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);
|
perl_signal_remove_list_one(list, rec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -77,10 +77,8 @@ static int perl_source_event(PERL_SOURCE_REC *rec)
|
|||||||
SPAGAIN;
|
SPAGAIN;
|
||||||
|
|
||||||
if (SvTRUE(ERRSV)) {
|
if (SvTRUE(ERRSV)) {
|
||||||
STRLEN n_a;
|
|
||||||
|
|
||||||
signal_emit("script error", 2, rec->script,
|
signal_emit("script error", 2, rec->script,
|
||||||
SvPV(ERRSV, n_a));
|
SvPV(ERRSV, PL_na));
|
||||||
}
|
}
|
||||||
perl_source_unref(rec);
|
perl_source_unref(rec);
|
||||||
|
|
||||||
|
@ -65,7 +65,6 @@ static void perl_statusbar_event(char *function, SBAR_ITEM_REC *item,
|
|||||||
SPAGAIN;
|
SPAGAIN;
|
||||||
|
|
||||||
if (SvTRUE(ERRSV)) {
|
if (SvTRUE(ERRSV)) {
|
||||||
STRLEN n_a;
|
|
||||||
PERL_SCRIPT_REC *script;
|
PERL_SCRIPT_REC *script;
|
||||||
char *package;
|
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 */
|
/* make sure we don't get back here */
|
||||||
script_unregister_statusbars(script);
|
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 {
|
} else {
|
||||||
/* min_size and max_size can be changed, move them to SBAR_ITEM_REC */
|
/* min_size and max_size can be changed, move them to SBAR_ITEM_REC */
|
||||||
hv = hvref(item_sv);
|
hv = hvref(item_sv);
|
||||||
|
@ -14,12 +14,11 @@ PREINIT:
|
|||||||
char **charargs;
|
char **charargs;
|
||||||
char *ret;
|
char *ret;
|
||||||
int n;
|
int n;
|
||||||
STRLEN n_a;
|
|
||||||
PPCODE:
|
PPCODE:
|
||||||
charargs = g_new0(char *, items-5+1);
|
charargs = g_new0(char *, items-5+1);
|
||||||
charargs[items-5] = NULL;
|
charargs[items-5] = NULL;
|
||||||
for (n = 5; n < items; n++) {
|
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);
|
ret = format_get_text(module, window, server, target, formatnum, charargs);
|
||||||
g_free(charargs);
|
g_free(charargs);
|
||||||
|
@ -91,7 +91,6 @@ void
|
|||||||
theme_register(formats)
|
theme_register(formats)
|
||||||
SV *formats
|
SV *formats
|
||||||
PREINIT:
|
PREINIT:
|
||||||
STRLEN n_a;
|
|
||||||
AV *av;
|
AV *av;
|
||||||
FORMAT_REC *formatrecs;
|
FORMAT_REC *formatrecs;
|
||||||
char *key, *value;
|
char *key, *value;
|
||||||
@ -110,8 +109,8 @@ CODE:
|
|||||||
formatrecs[0].def = g_strdup("Perl script");
|
formatrecs[0].def = g_strdup("Perl script");
|
||||||
|
|
||||||
for (fpos = 1, n = 0; n < len; n++, fpos++) {
|
for (fpos = 1, n = 0; n < len; n++, fpos++) {
|
||||||
key = SvPV(*av_fetch(av, n, 0), n_a); n++;
|
key = SvPV(*av_fetch(av, n, 0), PL_na); n++;
|
||||||
value = SvPV(*av_fetch(av, n, 0), n_a);
|
value = SvPV(*av_fetch(av, n, 0), PL_na);
|
||||||
|
|
||||||
formatrecs[fpos].tag = g_strdup(key);
|
formatrecs[fpos].tag = g_strdup(key);
|
||||||
formatrecs[fpos].def = g_strdup(value);
|
formatrecs[fpos].def = g_strdup(value);
|
||||||
@ -125,7 +124,6 @@ printformat(level, format, ...)
|
|||||||
int level
|
int level
|
||||||
char *format
|
char *format
|
||||||
PREINIT:
|
PREINIT:
|
||||||
STRLEN n_a;
|
|
||||||
TEXT_DEST_REC dest;
|
TEXT_DEST_REC dest;
|
||||||
char *arglist[MAX_FORMAT_PARAMS+1];
|
char *arglist[MAX_FORMAT_PARAMS+1];
|
||||||
int n;
|
int n;
|
||||||
@ -133,7 +131,7 @@ CODE:
|
|||||||
format_create_dest(&dest, NULL, NULL, level, NULL);
|
format_create_dest(&dest, NULL, NULL, level, NULL);
|
||||||
memset(arglist, 0, sizeof(arglist));
|
memset(arglist, 0, sizeof(arglist));
|
||||||
for (n = 2; n < items && n < MAX_FORMAT_PARAMS+2; n++) {
|
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);
|
printformat_perl(&dest, format, arglist);
|
||||||
@ -149,7 +147,6 @@ printformat(server, target, level, format, ...)
|
|||||||
int level
|
int level
|
||||||
char *format
|
char *format
|
||||||
PREINIT:
|
PREINIT:
|
||||||
STRLEN n_a;
|
|
||||||
TEXT_DEST_REC dest;
|
TEXT_DEST_REC dest;
|
||||||
char *arglist[MAX_FORMAT_PARAMS+1];
|
char *arglist[MAX_FORMAT_PARAMS+1];
|
||||||
int n;
|
int n;
|
||||||
@ -157,7 +154,7 @@ CODE:
|
|||||||
format_create_dest(&dest, server, target, level, NULL);
|
format_create_dest(&dest, server, target, level, NULL);
|
||||||
memset(arglist, 0, sizeof(arglist));
|
memset(arglist, 0, sizeof(arglist));
|
||||||
for (n = 4; n < items && n < MAX_FORMAT_PARAMS+4; n++) {
|
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);
|
printformat_perl(&dest, format, arglist);
|
||||||
@ -172,7 +169,6 @@ printformat(window, level, format, ...)
|
|||||||
int level
|
int level
|
||||||
char *format
|
char *format
|
||||||
PREINIT:
|
PREINIT:
|
||||||
STRLEN n_a;
|
|
||||||
TEXT_DEST_REC dest;
|
TEXT_DEST_REC dest;
|
||||||
char *arglist[MAX_FORMAT_PARAMS+1];
|
char *arglist[MAX_FORMAT_PARAMS+1];
|
||||||
int n;
|
int n;
|
||||||
@ -180,7 +176,7 @@ CODE:
|
|||||||
format_create_dest(&dest, NULL, NULL, level, window);
|
format_create_dest(&dest, NULL, NULL, level, window);
|
||||||
memset(arglist, 0, sizeof(arglist));
|
memset(arglist, 0, sizeof(arglist));
|
||||||
for (n = 3; n < items && n < MAX_FORMAT_PARAMS+3; n++) {
|
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);
|
printformat_perl(&dest, format, arglist);
|
||||||
@ -195,7 +191,6 @@ printformat(item, level, format, ...)
|
|||||||
int level
|
int level
|
||||||
char *format
|
char *format
|
||||||
PREINIT:
|
PREINIT:
|
||||||
STRLEN n_a;
|
|
||||||
TEXT_DEST_REC dest;
|
TEXT_DEST_REC dest;
|
||||||
char *arglist[MAX_FORMAT_PARAMS+1];
|
char *arglist[MAX_FORMAT_PARAMS+1];
|
||||||
int n;
|
int n;
|
||||||
@ -203,7 +198,7 @@ CODE:
|
|||||||
format_create_dest(&dest, item->server, item->name, level, NULL);
|
format_create_dest(&dest, item->server, item->name, level, NULL);
|
||||||
memset(arglist, 0, sizeof(arglist));
|
memset(arglist, 0, sizeof(arglist));
|
||||||
for (n = 3; n < items && n < MAX_FORMAT_PARAMS+3; n++) {
|
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);
|
printformat_perl(&dest, format, arglist);
|
||||||
|
Loading…
Reference in New Issue
Block a user