Skip to content

Commit 5d45b14

Browse files
committed
libap: promote xmalloc/exitfail to libap; drop from per-package gnulib
xmalloc+xalloc_die were already in libap's malloc/xmalloc.c. Add exitfail.c (int volatile exit_failure = EXIT_FAILURE) and exitfail.h to libap's malloc/ so packages don't need their own copies. Remove xmalloc.$O, xalloc-die.$O, exitfail.$O from bison, diff, grep, m4, and patch gnulib object lists — they are now satisfied by libap.a. Note: xmalloca.$O in m4 stays (xmalloca() is not in libap). https://claude.ai/code/session_01WGAwvvTwDg2yknFkmZ3qzs
1 parent 423341a commit 5d45b14

8 files changed

Lines changed: 27 additions & 15 deletions

File tree

sys/include/ape/exitfail.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#ifndef _EXITFAIL_H
2+
#define _EXITFAIL_H
3+
4+
#pragma lib "/$M/lib/ape/libap.a"
5+
6+
#ifdef __cplusplus
7+
extern "C" {
8+
#endif
9+
10+
extern int volatile exit_failure;
11+
12+
#ifdef __cplusplus
13+
}
14+
#endif
15+
16+
#endif /* _EXITFAIL_H */

sys/src/ape/cmd/bison/mkfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ LIB_OBJS=\
8888
# libbison_a-dirname-lgpl.$O \
8989
# libbison_a-stripslash.$O \
9090
libbison_a-execute.$O \
91-
libbison_a-exitfail.$O \
91+
# libbison_a-exitfail.$O \
9292
libbison_a-fatal-signal.$O \
9393
# libbison_a-fd-safer-flag.$O \
9494
# libbison_a-dup-safer-flag.$O \
@@ -142,8 +142,8 @@ LIB_OBJS=\
142142
# libbison_a-pipe-safer.$O \
143143
libbison_a-wait-process.$O \
144144
# libbison_a-wctype-h.$O \
145-
libbison_a-xmalloc.$O \
146-
libbison_a-xalloc-die.$O \
145+
# libbison_a-xmalloc.$O \
146+
# libbison_a-xalloc-die.$O \
147147
libbison_a-xconcat-filename.$O \
148148
libbison_a-xhash.$O \
149149
# libbison_a-gl_xlist.$O \

sys/src/ape/cmd/diff/mkfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ LIB= libdiff.a$O
1212

1313
LIBO=\
1414
sigsegv.$O stdbit.$O\
15-
xmalloc.$O xalloc-die.$O\
1615
xstrtoimax.$O\
1716
quotearg.$O\
1817
diagnose.$O\
@@ -21,8 +20,7 @@ LIBO=\
2120
c-stack.$O\
2221
xstdopen.$O\
2322
propername-lite.$O\
24-
cmpbuf.$O\
25-
exitfail.$O
23+
cmpbuf.$O
2624

2725
CMPO=\
2826
cmp.$O system.$O

sys/src/ape/cmd/grep/mkfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ LIB_OBJS=\
3737
# libgreputils_a-dup2.$O \
3838
# libgreputils_a-error.$O \
3939
libgreputils_a-exclude.$O \
40-
libgreputils_a-exitfail.$O \
40+
# libgreputils_a-exitfail.$O \
4141
# libgreputils_a-fcntl.$O \
4242
# libgreputils_a-creat-safer.$O \
4343
# libgreputils_a-open-safer.$O \
@@ -114,8 +114,8 @@ LIB_OBJS=\
114114
# libgreputils_a-wctype.$O \
115115
# libgreputils_a-wctype-h.$O \
116116
libgreputils_a-wmempcpy.$O \
117-
libgreputils_a-xmalloc.$O \
118-
libgreputils_a-xalloc-die.$O \
117+
# libgreputils_a-xmalloc.$O \
118+
# libgreputils_a-xalloc-die.$O \
119119
# libgreputils_a-xbinary-io.$O \
120120
libgreputils_a-xstrtoimax.$O \
121121
libgreputils_a-xstrtol.$O \

sys/src/ape/cmd/m4/mkfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ LIB_OBJS= \
3737
# dup-safer-flag.$O\
3838
error.$O\
3939
execute.$O\
40-
exitfail.$O\
4140
fatal-signal.$O\
4241
# fd-safer.$O\
4342
# fd-safer-flag.$O\
@@ -91,9 +90,7 @@ LIB_OBJS= \
9190
# vfzprintf.$O\
9291
# vzprintf.$O\
9392
wait-process.$O\
94-
xalloc-die.$O\
9593
xasprintf.$O\
96-
xmalloc.$O\
9794
xmalloca.$O\
9895
xmemdup0.$O\
9996
xprintf.$O\

sys/src/ape/cmd/patch/mkfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,9 @@ OFILES=\
1111
safe.$O util.$O version.$O merge.$O
1212

1313
LIBO=\
14-
xmalloc.$O\
15-
xalloc-die.$O\
1614
argmatch.$O\
1715
backup-find.$O\
1816
basename-lgpl.$O\
19-
exitfail.$O\
2017
gettime.$O\
2118
hash.$O\
2219
parse-datetime.$O\
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#include <stdlib.h>
2+
3+
int volatile exit_failure = EXIT_FAILURE;

sys/src/ape/lib/ap/malloc/mkfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ OFILES=\
1919
aligned_alloc.$O\
2020
# GNU xalloc family\
2121
xmalloc.$O\
22+
exitfail.$O\
2223
2324
<$APEXPROOT/sys/src/cmd/mksyslib
2425

0 commit comments

Comments
 (0)