From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id CAF451F9F4 for ; Mon, 22 Nov 2021 18:16:32 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] spawn: avoid C++ keyword `try' Date: Mon, 22 Nov 2021 18:16:32 +0000 Message-Id: <20211122181632.216034-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: This is future-proofing in case we build against Xapian directly in the future, which would require a C++ compiler. --- lib/PublicInbox/Spawn.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/PublicInbox/Spawn.pm b/lib/PublicInbox/Spawn.pm index 6ca1ca2a0be3..e0a51c2167e8 100644 --- a/lib/PublicInbox/Spawn.pm +++ b/lib/PublicInbox/Spawn.pm @@ -165,14 +165,14 @@ int pi_fork_exec(SV *redirref, SV *file, SV *cmdref, SV *envref, SV *rlimref, return (int)pid; } -static int sleep_wait(unsigned *try, int err) +static int sleep_wait(unsigned *tries, int err) { const struct timespec req = { 0, 100000000 }; /* 100ms */ switch (err) { case ENOBUFS: case ENOMEM: case ETOOMANYREFS: - if (++*try < 50) { + if (++*tries < 50) { fprintf(stderr, "sleeping on sendmsg: %s (#%u)\n", - strerror(err), *try); + strerror(err), *tries); nanosleep(&req, NULL); return 1; } @@ -199,7 +199,7 @@ SV *send_cmd4(PerlIO *s, SV *svfds, SV *data, int flags) AV *fds = (AV *)SvRV(svfds); I32 i, nfds = av_len(fds) + 1; int *fdp; - unsigned try = 0; + unsigned tries = 0; if (SvOK(data)) { iov.iov_base = SvPV(data, dlen); @@ -229,7 +229,7 @@ SV *send_cmd4(PerlIO *s, SV *svfds, SV *data, int flags) } do { sent = sendmsg(PerlIO_fileno(s), &msg, flags); - } while (sent < 0 && sleep_wait(&try, errno)); + } while (sent < 0 && sleep_wait(&tries, errno)); return sent >= 0 ? newSViv(sent) : &PL_sv_undef; }