Skip to content

Commit

Permalink
libast/tm/tvsleep.c: remove assert.h use (re: 6e06e9c, 4e47f89)
Browse files Browse the repository at this point in the history
Including <assert.h> after <ast.h> caused the build to fail on my
museum-grade PowerMac G5 with gcc 3.3. This may be fixed by
including <assert.h> (which is a non-AST system header) before
<ast.h> instead, which should not cause any problems.

However, the assert(3) macro is only used once to verify that the
tv pointer passed to tvsleep(3) is non-NULL. This is non-essential
as the pointer is dereferenced immediately after, and dereferencing
a null pointer reliably triggers a traceable segfault. None of the
other AST code uses assert(3), so let's just get rid instead.

This fixes the build on (at least) the system mentioned above.
  • Loading branch information
McDutchie committed Sep 13, 2023
1 parent 057b200 commit 3eedd07
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions src/lib/libast/tm/tvsleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
***********************************************************************/

#include <ast.h>
#include <assert.h>
#include <tv.h>
#include <tm.h>
#include <error.h>
Expand Down Expand Up @@ -55,8 +54,6 @@
int
tvsleep(const Tv_t* tv, Tv_t* rv)
{
assert(tv); /* Validate argument */

/* Return immediately if asked to sleep for no duration. */
if (!tv->tv_sec && !tv->tv_nsec)
return 0;
Expand Down

0 comments on commit 3eedd07

Please sign in to comment.