• Paul Eggert's avatar
    Move current_timespec decl to timespec.h · 295bacba
    Paul Eggert authored
    This change was motivated by the desire to remove the weird
    dependency of lib-src/profile.o on src/systime.h.  profile.c
    included systime.h only for current_timespec, and this
    inclusion required systime.h to have #ifdef emacs in multiple
    places and complicated further changes I have in mind.
    The current_timespec decl belongs in timespec.h anyway,
    and the main effect of this change is to move it there.
    * lib-src/profile.c (INLINE): Remove.
    Include timespec.h, not systime.h.
    * lib/gettime.c (gettime): Prefer clock_gettime to nanotime,
    and don’t worry about it failing on a CLOCK_REALTIME arg.
    POSIX requires it to succeed and I don’t know of any
    counterexamples where the fallbacks would work.
    (current_timespec): Move here from src/systime.h.
    Nowadays it seems to be better to not have this function
    be inline.
    * lib/timespec.h: Include arg-nonnull.h.
    (current_timespec): New declaration.
    (gettime, settime): Declare args to be nonnull.
    * lib/gettime.c, lib/timespec.h: Copy from Gnulib.
    * src/systime.h: Simplify by assuming ‘emacs’ is defined,
    which it always is now.
    (current_timespec): Move to lib/timespec.h.
    295bacba
profile.c 2.4 KB