Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Commit

Permalink
Remove remaining sprintf() and shut up compiler on unused args by the…
Browse files Browse the repository at this point in the history
… way.
  • Loading branch information
jedisct1 committed Jun 10, 2011
1 parent c6340ac commit d8cb7e9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions ringbuffer.c
Expand Up @@ -94,6 +94,7 @@ int ringbuffer_size(ringbuffer *rb) {


/* Used size of the ringbuffer */ /* Used size of the ringbuffer */
int ringbuffer_capacity(ringbuffer *rb) { int ringbuffer_capacity(ringbuffer *rb) {
(void) rb;
return RING_SLOTS; return RING_SLOTS;
} }


Expand Down
13 changes: 10 additions & 3 deletions stud.c
Expand Up @@ -238,6 +238,7 @@ static void handle_socket_errno(proxystate *ps) {
* write it into the upstream buffer and make sure the write event is * write it into the upstream buffer and make sure the write event is
* enabled for the upstream socket */ * enabled for the upstream socket */
static void back_read(struct ev_loop *loop, ev_io *w, int revents) { static void back_read(struct ev_loop *loop, ev_io *w, int revents) {
(void) revents;
int t; int t;
proxystate *ps = (proxystate *)w->data; proxystate *ps = (proxystate *)w->data;
if (ps->want_shutdown) { if (ps->want_shutdown) {
Expand Down Expand Up @@ -266,6 +267,7 @@ static void back_read(struct ev_loop *loop, ev_io *w, int revents) {
/* Write some data, previously received on the secure upstream socket, /* Write some data, previously received on the secure upstream socket,
* out of the downstream buffer and onto the backend socket */ * out of the downstream buffer and onto the backend socket */
static void back_write(struct ev_loop *loop, ev_io *w, int revents) { static void back_write(struct ev_loop *loop, ev_io *w, int revents) {
(void) revents;
int t; int t;
proxystate *ps = (proxystate *)w->data; proxystate *ps = (proxystate *)w->data;
int fd = w->fd; int fd = w->fd;
Expand Down Expand Up @@ -303,6 +305,7 @@ static void start_handshake(proxystate *ps, int err);
/* Continue/complete the asynchronous connect() before starting data transmission /* Continue/complete the asynchronous connect() before starting data transmission
* between front/backend */ * between front/backend */
static void handle_connect(struct ev_loop *loop, ev_io *w, int revents) { static void handle_connect(struct ev_loop *loop, ev_io *w, int revents) {
(void) revents;
int t; int t;
proxystate *ps = (proxystate *)w->data; proxystate *ps = (proxystate *)w->data;
t = connect(ps->fd_down, (struct sockaddr *)&backaddr, sizeof(backaddr)); t = connect(ps->fd_down, (struct sockaddr *)&backaddr, sizeof(backaddr));
Expand Down Expand Up @@ -359,6 +362,7 @@ static void end_handshake(proxystate *ps) {
* let OpenSSL do what it likes with the socket and obey its requests for reads * let OpenSSL do what it likes with the socket and obey its requests for reads
* or writes */ * or writes */
static void client_handshake(struct ev_loop *loop, ev_io *w, int revents) { static void client_handshake(struct ev_loop *loop, ev_io *w, int revents) {
(void) revents;
int t; int t;
proxystate *ps = (proxystate *)w->data; proxystate *ps = (proxystate *)w->data;


Expand Down Expand Up @@ -404,7 +408,8 @@ static void handle_fatal_ssl_error(proxystate *ps, int err) {
/* Read some data from the upstream secure socket via OpenSSL, /* Read some data from the upstream secure socket via OpenSSL,
* and buffer anything we get for writing to the backend */ * and buffer anything we get for writing to the backend */
static void client_read(struct ev_loop *loop, ev_io *w, int revents) { static void client_read(struct ev_loop *loop, ev_io *w, int revents) {
int t; (void) revents;
int t;
proxystate *ps = (proxystate *)w->data; proxystate *ps = (proxystate *)w->data;
if (ps->want_shutdown) { if (ps->want_shutdown) {
ev_io_stop(loop, &ps->ev_r_up); ev_io_stop(loop, &ps->ev_r_up);
Expand Down Expand Up @@ -432,6 +437,7 @@ static void client_read(struct ev_loop *loop, ev_io *w, int revents) {
/* Write some previously-buffered backend data upstream on the /* Write some previously-buffered backend data upstream on the
* secure socket using OpenSSL */ * secure socket using OpenSSL */
static void client_write(struct ev_loop *loop, ev_io *w, int revents) { static void client_write(struct ev_loop *loop, ev_io *w, int revents) {
(void) revents;
int t; int t;
int sz; int sz;
proxystate *ps = (proxystate *)w->data; proxystate *ps = (proxystate *)w->data;
Expand Down Expand Up @@ -469,6 +475,7 @@ static void client_write(struct ev_loop *loop, ev_io *w, int revents) {
* the proxystate is allocated and initalized, and we're off the races * the proxystate is allocated and initalized, and we're off the races
* connecting to the backend */ * connecting to the backend */
static void handle_accept(struct ev_loop *loop, ev_io *w, int revents) { static void handle_accept(struct ev_loop *loop, ev_io *w, int revents) {
(void) revents;
struct sockaddr addr; struct sockaddr addr;
socklen_t sl = sizeof(addr); socklen_t sl = sizeof(addr);
int client = accept(w->fd, &addr, &sl); int client = accept(w->fd, &addr, &sl);
Expand Down Expand Up @@ -587,13 +594,13 @@ static void parse_host_and_port(char *prog, char *name, char *inp, int wildcard_
int res; int res;


if (strlen(inp) > 149) { if (strlen(inp) > 149) {
sprintf(buf, "invalid option for %s HOST:PORT\n", name); snprintf(buf, sizeof buf, "invalid option for %s HOST:PORT\n", name);
usage_fail(prog, buf); usage_fail(prog, buf);
} }


sp = strchr(inp, ':'); sp = strchr(inp, ':');
if (!sp) { if (!sp) {
sprintf(buf, "invalid option for %s HOST:PORT\n", name); snprintf(buf, sizeof buf, "invalid option for %s HOST:PORT\n", name);
usage_fail(prog, buf); usage_fail(prog, buf);
} }


Expand Down

0 comments on commit d8cb7e9

Please sign in to comment.