From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH] spawn: avoid C++ keyword `try'
Date: Mon, 22 Nov 2021 18:16:32 +0000 [thread overview]
Message-ID: <20211122181632.216034-1-e@80x24.org> (raw)
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;
}
reply other threads:[~2021-11-22 18:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211122181632.216034-1-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).