Skip to content

Commit

Permalink
Fix compiler warnings on gcc 13.2.1 (libusual#48)
Browse files Browse the repository at this point in the history
* Remove const annotation on PgSocket::connstr

It is not correct to call free() on a const pointer.

* Annotate a fallthrough in a switch

Various compilers will warn if this is not annotated.
  • Loading branch information
tristan957 authored Oct 17, 2023
1 parent ac3bd5d commit f8d49e2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion usual/pgsocket.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct PgSocket {
void *handler_arg;

/* saved connect string */
const char *connstr;
char *connstr;

/* custom base or NULL */
struct event_base *base;
Expand Down Expand Up @@ -123,6 +123,7 @@ static void report_last_result(struct PgSocket *db)
switch (PQresultStatus(res)) {
default:
log_error("%s: %s", PQdb(db->con), PQresultErrorMessage(res));
/* fallthrough */
case PGRES_COMMAND_OK:
case PGRES_TUPLES_OK:
case PGRES_COPY_OUT:
Expand Down

0 comments on commit f8d49e2

Please sign in to comment.