From 6ab40c0a66a59635f2f7349ca2430d54d445560f Mon Sep 17 00:00:00 2001 From: nekobit Date: Thu, 4 Aug 2022 04:49:28 +0000 Subject: [PATCH] lmao FossilOrigin-Name: ce623bcfc6aa85e250f8861966654b8c476372c1829d14d96b4b80bbd799a34c --- perl/main.pl | 1 + perl/timeline.pm | 3 ++- src/global_perl.h | 6 +++--- src/status.c | 10 +++++----- src/timeline.c | 12 ++++++------ 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/perl/main.pl b/perl/main.pl index 0f01c9e..14ff2d1 100644 --- a/perl/main.pl +++ b/perl/main.pl @@ -5,6 +5,7 @@ use Template; use l10n qw( &lang %L10N ); use notifications qw( generate_notification_compact ); use template_helpers qw( &to_template ); +use timeline; use status; # my $template = Template->new( diff --git a/perl/timeline.pm b/perl/timeline.pm index 6e86a2f..30a517c 100644 --- a/perl/timeline.pm +++ b/perl/timeline.pm @@ -3,7 +3,7 @@ use strict; use warnings; use Exporter 'import'; -our @EXPORT = qw( generate_attachment ); +our @EXPORT = qw( content_timeline ); use template_helpers 'to_template'; use icons 'get_icon'; @@ -17,6 +17,7 @@ sub content_timeline my %vars = ( prefix => '', ssn => $ssn, + data => $data, statuses => $statuses, title => $title, show_post_box => $show_post_box, diff --git a/src/global_perl.h b/src/global_perl.h index bbe8a8a..f6cfb85 100644 --- a/src/global_perl.h +++ b/src/global_perl.h @@ -32,10 +32,10 @@ static PerlInterpreter* perl; extern HV* template_files; extern pthread_mutex_t perl_mutex; -#define perl_lock() do { pthread_mutex_lock(&perl_mutex); } while (1) -#define perl_unlock() do { pthread_mutex_unlock(&perl_mutex); } while (1) +#define perl_lock() do { pthread_mutex_lock(&perl_mutex); } while (0) +#define perl_unlock() do { pthread_mutex_unlock(&perl_mutex); } while (0) -#define ARG_UNDEFINED() do { XPUSHs(&PL_sv_undef); } while (1) +#define ARG_UNDEFINED() do { XPUSHs(&PL_sv_undef); } while (0) void init_template_files(); void cleanup_template_files(); diff --git a/src/status.c b/src/status.c index e93ead7..83b6173 100644 --- a/src/status.c +++ b/src/status.c @@ -947,16 +947,16 @@ void content_status(PATH_ARGS, uint8_t flags) SAVETMPS; PUSHMARK(SP); HV* session_hv = perlify_session(ssn); - XPUSHs(newRV_inc((SV*)session_hv)); - XPUSHs(newRV_inc((SV*)template_files)); - XPUSHs(newRV_inc((SV*)perlify_status(&status))); + XPUSHs(newRV_noinc((SV*)session_hv)); + XPUSHs(newRV_noinc((SV*)template_files)); + XPUSHs(newRV_noinc((SV*)perlify_status(&status))); if (statuses_before) - XPUSHs(newRV_inc((AV*)perlify_statuses(statuses_before, stat_before_len))); + XPUSHs(newRV_noinc((AV*)perlify_statuses(statuses_before, stat_before_len))); else XPUSHs(&PL_sv_undef); if (statuses_after) - XPUSHs(newRV_inc((AV*)perlify_statuses(statuses_after, stat_after_len))); + XPUSHs(newRV_noinc((AV*)perlify_statuses(statuses_after, stat_after_len))); else XPUSHs(&PL_sv_undef); // ARGS diff --git a/src/timeline.c b/src/timeline.c index 9dc1d10..3a0aa59 100644 --- a/src/timeline.c +++ b/src/timeline.c @@ -51,18 +51,18 @@ void content_timeline(FCGX_Request* req, SAVETMPS; PUSHMARK(SP); HV* session_hv = perlify_session(ssn); - XPUSHs(newRV_inc((SV*)session_hv)); - XPUSHs(newRV_inc((SV*)template_files)); + XPUSHs(newRV_noinc((SV*)session_hv)); + XPUSHs(newRV_noinc((SV*)template_files)); if (statuses) - XPUSHs(newRV_inc((SV*)perlify_statuses(statuses, statuses_len))); - else { ARG_UNDEFINED(); } + XPUSHs(newRV_noinc((SV*)perlify_statuses(statuses, statuses_len))); + else ARG_UNDEFINED(); if (header_text) XPUSHs(newSVpv(header_text, 0)); - else { ARG_UNDEFINED(); } + else ARG_UNDEFINED(); - XPUSHi(show_post_box); + mXPUSHi(show_post_box); PUTBACK; call_pv("timeline::content_timeline", G_SCALAR);