Skip to content

Commit 18a3041

Browse files
committed
Don't save empty doc strings
1 parent 1c5cc66 commit 18a3041

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/deemon/compiler/asm/modgen.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,14 @@ module_compile(struct Dee_serial *__restrict writer,
143143
}
144144
if (in__mo_bucketv->ss_doc) {
145145
int status;
146-
if (in__mo_bucketv->ss_flags & Dee_MODSYM_FDOCOBJ) {
146+
if (*in__mo_bucketv->ss_doc == '\0') {
147+
/* No point in saving an empty string; that just bloats the .dec file! */
148+
struct Dee_module_symbol *ou_sym;
149+
ou_sym = DeeSerial_Addr2Mem(writer, out__mo_bucketv_i, struct Dee_module_symbol);
150+
ou_sym->ss_doc = NULL;
151+
ou_sym->ss_flags &= ~Dee_MODSYM_FDOCOBJ;
152+
status = 0;
153+
} else if (in__mo_bucketv->ss_flags & Dee_MODSYM_FDOCOBJ) {
147154
DeeStringObject *ob = container_of(in__mo_bucketv->ss_doc, DeeStringObject, s_str);
148155
status = DeeSerial_PutObjectEx(writer, out__mo_bucketv_i + offsetof(struct Dee_module_symbol, ss_doc),
149156
ob, offsetof(DeeStringObject, s_str));

0 commit comments

Comments
 (0)