summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRikard Falkeborn <rikard.falkeborn@gmail.com>2015-12-31 14:19:29 +0100
committerAllan McRae <allan@archlinux.org>2016-01-04 13:59:19 +1000
commit875c017e4d74bd29bc7424c2c7ff2050f90b7767 (patch)
tree2688a1d1b9ae6a3390bfd4f6f4b7343a755f27c6 /lib
parent2a0d188d6b289025bee18c9d9b615e0a9e19fc50 (diff)
Make alpm_graph state signedness explicit
The signedness of char is implementation defined. Since the alpm_graph state is clearly meant to be signed, make the signedness explicit. This fixes bugs on systems where char is unsigned, in comparissons of the following type: if(v.state == -1) which, if state is unsigned, will never be true due to integer promotion rules. Fixes failing test/pacman/tests/sync012.py when compiling with -funsigned-char. Fixes two warnings [-Wtype-limits] for comparissons with -1 when compiling with -funsigned-char. Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/graph.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libalpm/graph.h b/lib/libalpm/graph.h
index fb27ea87..76a268a5 100644
--- a/lib/libalpm/graph.h
+++ b/lib/libalpm/graph.h
@@ -29,7 +29,7 @@ typedef struct __alpm_graph_t {
alpm_list_t *children;
alpm_list_t *childptr; /* points to a child in children list */
off_t weight; /* weight of the node */
- char state; /* 0: untouched, -1: entered, other: leaving time */
+ signed char state; /* 0: untouched, -1: entered, other: leaving time */
} alpm_graph_t;
alpm_graph_t *_alpm_graph_new(void);