fix compilation error and warnings under Linux - ploot - simple plotting tools
(HTM) git clone git://bitreich.org/ploot git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/ploot
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
(DIR) LICENSE
---
(DIR) commit 50aea1263cf0d68aa2403894b92eb9584958af36
(DIR) parent ba18a4ef00490d0f3c5f5838772ed0ba69cc071f
(HTM) Author: Josuah Demangeon <me@josuah.net>
Date: Wed, 7 Sep 2022 11:29:25 +0200
fix compilation error and warnings under Linux
Diffstat:
M Makefile | 7 ++++---
M drawille.c | 8 ++++----
M tsv.c | 3 +--
3 files changed, 9 insertions(+), 9 deletions(-)
---
(DIR) diff --git a/Makefile b/Makefile
@@ -1,11 +1,12 @@
NAME = ploot
VERSION = v0.1
-D = -D_POSIX_C_SOURCE=200811L -D_BSD_SOURCE
+D = -D_POSIX_C_SOURCE=200811L -D_DEFAULT_SOURCE
CFLAGS = -Wall -Wextra -std=c99 -pedantic $W $D -fPIC
-LFLAGS = -static -lm
+LDFLAGS = -static
PREFIX = /usr/local
MANOREFIX = $(PREFIX)/share/man
+LIBS = -lm
SRC = tsv.c drawille.c font.c font13.c font8.c util.c
INC = tsv.h drawille.h font.h util.h
@@ -19,7 +20,7 @@ all: ${BIN}
${OBJ} ${BIN:=.o}: ${INC} Makefile
${BIN}: ${OBJ} ${BIN:=.o}
- ${CC} ${LFLAGS} -o $@ $@.o ${OBJ}
+ ${CC} ${LDFLAGS} -o $@ $@.o ${OBJ} ${LIBS}
install: ${BIN}
mkdir -p ${PREFIX}/bin ${MANDIR}/man1 ${MANDIR}/man5
(DIR) diff --git a/drawille.c b/drawille.c
@@ -109,17 +109,17 @@ drawille_line_init(struct line *l, int x0, int y0, int x1, int y1)
static int
drawille_line_next(struct line *l)
{
- int e;
+ int err;
if (l->x0 == l->x1 && l->y0 == l->y1)
return 0;
- e = l->err;
- if (e > -l->dx) {
+ err = l->err;
+ if (err > -l->dx) {
l->x0 += l->sx;
l->err -= l->dy;
}
- if (e < l->dy) {
+ if (err < l->dy) {
l->y0 += l->sy;
l->err += l->dx;
}
(DIR) diff --git a/tsv.c b/tsv.c
@@ -103,10 +103,9 @@ tsv_labels(FILE *fp, struct tsv **vlp, size_t *ncol)
char *field, *line, *cp;
struct tsv *vl, *col;
size_t sz;
- ssize_t r;
sz = 0, line = NULL;
- r = getline(&line, &sz, fp);
+ getline(&line, &sz, fp);
if (ferror(fp))
err(111, "error while reading from file");
if (feof(fp))