gbranden pushed a commit to branch master
in repository groff.
commit aad4fd0160719cfce0eaa50b7b08e47c6caca21c
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed Jun 10 06:18:34 2026 -0500
[libgroff]: Boolify "quotearg.c".
* src/libs/libgroff/quotearg.c: Preprocessor-include "<stdbool.h>"
header file to ensure visibility of `true` and `false` symbols. Drop
preprocessor manipulations of `TRUE` and `FALSE` macros.
(needs_quoting): Migrate Boolean literals from preprocessor macros to
language objects. Demote return type from `int` to `bool`.
Continues the long process of fixing Savannah #66672.
---
ChangeLog | 14 ++++++++++++++
src/libs/libgroff/quotearg.c | 22 +++++++++-------------
2 files changed, 23 insertions(+), 13 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 93277025f..8c668841e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2026-06-11 G. Branden Robinson <[email protected]>
+
+ [libgroff]: Boolify "quotearg.c".
+
+ * src/libs/libgroff/quotearg.c: Preprocessor-include
+ "<stdbool.h>" header file to ensure visibility of `true` and
+ `false` symbols. Drop preprocessor manipulations of `TRUE` and
+ `FALSE` macros.
+ (needs_quoting): Migrate Boolean literals from preprocessor
+ macros to language objects. Demote return type from `int` to
+ `bool`.
+
+ Continues the long process of fixing Savannah #66672.
+
2026-06-10 G. Branden Robinson <[email protected]>
[libgroff]: Trivially refactor. Rename `string` class's private
diff --git a/src/libs/libgroff/quotearg.c b/src/libs/libgroff/quotearg.c
index e1b4a2a0e..0969bc7c3 100644
--- a/src/libs/libgroff/quotearg.c
+++ b/src/libs/libgroff/quotearg.c
@@ -22,6 +22,7 @@ along with this program. If not, see
<http://www.gnu.org/licenses/>. */
#include <config.h>
#endif
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -52,12 +53,7 @@ extern char *program_name; /* main program must define
this */
char *quote_arg(char *);
void purge_quoted_args(char **);
-#undef FALSE
-#undef TRUE
-#define FALSE 0
-#define TRUE 1
-
-static int
+static bool
needs_quoting(const char *string)
{
/* Scan 'string' to see whether it needs quoting for MSVC 'spawn'/'exec'
@@ -65,18 +61,18 @@ needs_quoting(const char *string)
*/
if (string == NULL) /* ignore NULL strings */
- return FALSE;
+ return false;
if (*string == '\0') /* explicit arguments of zero length */
- return TRUE; /* need quoting, so they aren't discarded */
-
+ return true; /* need quoting, so they aren't discarded */
+
while (*string) {
/* Scan non-NULL strings, up to '\0' terminator,
- * returning 'TRUE' if quote or whitespace found.
+ * returning 'true' if quote or whitespace found.
*/
if (*string == '"' || isspace(*string))
- return TRUE;
+ return true;
/* otherwise, continue scanning to end of string */
@@ -84,10 +80,10 @@ needs_quoting(const char *string)
}
/* Fall through, if no quotes or whitespace found,
- * in which case, return 'FALSE'.
+ * in which case, return 'false'.
*/
- return FALSE;
+ return false;
}
char *
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit