From 65c40c956fcd9443a5390d6cc36f84bd1bf77df4 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 2 Feb 2017 21:21:19 -0700 Subject: Use bool in Rust code This changes various functions in the Rust code to use a bool rather than an int when a boolean is intended. 2017-02-02 Tom Tromey * rust-exp.y (ends_raw_string, space_then_number) (rust_identifier_start_p): Return bool. * rust-lang.c (rust_tuple_type_p, rust_underscore_fields) (rust_tuple_struct_type_p, rust_tuple_variant_type_p) (rust_slice_type_p, rust_range_type_p, rust_u8_type_p) (rust_chartype_p): Return bool. (val_print_struct, rust_print_struct_def, rust_print_type): Update. * rust-lang.h (rust_tuple_type_p, rust_tuple_struct_type_p): Return bool. --- gdb/rust-exp.y | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'gdb/rust-exp.y') diff --git a/gdb/rust-exp.y b/gdb/rust-exp.y index 98301a4..b3e0366 100644 --- a/gdb/rust-exp.y +++ b/gdb/rust-exp.y @@ -1197,7 +1197,7 @@ starts_raw_string (const char *str) /* Return true if STR looks like the end of a raw string that had N hashes at the start. */ -static int +static bool ends_raw_string (const char *str, int n) { int i; @@ -1205,8 +1205,8 @@ ends_raw_string (const char *str, int n) gdb_assert (str[0] == '"'); for (i = 0; i < n; ++i) if (str[i + 1] != '#') - return 0; - return 1; + return false; + return true; } /* Lex a string constant. */ @@ -1283,7 +1283,7 @@ lex_string (void) /* Return true if STRING starts with whitespace followed by a digit. */ -static int +static bool space_then_number (const char *string) { const char *p = string; @@ -1291,14 +1291,14 @@ space_then_number (const char *string) while (p[0] == ' ' || p[0] == '\t') ++p; if (p == string) - return 0; + return false; return *p >= '0' && *p <= '9'; } /* Return true if C can start an identifier. */ -static int +static bool rust_identifier_start_p (char c) { return ((c >= 'a' && c <= 'z') -- cgit v1.1