Skip to content

Commit 1cbe1fd

Browse files
committed
Eliminate compiler warnings, don't call PyEval_InitThreads(), it's
been non needed since python 3.7.
1 parent ab84ee0 commit 1cbe1fd

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

src/asyncproxy.c

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ asyncproxy_run(void *args)
200200

201201
ap = (struct asyncproxy *)args;
202202
if (ap->debug > 1) {
203-
fprintf(stderr, "asyncproxy_run(%p)\n", ap);
203+
fprintf(stderr, "asyncproxy_run(%p)\n", (void *)ap);
204204
fflush(stderr);
205205
}
206206
pthread_mutex_lock(&ap->mutex);
@@ -239,7 +239,7 @@ asyncproxy_run(void *args)
239239
pthread_mutex_unlock(&ap->mutex);
240240
if (state != AP_STATE_RUN) {
241241
if (ap->debug > 2) {
242-
fprintf(stderr, "asyncproxy_run(%p): exit on state %d\n", ap, state);
242+
fprintf(stderr, "asyncproxy_run(%p): exit on state %d\n", (void *)ap, state);
243243
fflush(stderr);
244244
}
245245
break;
@@ -250,7 +250,7 @@ asyncproxy_run(void *args)
250250
fflush(stderr);
251251
}
252252
if (ap->debug > 3) {
253-
fprintf(stderr, "asyncproxy_run(%p): poll() = %d\n", ap, n);
253+
fprintf(stderr, "asyncproxy_run(%p): poll() = %d\n", (void *)ap, n);
254254
fflush(stderr);
255255
}
256256
if (n <= 0) {
@@ -260,14 +260,15 @@ asyncproxy_run(void *args)
260260
for (i = 0; i < 2; i++) {
261261
if (ap->debug > 0) {
262262
if (ap->debug > 3) {
263-
fprintf(stderr, "asyncproxy_run(%p): pfds[%d] = {.events = %d, .revents = %d}\n", ap, i, pfds[i].events, pfds[i].revents);
263+
fprintf(stderr, "asyncproxy_run(%p): pfds[%d] = {.events = %d, .revents = %d}\n",
264+
(void *)ap, i, pfds[i].events, pfds[i].revents);
264265
fflush(stderr);
265266
}
266267
assert((pfds[i].revents & POLLNVAL) == 0);
267268
}
268269
if (pfds[i].revents & POLLHUP) {
269270
if (ap->debug > 1) {
270-
fprintf(stderr, "asyncproxy_run(%p): fd %d is gone, out\n", ap, pfds[i].fd);
271+
fprintf(stderr, "asyncproxy_run(%p): fd %d is gone, out\n", (void *)ap, pfds[i].fd);
271272
fflush(stderr);
272273
}
273274
eidx = i;
@@ -279,13 +280,13 @@ asyncproxy_run(void *args)
279280
r = asp_sock_recv(asps[i], BUF_P(&bufs[i]), BUF_FREE(&bufs[i]));
280281
if (ap->debug > 2) {
281282
assert(pfds[i].fd == asps[i]->fd);
282-
fprintf(stderr, "asyncproxy_run(%p): received %ld bytes from %d\n", ap, r.len, pfds[i].fd);
283+
fprintf(stderr, "asyncproxy_run(%p): received %ld bytes from %d\n", (void *)ap, r.len, pfds[i].fd);
283284
fflush(stderr);
284285
}
285286
if (r.len <= 0) {
286287
if (ap->debug > 1) {
287288
fprintf(stderr, "asyncproxy_run(%p): fd %d recv "
288-
"failed with error %d, out\n", ap, pfds[i].fd,
289+
"failed with error %d, out\n", (void *)ap, pfds[i].fd,
289290
r.errnom);
290291
fflush(stderr);
291292
}
@@ -335,7 +336,7 @@ asyncproxy_run(void *args)
335336
rlen = asp_sock_send(asps[j], bufs[i].data, bufs[i].len);
336337
if (ap->debug > 2) {
337338
assert(pfds[j].fd == asps[j]->fd);
338-
fprintf(stderr, "asyncproxy_run(%p): sent %ld bytes to %d\n", ap, rlen, pfds[j].fd);
339+
fprintf(stderr, "asyncproxy_run(%p): sent %ld bytes to %d\n", (void *)ap, rlen, pfds[j].fd);
339340
fflush(stderr);
340341
}
341342
if (rlen < (ssize_t)bufs[i].len) {
@@ -373,7 +374,7 @@ asyncproxy_run(void *args)
373374
pthread_mutex_unlock(&ap->mutex);
374375

375376
if (ap->debug > 0) {
376-
fprintf(stderr, "cease asyncproxy_run(%p)\n", ap);
377+
fprintf(stderr, "cease asyncproxy_run(%p)\n", (void *)ap);
377378
fflush(stderr);
378379
}
379380

@@ -407,7 +408,7 @@ asyncproxy_ctor(const struct asyncproxy_ctor_args *acap)
407408
return (NULL);
408409
}
409410
if (dbg_level > 0) {
410-
fprintf(stderr, "%p\n", ap);
411+
fprintf(stderr, "%p\n", (void *)ap);
411412
fflush(stderr);
412413
}
413414
memset(ap, '\0', sizeof(struct asyncproxy));
@@ -492,7 +493,7 @@ asyncproxy_ctor(const struct asyncproxy_ctor_args *acap)
492493
goto e3;
493494
}
494495

495-
#if defined(PYTHON_AWARE)
496+
#if defined(PYTHON_AWARE) && PY_VERSION_HEX < 0x03070000
496497
PyEval_InitThreads();
497498
#endif
498499

@@ -517,7 +518,7 @@ asyncproxy_start(void *_ap)
517518

518519
ap = (struct asyncproxy *)_ap;
519520
if (ap->debug > 0) {
520-
fprintf(stderr, "asyncproxy_start(%p)\n", ap);
521+
fprintf(stderr, "asyncproxy_start(%p)\n", (void *)ap);
521522
fflush(stderr);
522523
}
523524
pthread_mutex_lock(&ap->mutex);
@@ -545,7 +546,7 @@ asyncproxy_dtor(void *_ap)
545546

546547
ap = (struct asyncproxy *)_ap;
547548
if (ap->debug > 0) {
548-
fprintf(stderr, "asyncproxy_dtor(%p)\n", ap);
549+
fprintf(stderr, "asyncproxy_dtor(%p)\n", (void *)ap);
549550
fflush(stderr);
550551
}
551552

@@ -573,7 +574,7 @@ asyncproxy_isalive(void *_ap)
573574
pthread_mutex_unlock(&ap->mutex);
574575

575576
if (ap->debug > 1 && ap->last_seen_alive != rval) {
576-
fprintf(stderr, "asyncproxy_isalive(%p) = %d->%d\n", ap, ap->last_seen_alive, rval);
577+
fprintf(stderr, "asyncproxy_isalive(%p) = %d->%d\n", (void *)ap, ap->last_seen_alive, rval);
577578
fflush(stderr);
578579
ap->last_seen_alive = rval;
579580
}

0 commit comments

Comments
 (0)