Skip to content
This repository was archived by the owner on Jun 16, 2025. It is now read-only.

Commit c073b10

Browse files
committed
Avoid bitshifts in macros for static error codes
Exit codes of command not found and exec related errors are static values and should not require any macro magic for calculation. Related: #485
1 parent d98defc commit c073b10

File tree

1 file changed

+4
-4
lines changed
  • src/lib/libast/include

1 file changed

+4
-4
lines changed

src/lib/libast/include/ast.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@
5151

5252
#define EXIT_BITS 8 /* # exit status bits */
5353

54-
#define EXIT_USAGE 2 /* usage exit code */
55-
#define EXIT_QUIT ((1 << (EXIT_BITS)) - 1) /* parent should quit */
56-
#define EXIT_NOTFOUND ((1 << (EXIT_BITS - 1)) - 1) /* command not found */
57-
#define EXIT_NOEXEC ((1 << (EXIT_BITS - 1)) - 2) /* other exec error */
54+
#define EXIT_USAGE 2 /* usage exit code */
55+
#define EXIT_QUIT 255 /* parent should quit */
56+
#define EXIT_NOTFOUND 127 /* command not found */
57+
#define EXIT_NOEXEC 126 /* other exec error */
5858

5959
#define EXIT_CODE(x) ((x) & ((1 << EXIT_BITS) - 1))
6060
#define EXIT_CORE(x) (EXIT_CODE(x) | (1 << EXIT_BITS) | (1 << (EXIT_BITS - 1)))

0 commit comments

Comments
 (0)