From de3c40be79001e12da4185003cf3e0ac22ed0837 Mon Sep 17 00:00:00 2001 From: Stefan Esser Date: Sun, 3 May 2020 18:30:58 -0600 Subject: [PATCH] Fix warnings on FreeBSD --- include/opt.h | 2 +- src/opt.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/opt.h b/include/opt.h index c9dea270..f5723857 100644 --- a/include/opt.h +++ b/include/opt.h @@ -58,7 +58,7 @@ typedef enum BcOptType { } BcOptType; typedef struct BcOptLong { - char *name; + const char *name; BcOptType type; int val; } BcOptLong; diff --git a/src/opt.c b/src/opt.c index 55a6809d..c9f82f4a 100644 --- a/src/opt.c +++ b/src/opt.c @@ -51,7 +51,7 @@ static bool bc_opt_longoptsEnd(const BcOptLong *longopts, size_t i) { return !longopts[i].name && !longopts[i].val; } -static char* bc_opt_longopt(const BcOptLong *longopts, int c) { +static const char* bc_opt_longopt(const BcOptLong *longopts, int c) { size_t i; @@ -62,7 +62,7 @@ static char* bc_opt_longopt(const BcOptLong *longopts, int c) { return "NULL"; } -static int bc_opt_error(BcError err, int c, char *str) { +static int bc_opt_error(BcError err, int c, const char *str) { int result; @@ -216,7 +216,7 @@ int bc_opt_parse(BcOpt *o, const BcOptLong *longopts) { for (i = 0; !bc_opt_longoptsEnd(longopts, i); i++) { - char *name = longopts[i].name; + const char *name = longopts[i].name; if (bc_opt_longoptsMatch(name, option)) {