Skip to content

Commit

Permalink
replace asserts with error returns
Browse files Browse the repository at this point in the history
  • Loading branch information
omar-polo committed Jun 17, 2024
1 parent 27c6dc1 commit fb8311e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
3 changes: 0 additions & 3 deletions gmid.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include <time.h>
#include <tls.h>
#include <unistd.h>
#include <assert.h>

#include <openssl/x509.h>

Expand All @@ -60,8 +59,6 @@

#define GMID_VERSION "gmid/" VERSION

#define ASSERT_MSG(expr, msg) assert(((void)msg, (expr)))

#define GEMINI_URL_LEN (1024+3) /* URL max len + \r\n + \0 */

#define SUCCESS 20
Expand Down
7 changes: 4 additions & 3 deletions proxy-proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,16 @@ proxy_proto_v1_parse(struct proxy_protocol_v1 *s, char *buf, size_t buflen,
return (-1);
break;

default:
ASSERT_MSG(0, "unimplemented");
default:
return (-1);
}

if (check_port_v1(&s->srcport, &buf, &buflen) == -1 ||
check_port_v1(&s->dstport, &buf, &buflen) == -1)
return (-1);

assert('\n' == *buf);
if (*buf != '\n')
return (-1);
buf += 1;

*consumed = buf - begin;
Expand Down
1 change: 0 additions & 1 deletion server.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <sys/stat.h>
#include <sys/un.h>

#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <event.h>
Expand Down

0 comments on commit fb8311e

Please sign in to comment.