Skip to content

Commit bc4983b

Browse files
committed
Time::HiRes.xs: hrstatns() change dTHX -> pTHX inside static func
More efficient. This is a static, there are no binary compat concerns. The dTHX is from initial commit of hrstatns() in commit: 75d5269 - Steve Peters - 10/13/2006 10:11:04 AM Upgrade to Time-HiRes-1.92.
1 parent 5551b97 commit bc4983b

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

dist/Time-HiRes/HiRes.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ our @EXPORT_OK = qw (usleep sleep ualarm alarm gettimeofday time tv_interval
5050
stat lstat utime
5151
);
5252

53-
our $VERSION = '1.9778';
53+
our $VERSION = '1.9779';
5454
our $XS_VERSION = $VERSION;
5555
$VERSION = eval $VERSION;
5656

dist/Time-HiRes/HiRes.xs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -630,10 +630,13 @@ myNVtime()
630630

631631
#endif /* #ifdef HAS_GETTIMEOFDAY */
632632

633-
static void
634-
hrstatns(UV *atime_nsec, UV *mtime_nsec, UV *ctime_nsec)
633+
/* Force inline this because it has only 1 caller:
634+
XSUB void stat(...) PROTOTYPE: ;$
635+
Change back to plain "static", if in the future a 2nd call site is added */
636+
637+
PERL_STATIC_FORCE_INLINE void
638+
S_hrstatns(pTHX_ UV *atime_nsec, UV *mtime_nsec, UV *ctime_nsec)
635639
{
636-
dTHX;
637640
#if TIME_HIRES_STAT == 1
638641
*atime_nsec = PL_statcache.st_atimespec.tv_nsec;
639642
*mtime_nsec = PL_statcache.st_mtimespec.tv_nsec;
@@ -661,6 +664,8 @@ hrstatns(UV *atime_nsec, UV *mtime_nsec, UV *ctime_nsec)
661664
#endif /* !TIME_HIRES_STAT */
662665
}
663666

667+
#define hrstatns(_at,_mt,_ct) S_hrstatns(aTHX_ (_at),(_mt),(_ct))
668+
664669
/* Until Apple implements clock_gettime()
665670
* (ditto clock_getres() and clock_nanosleep())
666671
* we will emulate them using the Mach kernel interfaces. */

0 commit comments

Comments
 (0)