From 2e3a908d5f944ae31c468cf826a1d86f42a5e141 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 15 Jan 2022 15:38:07 -0800 Subject: [PATCH] API BREAK: use a C99 bool for 'usershape_t.must_inline' --- CHANGELOG.md | 2 ++ lib/common/psusershape.c | 7 ++++--- lib/common/usershape.h | 3 ++- plugin/core/gvloadimage_core.c | 3 ++- plugin/lasi/gvloadimage_lasi.c | 3 ++- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cee8c19d4..774e909cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 struct are now C99 `bool`s instead of Graphviz-specific `boolean`s. - **Breaking**: The `conc_opp_flag` field of the `Agedgeinfo_t` struct is now a C99 `bool` instead of a Graphviz-specific `boolean`. +- **Breaking**: The `must_inline` field of the `usershape_t` struct is now a C99 + `bool` instead of a Graphviz-specific `boolean`. - **Breaking**: 1-bit fields of the `obj_state_s` struct are now unsigned instead of signed. - **Breaking**: Graphviz headers no longer define the constant `MAXSHORT`. A diff --git a/lib/common/psusershape.c b/lib/common/psusershape.c index 85c7a7423..33d8b5159 100644 --- a/lib/common/psusershape.c +++ b/lib/common/psusershape.c @@ -39,7 +39,8 @@ static usershape_t *user_init(const char *str) char line[BUFSIZ]; FILE *fp; struct stat statbuf; - int must_inline, rc; + bool must_inline; + int rc; int lx, ly, ux, uy; usershape_t *us; @@ -56,13 +57,13 @@ static usershape_t *user_init(const char *str) } /* try to find size */ bool saw_bb = false; - must_inline = FALSE; + must_inline = false; while (fgets(line, sizeof(line), fp)) { if (sscanf (line, "%%%%BoundingBox: %d %d %d %d", &lx, &ly, &ux, &uy) == 4) { saw_bb = true; } - if ((line[0] != '%') && strstr(line,"read")) must_inline = TRUE; + if ((line[0] != '%') && strstr(line,"read")) must_inline = true; if (saw_bb && must_inline) break; } diff --git a/lib/common/usershape.h b/lib/common/usershape.h index 19d48d34d..9a36676ae 100644 --- a/lib/common/usershape.h +++ b/lib/common/usershape.h @@ -11,6 +11,7 @@ #pragma once #include "cdt.h" +#include #ifdef __cplusplus extern "C" { @@ -48,7 +49,7 @@ extern "C" { Dtlink_t link; const char *name; int macro_id; - boolean must_inline; + bool must_inline; boolean nocache; FILE *f; imagetype_t type; diff --git a/plugin/core/gvloadimage_core.c b/plugin/core/gvloadimage_core.c index eb6334ddb..66982eb35 100644 --- a/plugin/core/gvloadimage_core.c +++ b/plugin/core/gvloadimage_core.c @@ -10,6 +10,7 @@ #include "config.h" +#include #include #include #include @@ -188,7 +189,7 @@ static void core_loadimage_ps(GVJ_t * job, usershape_t *us, boxf b, boolean fill us->data = malloc(statbuf.st_size); read(fd, us->data, statbuf.st_size); #endif - us->must_inline = TRUE; + us->must_inline = true; break; default: break; diff --git a/plugin/lasi/gvloadimage_lasi.c b/plugin/lasi/gvloadimage_lasi.c index db644a3a1..cf06d5d17 100644 --- a/plugin/lasi/gvloadimage_lasi.c +++ b/plugin/lasi/gvloadimage_lasi.c @@ -10,6 +10,7 @@ #include "config.h" +#include #include #include #include @@ -76,7 +77,7 @@ static void lasi_loadimage_ps(GVJ_t * job, usershape_t *us, boxf b, boolean fill us->data = malloc(statbuf.st_size); read(fd, us->data, statbuf.st_size); #endif - us->must_inline = TRUE; + us->must_inline = true; break; default: break; -- 2.40.0