delorie.com/archives/browse.cgi | search |
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f |
X-Recipient: | djgpp AT delorie DOT com |
X-Original-DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; |
d=gmail.com; s=20210112; | |
h=to:subject:message-id:date:from:references:in-reply-to:mime-version | |
:from:to:cc:subject:date:message-id:reply-to; | |
bh=pklKglPNk3TzvSQaN3vremLJ8d4nIiLvErv7JbQIK5o=; | |
b=ojTb6KpRbFmUjUMmCSYSsB8tJOCDyrEc/bm5JoOFVXWgEavnE37Jt0cdiN7rRDhtDl | |
geIkZ1Ah2th92PkSkimrzzrrEr+J9fTq1auzWIhXuypuxOcgp9vm2YAvNc1ZxW4RYb3J | |
/e/lw6YpnT3lgqu/EsXQsuhMrBjlEklnomLo3APo9j2XkUFojQLVu+IbFKiDLtLrhGXj | |
RAqUu9M3//gxXmeuY1T3NcltjSYtJjoXzxdTpokWvfjT4P0R4CbeHRCKb8brS2/4Ir7F | |
p9OZdPOPGXdZ6/YrNc5PM7aBubPVbCgP/CEOHl0hfAox+bcNegoCqWY3CqPJa0xKCq73 | |
TN3Q== | |
X-Google-DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; |
d=1e100.net; s=20210112; | |
h=to:subject:message-id:date:from:references:in-reply-to:mime-version | |
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; | |
bh=pklKglPNk3TzvSQaN3vremLJ8d4nIiLvErv7JbQIK5o=; | |
b=o/V4JikqY2j6Q+LWXvrM9+AwbBYus1I1xlpNFtLg0ysSJ3HSNaspl5s0l5AK6l3P8M | |
lstvedQmmb6poO+vqvHGOlniRlyA94iCadcfuwdjlTs4g00vdUMclHVHmrONcGjnqqFq | |
j67c8hHOq+iGFSnSWc659+D+GhKmcQZM83CKM98UeBEyxl338I6MXprtm8akbi6ulB7m | |
na7iyfrW4a+ebHk113EF7cqXRWgn4vnJxrFv5lQKIryi8aM4CDGI13UICC9fRI5aJgH6 | |
vF74WTT5mWT/nXcwe6Jq3WiL8aAslz01PHQ9wBSIkRBrKZwScnCvTb3SlKGkgjtguabK | |
4y6w== | |
X-Gm-Message-State: | AFqh2kraHgOvtn2J7AoLx0lUAlqLer1ifl8LcVAmi0F65E7Oe89FpZgG |
WQGRlClHVTetzu84o98MccZ2KoTMT3bOt/K5qw63Dfsq | |
X-Google-Smtp-Source: | AMrXdXun93EIQn1OLuyMYMkYVCAoefe6zy3QWrGra88YtfvXN6gZDe3PC2uH/EpVshrvAioTVinEWd2bqnB62fcITXA= |
X-Received: | by 2002:a05:600c:1d25:b0:3da:fa8a:8511 with SMTP id |
l37-20020a05600c1d2500b003dafa8a8511mr3069271wms.185.1675146358003; Mon, 30 | |
Jan 2023 22:25:58 -0800 (PST) | |
MIME-Version: | 1.0 |
In-Reply-To: | <CAA2C=vCP=M-r5Fb6YU5gpOqxHmk-rRXJLMSG8vieB84fE8ZAPA@mail.gmail.com> |
References: | <CAA2C=vCcrB4r7Z_1zOC+dvQnLiQjhp_zbhhuqJ7RQpQnrLuwMQ AT mail DOT gmail DOT com> |
<835ycn529o DOT fsf AT gnu DOT org> <CAA2C=vCP=M-r5Fb6YU5gpOqxHmk-rRXJLMSG8vieB84fE8ZAPA AT mail DOT gmail DOT com> | |
From: | "Ozkan Sezer (sezeroz AT gmail DOT com) [via djgpp AT delorie DOT com]" <djgpp AT delorie DOT com> |
Date: | Tue, 31 Jan 2023 09:25:56 +0300 |
Message-ID: | <CAA2C=vD8V=rpNwvuC+1Mj6GjNjyfByWVND8eiuOkF6R7ECYVvQ@mail.gmail.com> |
Subject: | Re: [PATCH] dxe3gen: add support for using an exports file. |
To: | djgpp AT delorie DOT com |
Reply-To: | djgpp AT delorie DOT com |
Errors-To: | nobody AT delorie DOT com |
X-Mailing-List: | djgpp AT delorie DOT com |
X-Unsubscribes-To: | listserv AT delorie DOT com |
--0000000000009dc48605f38967c3 Content-Type: text/plain; charset="UTF-8" On 1/30/23, Ozkan Sezer <sezeroz AT gmail DOT com> wrote: >> LGTM, > > OK, can apply tomorrow unless I get further reviews/objections. > >> but why did you use binary mode for reading the exports file? > > Easier forme that way -- uniform parsing across platforms. Version 2 of patch attached. Changes: - Fixes segfault if the exports file has no newline at end - Reports missing exports in verbose mode. For convenience, an interdiff to first version is inlined below (cosmetic changes excluded.) --- dxe3gen.c~ +++ dxe3gen.c @@ -519,7 +520,7 @@ opt.export_names[opt.num_names++] = ptr++; loc1: - while (*ptr != '\r' && *ptr != '\n') + while (*ptr && *ptr != '\r' && *ptr != '\n') ++ptr; } } @@ -1277,9 +1278,12 @@ BOOL ok = FALSE; for (j = 0; j < opt.num_names; j++) { + if (!opt.export_names[j]) + continue; if (strcmp(opt.export_names[j], name) == 0) { ok = TRUE; + opt.export_names[j] = NULL; break; } } @@ -1310,6 +1314,15 @@ } DEBUG_PRINT_SYMBOL_TABLE_EPILOG(); + if (opt.verbose && opt.num_names && opt.num_names != dh.n_exp_syms) + { + for (j = 0; j < opt.num_names; j++) + { + if (opt.export_names[j]) + printf("missing export: `%s'\n", opt.export_names[j]); + } + } + if (errcount) { fclose(outf); --0000000000009dc48605f38967c3 Content-Type: text/x-patch; charset="US-ASCII"; name="exports2.patch" Content-Disposition: attachment; filename="exports2.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: file0 SW5kZXg6IGR4ZTNnZW4uYwo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09ClJDUyBmaWxlOiAvY3ZzL2RqZ3BwL2RqZ3BwL3Ny Yy9keGUvZHhlM2dlbi5jLHYKcmV0cmlldmluZyByZXZpc2lvbiAxLjI3CmRpZmYgLXUgLXAgLXIx LjI3IGR4ZTNnZW4uYwotLS0gZGpncHAvc3JjL2R4ZS9keGUzZ2VuLmMJMjggSmFuIDIwMjMgMTQ6 MTA6MDMgLTAwMDAJMS4yNworKysgZGpncHAvc3JjL2R4ZS9keGUzZ2VuLmMJMzEgSmFuID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YyB2b2lkIHByb2Nlc3NfZW52KHZvaWQpCiB9CiAKIAorLyogRGVzYzog cHJvY2VzcyB0aGUgZXhwb3J0cyBmaWxlIHBvaW50ZWQgdG8gYnkgLS1leHBvcnRzIG9wdGlvbi4K KyAqCisgKiBJbiAgOiAtCisgKiBPdXQgOiAtCisgKgorICogTm90ZTogLQorICovCitzdGF0aWMg dm9pZCBwcm9jZXNzX2V4cF9maWxlKGNvbnN0IGNoYXIgKm5hbWUpCit7CisgIEZJTEUgKmYgPSBm b3BlbihuYW1lLCAicmIiKTsKKyAgY2hhciAqcHRyOworICBsb25nIGxlbjsKKworICBpZiAoIWYp CisgIHsKKyAgICBmcHJpbnRmKHN0ZGVyciwgIkVycm9yOiBDb3VsZG4ndCBvcGVuIGV4cG9ydHMg ZmlsZSAlcy5cbiIsIG5hbWUpOworICAgIGV4aXQoMSk7CisgIH0KKworICBmc2VlayhmLCAwLCBT RUVLX0VORCk7CisgIGxlbiA9IGZ0ZWxsKGYpOworICBmc2VlayhmLCAwLCBTRUVLX1NFVCk7Cisg IGV4cGZpbGUgPSBtYWxsb2MobGVuICsgMSk7CisgIGZyZWFkKGV4cGZpbGUsIDEsIGxlbiwgZik7 CisgIGZjbG9zZShmKTsKKyAgZXhwZmlsZVtsZW5dID0gJ1wwJzsKKworICBwdHIgPSBleHBmaWxl OworICBmb3IgKDs7KQorICB7CisgICAgd2hpbGUgKCpwdHIgPT0gJ1xyJyB8fCAqcHRyID09ICdc bicpCisgICAgICAqcHRyKysgPSAnXDAnOworCisgICAgaWYgKCEqcHRyKSBicmVhazsKKworICAg IGlmICgqcHRyID09ICcjJykgLyogY29tbWVudCAqLworICAgICAgZ290byBsb2MxOworCisgICAg aWYgKG9wdC5udW1fbmFtZXMgPj0gb3B0Lm1heF9uYW1lcykKKyAgICB7CisgICAgICBvcHQubWF4 X25hbWVzICs9IDE2OworICAgICAgb3B0LmV4cG9ydF9uYW1lcyA9IChjaGFyICoqKXJlYWxsb2Mo b3B0LmV4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V9wcmVmaXggPj0gb3B0Lm1heF9wcmVmaXgpCiAgICAgICAgIHsKICAgICAgICAgICBv cHQubWF4X3ByZWZpeCArPSAxNjsKQEAgLTU2Myw2ICs2NDYsMTEgQEAgc3RhdGljIHZvaWQgcHJv Y2Vzc19hcmdzKGludCBhcmdjLCBjaGFyIAogICAgICAgfQogICAgICAgZWxzZSBpZiAoIXN0cmNt cChhcmd2W2ldLCAiLVgiKSkKICAgICAgIHsKKyAgICAgICAgaWYgKHVzZV9leHBvcnRzKQorICAg ICAgICB7IGJhZF9vcHQxOgorICAgICAgICAgIGZwcmludGYoc3RkZXJyLCAiRXJyb3I6IC0tZXhw b3J0cyBhbmQgLUUgLyAtWCBvcHRpb25zIGFyZSBtdXR1YWxseSBleGNsdXNpdmUuXG4iKTsKKyAg ICAgICAgICBleGl0KDEpOworICAgICAgICB9CiAgICAgICAgIGlmIChvcHQubnVtX2V4Y2wgPj0g b3B0Lm1heF9leGNsKQogICAgICAgICB7CiAgICAgICAgICAgIG9wdC5tYXhfZXhjbCArPSAxNjsK QEAgLTExODUsNiArMTI3MywyNCBAQCBzdGF0aWMgaW50IHdyaXRlX2R4ZShGSUxFICppbmYsIEZJ TEUgKm91CiAgICAgICAgICAgY29udGludWU7CiAgICAgICB9CiAKKyAgICAgIGlmIChvcHQubnVt X25hbWVzKQorICAgICAgeworICAgICAgICBCT09MIG9rID0gRkFMU0U7CisgICAgICAgIGZvciAo aiA9IDA7IGogPCBvcHQubnVtX25hbWVzOyBqKyspCisgICAgICAgIHsKKyAgICAgICAgICBpZiAo IW9wdC5leHBvcnRfbmFtZXNbal0pCisgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICBp ZiAoc3RyY21wKG9wdC5leHBvcnRfbmFtZXNbal0sIG5hbWUpID09IDApCisgICAgICAgICAgewor ICAgICAgICAgICAgb2sgPSBUUlVFOworICAgICAgICAgICAgb3B0LmV4cG9ydF9uYW1lc1tqXSA9 IE5VTEw7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAg ICAgaWYgKCFvaykKKyAgICAgICAgICBjb250aW51ZTsKKyAgICAgIH0KKwogICAgICAgLyogZXhw b3J0ZWQgc3ltYm9sICovCiAgICAgICBkaC5uX2V4cF9zeW1zKys7CiAKQEAgLTEyMDgsNiArMTMx NCwxNSBAQCBzdGF0aWMgaW50IHdyaXRlX2R4ZShGSUxFICppbmYsIEZJTEUgKm91CiAgIH0KICAg REVCVUdfUFJJTlRfU1lNQk9MX1RBQkxFX0VQSUxPRygpOwogCisgIGlmIChvcHQudmVyYm9zZSAm JiBvcHQubnVtX25hbWVzICYmIG9wdC5udW1fbmFtZXMgIT0gZGgubl9leHBfc3ltcykKKyAgewor ICAgIGZvciAoaiA9IDA7IGogPCBvcHQubnVtX25hbWVzOyBqKyspCisgICAgeworICAgICAgaWYg KG9wdC5leHBvcnRfbmFtZXNbal0pCisgICAgICAgIHByaW50ZigibWlzc2luZyBleHBvcnQ6IGAl cydcbiIsIG9wdC5leHBvcnRfbmFtZXNbal0pOworICAgIH0KKyAgfQorCiAgIGlmIChlcnJjb3Vu dCkKICAgewogICAgIGZjbG9zZShvdXRmKTsK --0000000000009dc48605f38967c3--
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |