aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-07-08 00:33:10 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-07-16 00:21:31 +0200
commite40b8106953be7ce7af5265bbeb6a59199f234a9 (patch)
treebef9e7b4a64f41cd5a918b4487785e6960a48960
parent9a7a095c6cabacc7f90a969a24e4f870e045f9e0 (diff)
downloadsparse-e40b8106953be7ce7af5265bbeb6a59199f234a9.tar.gz
predefine: let predefine_width() take the usual interface
All the helpers for type-related predefines directly take in argument the pointer to the type. All but predefine_width(). This must be an historical relic. So, let predefine_width() also take the pointer to the type as argument. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--predefine.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/predefine.c b/predefine.c
index 7120d438..f898cdfa 100644
--- a/predefine.c
+++ b/predefine.c
@@ -25,12 +25,12 @@ static void predefined_sizeof(const char *name, const char *suffix, unsigned bit
predefine(buf, 1, "%d", bits/8);
}
-static void predefined_width(const char *name, unsigned bits)
+static void predefined_width(const char *name, struct symbol *type)
{
char buf[32];
snprintf(buf, sizeof(buf), "__%s_WIDTH__", name);
- predefine(buf, 1, "%d", bits);
+ predefine(buf, 1, "%d", type->bit_size);
}
static void predefined_max(const char *name, struct symbol *type)
@@ -78,7 +78,7 @@ static void predefined_ctype(const char *name, struct symbol *type, int flags)
if (flags & PTYPE_TYPE)
predefined_type(name, type);
if (flags & PTYPE_WIDTH)
- predefined_width(name, bits);
+ predefined_width(name, type);
}
void predefined_macros(void)