From 3a27e8246069d1553ccf5b9ab377d5d076192afe Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 15 Jan 2022 16:31:42 -0800 Subject: [PATCH] API BREAK: return a C99 bool from 'gvusershape_file_access' --- CHANGELOG.md | 2 ++ lib/gvc/gvplugin_loadimage.h | 2 +- lib/gvc/gvusershape.c | 8 ++++---- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 113d7836a..678e57192 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 `pack_graph` now takes a `bool` array instead of a `boolean` array. - **Breaking**: `pccomps` now takes a C99 `bool` instead of a `boolean` output parameter. +- **Breaking**: `gvusershape_file_access` now returns 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/gvc/gvplugin_loadimage.h b/lib/gvc/gvplugin_loadimage.h index 4f496e283..ed81a82af 100644 --- a/lib/gvc/gvplugin_loadimage.h +++ b/lib/gvc/gvplugin_loadimage.h @@ -31,7 +31,7 @@ extern "C" { #define GVPLUGIN_LOADIMAGE_API /* nothing */ #endif -GVPLUGIN_LOADIMAGE_API boolean gvusershape_file_access(usershape_t *us); +GVPLUGIN_LOADIMAGE_API bool gvusershape_file_access(usershape_t *us); GVPLUGIN_LOADIMAGE_API void gvusershape_file_release(usershape_t *us); struct gvloadimage_engine_s { diff --git a/lib/gvc/gvusershape.c b/lib/gvc/gvusershape.c index ee06dd6d1..aaf3c8c49 100644 --- a/lib/gvc/gvusershape.c +++ b/lib/gvc/gvusershape.c @@ -586,7 +586,7 @@ usershape_t *gvusershape_find(const char *name) } #define MAX_USERSHAPE_FILES_OPEN 50 -boolean gvusershape_file_access(usershape_t *us) +bool gvusershape_file_access(usershape_t *us) { static int usershape_files_open_cnt; const char *fn; @@ -600,12 +600,12 @@ boolean gvusershape_file_access(usershape_t *us) else { if (! (fn = safefile(us->name))) { agerr(AGWARN, "Filename \"%s\" is unsafe\n", us->name); - return FALSE; + return false; } us->f = fopen(fn, "rb"); if (us->f == NULL) { agerr(AGWARN, "%s while opening %s\n", strerror(errno), fn); - return FALSE; + return false; } if (usershape_files_open_cnt >= MAX_USERSHAPE_FILES_OPEN) us->nocache = true; @@ -613,7 +613,7 @@ boolean gvusershape_file_access(usershape_t *us) usershape_files_open_cnt++; } assert(us->f); - return TRUE; + return true; } void gvusershape_file_release(usershape_t *us) -- 2.40.0